http

package
v0.0.0-...-27af30b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 4 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandlerFormatter

func HandlerFormatter(operation string, r *http.Request) string

HandlerFormatter is a span formatter that may be provided to otelhttp.WithSpanNameFormatter to include the component and url path in the span names generated by otelhttp.NewHandler.

func NewTransport

func NewTransport(rt http.RoundTripper) http.RoundTripper

NewTransport wraps the provided http.RoundTripper with one that automatically adds spans for each http request.

Note: special care has been taken to ensure that the returned http.RoundTripper has a CloseIdleConnections method because the otelhttp.Transport does not implement it: https://github.com/open-telemetry/opentelemetry-go-contrib/issues/3543. Once the issue is resolved the wrapper may be discarded.

func NewTransportWithInner

func NewTransportWithInner(rt http.RoundTripper, inner http.RoundTripper) http.RoundTripper

NewTransportWithInner wraps the provided http.RoundTripper with one that automatically adds spans for each http request. The inner round tripper is used to close idle connections when rt.CloseIdleConnections isn't implemented for the rt provided.

Note: special care has been taken to ensure that the returned http.RoundTripper has a CloseIdleConnections method because the otelhttp.Transport does not implement it: https://github.com/open-telemetry/opentelemetry-go-contrib/issues/3543. Once the issue is resolved the wrapper may be discarded.

func TransportFormatter

func TransportFormatter(_ string, r *http.Request) string

TransportFormatter is a span formatter that may be provided to otelhttp.WithSpanNameFormatter to include the url path in the span names generated by an otelhttp.Transport.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL