otel_http_trace

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HTTPStatus                 = attribute.Key("http.status")
	HTTPHeaderMIME             = attribute.Key("http.mime")
	HTTPRemoteAddr             = attribute.Key("http.remote")
	HTTPLocalAddr              = attribute.Key("http.local")
	HTTPConnectionReused       = attribute.Key("http.conn.reused")
	HTTPConnectionWasIdle      = attribute.Key("http.conn.wasidle")
	HTTPConnectionIdleTime     = attribute.Key("http.conn.idletime")
	HTTPConnectionStartNetwork = attribute.Key("http.conn.start.network")
	HTTPConnectionDoneNetwork  = attribute.Key("http.conn.done.network")
	HTTPConnectionDoneAddr     = attribute.Key("http.conn.done.addr")
	HTTPDNSAddrs               = attribute.Key("http.dns.addrs")
)

HTTP attributes.

Functions

func Extract

Extract returns the Attributes, Context Entries, and SpanContext that were encoded by Inject.

func Inject

func Inject(ctx context.Context, req *http.Request, opts ...Option)

func NewClientTrace

func NewClientTrace(ctx context.Context, opts ...ClientTraceOption) *httptrace.ClientTrace

NewClientTrace returns an httptrace.ClientTrace implementation that will record OpenTelemetry spans for requests made by an http.Client. By default several spans will be added to the trace for various stages of a request (dns, connection, tls, etc). Also by default, all HTTP headers will be added as attributes to spans, although several headers will be automatically redacted: Authorization, WWW-Authenticate, Proxy-Authenticate, Proxy-Authorization, Cookie, and Set-Cookie.

func SemVersion

func SemVersion() string

SemVersion is the semantic version to be supplied to tracer/meter creation.

func Version

func Version() string

Version is the current release version of the httptrace instrumentation.

func W3C

W3C client.

Types

type ClientTraceOption

type ClientTraceOption interface {
	// contains filtered or unexported methods
}

ClientTraceOption allows customizations to how the httptrace.Client collects information.

func WithInsecureHeaders

func WithInsecureHeaders() ClientTraceOption

WithInsecureHeaders will add span attributes for all http headers *INCLUDING* the sensitive headers that are redacted by default. The attribute values will include the raw un-redacted text. This might be useful for debugging authentication related issues, but should not be used for production deployments.

func WithRedactedHeaders

func WithRedactedHeaders(headers ...string) ClientTraceOption

WithRedactedHeaders will be replaced by fixed '****' values for the header names provided. These are in addition to the sensitive headers already redacted by default: Authorization, WWW-Authenticate, Proxy-Authenticate Proxy-Authorization, Cookie, Set-Cookie

func WithTracerProvider

func WithTracerProvider(provider trace.TracerProvider) ClientTraceOption

WithTracerProvider specifies a tracer provider for creating a tracer. The global provider is used if none is specified.

func WithoutHeaders

func WithoutHeaders() ClientTraceOption

WithoutHeaders will disable adding span attributes for the http headers and values.

func WithoutSubSpans

func WithoutSubSpans() ClientTraceOption

WithoutSubSpans will modify the httptrace.ClientTrace to only collect data as Events and Attributes on a span found in the context. By default sub-spans will be generated.

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option allows configuration of the httptrace Extract() and Inject() functions.

func WithPropagators

func WithPropagators(props propagation.TextMapPropagator) Option

WithPropagators sets the propagators to use for Extraction and Injection

Jump to

Keyboard shortcuts

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