HttpClientInstrumentation
class HttpClientInstrumentation extends AbstractInstrumentation
Traits
Constants
| protected DURATION_BOUNDARIES |
|
| protected TRACE_OPTION |
|
| protected REDIRECT_COUNT_OPTION |
|
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.
Index callback observers by their matching instrument name.
Create HTTP client instrumentation.
Register per-request trace controls.
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 physical request.
Record the duration and end the client span.
Return the effective HTTP port.
Details
in
AbstractInstrumentation at line 18
final void
register(array $options)
Register the instrumentation with normalized options.
at line 102
protected void
registerInstrumentation()
Register HTTP client middleware and instruments.
in
AbstractInstrumentation at line 32
protected bool
tracesEnabled()
Determine whether trace output is enabled.
in
AbstractInstrumentation at line 40
protected bool
metricEnabled(string $name)
Determine whether a metric is enabled.
in
AbstractInstrumentation at line 55
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 85
__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 150
protected void
registerTraceMacros()
Register per-request trace controls.
at line 171
protected Closure
middleware()
Return the physical-send middleware.
at line 291
protected bool
shouldTrace(array $options)
Determine whether this request should create a client span.
at line 301
protected array
methodAttributes(RequestInterface $request)
Return the method attributes for a physical request.
at line 324
protected array
requestAttributes(RequestInterface $request, array $methodAttributes)
Return attributes shared by the span and duration metric.
at line 341
protected array
requestTraceAttributes(RequestInterface $request, array $methodAttributes, array $options)
Return recording-only request attributes.
at line 369
protected void
applyUrlTemplate(SpanInterface $span, RequestInterface $request, array $methodAttributes)
Apply an application-provided URL template to a recording span.
at line 410
protected void
completeResponse(ResponseInterface $response, SpanInterface|null $span, ContextInterface $context, int $startedAt, array $requestAttributes)
Complete a successful physical request.
at line 449
protected void
completeFailure(Throwable $exception, SpanInterface|null $span, ContextInterface $context, int $startedAt, array $requestAttributes)
Complete a failed physical request.
at line 483
protected void
complete(SpanInterface|null $span, ContextInterface $context, int $startedAt, array $attributes)
Record the duration and end the client span.
at line 502
protected int|null
effectivePort(UriInterface $uri)
Return the effective HTTP port.