blob: de1147fa610e0cd94e981b44290555162a5d6aa7 (
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
|
<?php
declare(strict_types=1);
namespace OpenTelemetry\SDK\Trace;
use OpenTelemetry\Context\ContextInterface;
use OpenTelemetry\SDK\Common\Attribute\AttributesInterface;
/**
* This interface is used to organize sampling logic.
*
* @see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk.md#sampler
*/
interface SamplerInterface
{
/**
* Returns SamplingResult.
*
* @param ContextInterface $parentContext Context with parent Span. The Span's SpanContext may be invalid to indicate a root span.
* @param string $traceId TraceId of the Span to be created. It can be different from the TraceId in the SpanContext.
* Typically in situations when the Span to be created starts a new Trace.
* @param string $spanName Name of the Span to be created.
* @param int $spanKind Span kind.
* @param AttributesInterface $attributes Initial set of Attributes for the Span being constructed.
* @param list<LinkInterface> $links Collection of links that will be associated with the Span to be created.
* Typically, useful for batch operations.
* @see https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/overview.md#links-between-spans
* @return SamplingResult
*/
public function shouldSample(
ContextInterface $parentContext,
string $traceId,
string $spanName,
int $spanKind,
AttributesInterface $attributes,
array $links
): SamplingResult;
/**
* Returns the sampler name or short description with the configuration.
* This may be displayed on debug pages or in the logs.
* Example: "TraceIdRatioBasedSampler{0.000100}"
*/
public function getDescription(): string;
}
|