TelemetryNetworkSpan

A timed outbound HTTP request reported to the installed TelemetrySink.

Obtain one from Telemetry.startNetworkSpan and always stop it from a finally block, so that transport failures are timed too.

Implementations must be safe to call from any thread and must never throw.

Functions

Link copied to clipboard
abstract fun putAttribute(name: String, value: String)

Attaches a low-cardinality label, subject to the same constraints as TelemetrySpan.putAttribute.

Link copied to clipboard
abstract fun setRequestPayloadSize(bytes: Long)

Records the size of the request body in bytes.

Link copied to clipboard
abstract fun setResponseCode(code: Int)

Records the HTTP status code of the response.

Link copied to clipboard
abstract fun setResponseContentType(contentType: String?)

Records the response Content-Type.

Link copied to clipboard
abstract fun setResponsePayloadSize(bytes: Long)

Records the size of the response body in bytes.

Link copied to clipboard
abstract fun stop()

Ends the span and reports its duration. Calling this more than once has no effect.