summaryrefslogtreecommitdiff
path: root/vendor/open-telemetry/sdk/Metrics/Stream/MetricStreamInterface.php
blob: 1373a1c935ad4026074b04f6f23e74cd4b938c29 (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
58
<?php

declare(strict_types=1);

namespace OpenTelemetry\SDK\Metrics\Stream;

use OpenTelemetry\SDK\Metrics\Data\DataInterface;
use OpenTelemetry\SDK\Metrics\Data\Temporality;

/**
 * @internal
 */
interface MetricStreamInterface
{
    /**
     * Returns the internal temporality of this stream.
     *
     * @return string|Temporality internal temporality
     */
    public function temporality();

    /**
     * Returns the last metric timestamp.
     *
     * @return int metric timestamp
     */
    public function timestamp(): int;

    /**
     * Pushes metric data to the stream.
     *
     * @param Metric $metric metric data to push
     */
    public function push(Metric $metric): void;

    /**
     * Registers a new reader with the given temporality.
     *
     * @param string|Temporality $temporality temporality to use
     * @return int reader id
     */
    public function register($temporality): int;

    /**
     * Unregisters the given reader.
     *
     * @param int $reader reader id
     */
    public function unregister(int $reader): void;

    /**
     * Collects metric data for the given reader.
     *
     * @param int $reader reader id
     * @return DataInterface metric data
     */
    public function collect(int $reader): DataInterface;
}