File: TracerInterface.php

package info (click to toggle)
mediawiki 1%3A1.43.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 417,464 kB
  • sloc: php: 1,062,949; javascript: 664,290; sql: 9,714; python: 5,458; xml: 3,489; sh: 1,131; makefile: 64
file content (49 lines) | stat: -rw-r--r-- 1,813 bytes parent folder | download
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
<?php
namespace Wikimedia\Telemetry;

use Wikimedia\Assert\PreconditionException;

/**
 * Base interface for an OpenTelemetry tracer responsible for creating spans.
 * @since 1.43
 */
interface TracerInterface {
	/**
	 * Create a span with the given name and the currently active span as the implicit parent.
	 * This requires a span to be already active and will throw an error otherwise.
	 *
	 * @param string $spanName The descriptive name of this span.
	 * Refer to the <a href="https://opentelemetry.io/docs/specs/otel/trace/api/#span">OTEL Tracing API
	 * spec</a> for recommended naming conventions.
	 * @return SpanInterface
	 * @throws PreconditionException If no span was active
	 */
	public function createSpan( string $spanName ): SpanInterface;

	/**
	 * Create a new root span, i.e. a span with no parent that forms the basis for a new trace.
	 *
	 * @param string $spanName The descriptive name of this span.
	 * Refer to the <a href="https://opentelemetry.io/docs/specs/otel/trace/api/#span">OTEL Tracing API
	 * spec</a> for recommended naming conventions.
	 * @return SpanInterface
	 */
	public function createRootSpan( string $spanName ): SpanInterface;

	/**
	 * Create a span with the given name and parent.
	 *
	 * @param string $spanName The descriptive name of this span.
	 * Refer to the <a href="https://opentelemetry.io/docs/specs/otel/trace/api/#span">OTEL Tracing API
	 * spec</a> for recommended naming conventions.
	 * @param SpanContext $parentSpanContext Context of the parent span this span should be associated with.
	 * @return SpanInterface
	 */
	public function createSpanWithParent( string $spanName, SpanContext $parentSpanContext ): SpanInterface;

	/**
	 * Shut down this tracer and export collected trace data.
	 * @return void
	 */
	public function shutdown(): void;
}