diff options
Diffstat (limited to 'vendor/open-telemetry/sdk/Metrics/Exemplar/ExemplarFilter')
3 files changed, 64 insertions, 0 deletions
diff --git a/vendor/open-telemetry/sdk/Metrics/Exemplar/ExemplarFilter/AllExemplarFilter.php b/vendor/open-telemetry/sdk/Metrics/Exemplar/ExemplarFilter/AllExemplarFilter.php new file mode 100644 index 000000000..b74e738aa --- /dev/null +++ b/vendor/open-telemetry/sdk/Metrics/Exemplar/ExemplarFilter/AllExemplarFilter.php @@ -0,0 +1,21 @@ +<?php + +declare(strict_types=1); + +namespace OpenTelemetry\SDK\Metrics\Exemplar\ExemplarFilter; + +use OpenTelemetry\Context\ContextInterface; +use OpenTelemetry\SDK\Common\Attribute\AttributesInterface; +use OpenTelemetry\SDK\Metrics\Exemplar\ExemplarFilterInterface; + +/** + * The exemplar spec is not yet stable, and can change at any time. + * @see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#exemplar + */ +final class AllExemplarFilter implements ExemplarFilterInterface +{ + public function accepts($value, AttributesInterface $attributes, ContextInterface $context, int $timestamp): bool + { + return true; + } +} diff --git a/vendor/open-telemetry/sdk/Metrics/Exemplar/ExemplarFilter/NoneExemplarFilter.php b/vendor/open-telemetry/sdk/Metrics/Exemplar/ExemplarFilter/NoneExemplarFilter.php new file mode 100644 index 000000000..91fdf3b55 --- /dev/null +++ b/vendor/open-telemetry/sdk/Metrics/Exemplar/ExemplarFilter/NoneExemplarFilter.php @@ -0,0 +1,21 @@ +<?php + +declare(strict_types=1); + +namespace OpenTelemetry\SDK\Metrics\Exemplar\ExemplarFilter; + +use OpenTelemetry\Context\ContextInterface; +use OpenTelemetry\SDK\Common\Attribute\AttributesInterface; +use OpenTelemetry\SDK\Metrics\Exemplar\ExemplarFilterInterface; + +/** + * The exemplar spec is not yet stable, and can change at any time. + * see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#exemplar + */ +final class NoneExemplarFilter implements ExemplarFilterInterface +{ + public function accepts($value, AttributesInterface $attributes, ContextInterface $context, int $timestamp): bool + { + return false; + } +} diff --git a/vendor/open-telemetry/sdk/Metrics/Exemplar/ExemplarFilter/WithSampledTraceExemplarFilter.php b/vendor/open-telemetry/sdk/Metrics/Exemplar/ExemplarFilter/WithSampledTraceExemplarFilter.php new file mode 100644 index 000000000..3e800b416 --- /dev/null +++ b/vendor/open-telemetry/sdk/Metrics/Exemplar/ExemplarFilter/WithSampledTraceExemplarFilter.php @@ -0,0 +1,22 @@ +<?php + +declare(strict_types=1); + +namespace OpenTelemetry\SDK\Metrics\Exemplar\ExemplarFilter; + +use OpenTelemetry\API\Trace\Span; +use OpenTelemetry\Context\ContextInterface; +use OpenTelemetry\SDK\Common\Attribute\AttributesInterface; +use OpenTelemetry\SDK\Metrics\Exemplar\ExemplarFilterInterface; + +/** + * The exemplar spec is not yet stable, and can change at any time. + * @see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#exemplar + */ +final class WithSampledTraceExemplarFilter implements ExemplarFilterInterface +{ + public function accepts($value, AttributesInterface $attributes, ContextInterface $context, int $timestamp): bool + { + return Span::fromContext($context)->getContext()->isSampled(); + } +} |