summaryrefslogtreecommitdiff
path: root/vendor/open-telemetry/sdk/Trace/SpanLimits.php
blob: 4b07649fc34697b46ad3d92d7822c80626e62760 (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
59
60
61
62
63
64
65
66
67
<?php

declare(strict_types=1);

namespace OpenTelemetry\SDK\Trace;

use OpenTelemetry\SDK\Common\Attribute\AttributesFactoryInterface;

final class SpanLimits
{
    public const DEFAULT_SPAN_ATTRIBUTE_LENGTH_LIMIT = PHP_INT_MAX;
    public const DEFAULT_SPAN_ATTRIBUTE_COUNT_LIMIT = 128;
    public const DEFAULT_SPAN_EVENT_COUNT_LIMIT = 128;
    public const DEFAULT_SPAN_LINK_COUNT_LIMIT = 128;
    public const DEFAULT_EVENT_ATTRIBUTE_COUNT_LIMIT = 128;
    public const DEFAULT_LINK_ATTRIBUTE_COUNT_LIMIT = 128;

    private AttributesFactoryInterface $attributesFactory;
    private AttributesFactoryInterface $eventAttributesFactory;
    private AttributesFactoryInterface $linkAttributesFactory;
    private int $eventCountLimit;
    private int $linkCountLimit;

    public function getAttributesFactory(): AttributesFactoryInterface
    {
        return $this->attributesFactory;
    }

    public function getEventAttributesFactory(): AttributesFactoryInterface
    {
        return $this->eventAttributesFactory;
    }

    public function getLinkAttributesFactory(): AttributesFactoryInterface
    {
        return $this->linkAttributesFactory;
    }

    /** @return int Maximum allowed span event count */
    public function getEventCountLimit(): int
    {
        return $this->eventCountLimit;
    }

    /** @return int Maximum allowed span link count */
    public function getLinkCountLimit(): int
    {
        return $this->linkCountLimit;
    }

    /**
     * @internal Use {@see SpanLimitsBuilder} to create {@see SpanLimits} instance.
     */
    public function __construct(
        AttributesFactoryInterface $attributesFactory,
        AttributesFactoryInterface $eventAttributesFactory,
        AttributesFactoryInterface $linkAttributesFactory,
        int $eventCountLimit,
        int $linkCountLimit
    ) {
        $this->attributesFactory = $attributesFactory;
        $this->eventAttributesFactory = $eventAttributesFactory;
        $this->linkAttributesFactory = $linkAttributesFactory;
        $this->eventCountLimit = $eventCountLimit;
        $this->linkCountLimit = $linkCountLimit;
    }
}