otelhttptrace

package module
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2021 License: Apache-2.0 Imports: 14 Imported by: 111

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 added in v0.24.0

func SemVersion() string

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

func Version added in v0.24.0

func Version() string

Version is the current release version of the httptrace instrumentation.

func W3C

W3C client.

Types

type ClientTraceOption added in v0.23.0

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

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

func WithInsecureHeaders added in v0.23.0

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 added in v0.23.0

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 WithoutHeaders added in v0.23.0

func WithoutHeaders() ClientTraceOption

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

func WithoutSubSpans added in v0.23.0

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

Directories

Path Synopsis
example module
test module

Jump to

Keyboard shortcuts

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