summaryrefslogtreecommitdiff
path: root/vendor/open-telemetry/sdk/Metrics/AggregationInterface.php
blob: 0a85207e042fa872ef6d5508776a937d02fb7647 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php

declare(strict_types=1);

namespace OpenTelemetry\SDK\Metrics;

use OpenTelemetry\Context\ContextInterface;
use OpenTelemetry\SDK\Common\Attribute\AttributesInterface;
use OpenTelemetry\SDK\Metrics\Data\DataInterface;
use OpenTelemetry\SDK\Metrics\Data\Exemplar;
use OpenTelemetry\SDK\Metrics\Data\Temporality;

/**
 * @psalm-template T
 */
interface AggregationInterface
{
    /**
     * @psalm-return T
     */
    public function initialize();

    /**
     * @psalm-param T $summary
     * @psalm-param float|int $value
     */
    public function record($summary, $value, AttributesInterface $attributes, ContextInterface $context, int $timestamp): void;

    /**
     * @psalm-param T $left
     * @psalm-param T $right
     * @psalm-return T
     */
    public function merge($left, $right);

    /**
     * @psalm-param T $left
     * @psalm-param T $right
     * @psalm-return T
     */
    public function diff($left, $right);

    /**
     * @param array<AttributesInterface> $attributes
     * @psalm-param array<T> $summaries
     * @param array<list<Exemplar>> $exemplars
     * @param string|Temporality $temporality
     */
    public function toData(
        array $attributes,
        array $summaries,
        array $exemplars,
        int $startTimestamp,
        int $timestamp,
        $temporality
    ): DataInterface;
}