HttpClientInstrumentation
class HttpClientInstrumentation extends AbstractInstrumentation
Traits
Constants
| protected DURATION_BOUNDARIES |
|
| protected REDIRECT_COUNT_OPTION |
|
| protected URL_TEMPLATE |
|
Properties
| protected InstrumentationOptions | $options | from AbstractInstrumentation | |
| protected array<string, true> | $knownMethods | ||
| protected bool | $manual | ||
| protected TracerInterface|null | $tracer | ||
| protected HistogramInterface|null | $duration | ||
| protected HttpTelemetryAttributes | $httpAttributes |
Methods
Register the instrumentation with normalized options.
Register HTTP client middleware and instruments.
Determine whether a metric is enabled.
Determine whether the throwable is a direct coroutine cancellation.
Return the semantic conventions schema URL for Hypervel instrumentation scopes.
Index callback observers by their matching instrument name.
Create HTTP client instrumentation.
Return the physical-send middleware.
Determine whether this request should create a client span.
Return the method attributes for a physical request.
Return attributes shared by the span and duration metric.
Return recording-only request attributes.
Apply an application-provided URL template to a recording span.
Complete a successful physical request.
Complete a failed or canceled physical request.
Record the duration and end the client span.
Return the effective HTTP port.
Details
in
AbstractInstrumentation at line 21
final void
register(array $options)
Register the instrumentation with normalized options.
at line 101
protected void
registerInstrumentation()
Register HTTP client middleware and instruments.
in
AbstractInstrumentation at line 35
protected bool
tracesEnabled()
Determine whether trace output is enabled.
in
AbstractInstrumentation at line 43
protected bool
metricEnabled(string $name)
Determine whether a metric is enabled.
in
AbstractInstrumentation at line 53
protected bool
isDirectCancellation(Throwable|null $exception)
Determine whether the throwable is a direct coroutine cancellation.
Ending an operation by direct cancellation is control flow, not a failure.
in
AbstractInstrumentation at line 64
protected string
schemaUrl()
Return the semantic conventions schema URL for Hypervel instrumentation scopes.
Every tracer, meter and logger obtained for one scope must pass the same URL.
in
AbstractInstrumentation at line 79
protected array
indexObservers(array $names, array $observers)
Index callback observers by their matching instrument name.
The SDK supplies observers in the same order as the instruments passed to batchObserve(), so the unchanged name order is the mapping contract.
at line 84
__construct(Factory $factory, TracerProviderInterface $tracerProvider, MeterProviderInterface $meterProvider, TextMapPropagatorInterface $propagator, PsrRequestHeadersSetter $requestSetter, ClockInterface $clock, OpenTelemetryManager $manager, ExceptionContextRegistry $exceptionContexts, OperationOrigin $origins, ProcessIdentity $identity)
Create HTTP client instrumentation.
at line 145
protected Closure
middleware()
Return the physical-send middleware.
at line 262
protected bool
shouldTrace(array $options)
Determine whether this request should create a client span.
at line 272
protected array
methodAttributes(RequestInterface $request)
Return the method attributes for a physical request.
at line 295
protected array
requestAttributes(RequestInterface $request, array $methodAttributes)
Return attributes shared by the span and duration metric.
at line 312
protected array
requestTraceAttributes(RequestInterface $request, array $methodAttributes, array $options)
Return recording-only request attributes.
at line 340
protected void
applyUrlTemplate(SpanInterface $span, RequestInterface $request, array $methodAttributes)
Apply an application-provided URL template to a recording span.
at line 383
protected void
completeResponse(ResponseInterface $response, SpanInterface|null $span, ContextInterface $context, int $startedAt, array $requestAttributes)
Complete a successful physical request.
at line 422
protected void
completeFailure(Throwable $exception, SpanInterface|null $span, ContextInterface $context, int $startedAt, array $requestAttributes)
Complete a failed or canceled physical request.
at line 463
protected void
complete(SpanInterface|null $span, ContextInterface $context, int $startedAt, array $attributes)
Record the duration and end the client span.
at line 482
protected int|null
effectivePort(UriInterface $uri)
Return the effective HTTP port.