| 1 | <?php |
| 2 | namespace Wikimedia\Telemetry; |
| 3 | |
| 4 | /** |
| 5 | * Interface for OTEL span samplers. |
| 6 | * @since 1.43 |
| 7 | */ |
| 8 | interface SamplerInterface { |
| 9 | /** |
| 10 | * Determine whether a newly created span should be sampled based on its parent span data. |
| 11 | * |
| 12 | * @param SpanContext|null $parentSpanContext Context of he parent span of the newly created span, |
| 13 | * or `null` if the newly created span is a root span. |
| 14 | * @return bool Whether the newly created span should be sampled. |
| 15 | */ |
| 16 | public function shouldSample( ?SpanContext $parentSpanContext ): bool; |
| 17 | } |