http

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: Apache-2.0 Imports: 12 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasMultiPartFormDataContentTypeHeader added in v0.8.0

func HasMultiPartFormDataContentTypeHeader(h HeaderAccessor) bool

HasMultiPartFormDataContentTypeHeader returns true if the Content-Type header is multipart/form-data. false otherwise.

func SetAttributesFromHeaders

func SetAttributesFromHeaders(_type string, headers HeaderAccessor, span sdk.Span)

SetAttributesFromHeaders set attributes into span from a HeaderAccessor

func ShouldRecordBodyOfContentType

func ShouldRecordBodyOfContentType(h HeaderAccessor) bool

ShouldRecordBodyOfContentType checks if the body is meant to be recorded based on the content-type and the fact that body is not streamed.

func WrapHandler

func WrapHandler(delegate http.Handler, spanFromContext sdk.SpanFromContext, options *Options, spanAttributes map[string]string,
	mh sdk.HttpOperationMetricsHandler) http.Handler

WrapHandler wraps an uninstrumented handler (e.g. a handleFunc) and returns a new one that should be used as base to an instrumented handler

func WrapTransport

func WrapTransport(delegate http.RoundTripper, spanFromContextRetriever sdk.SpanFromContext, spanAttributes map[string]string) http.RoundTripper

WrapTransport returns a new http.RoundTripper that should be wrapped by an instrumented http.RoundTripper

Types

type HeaderAccessor

type HeaderAccessor interface {
	Lookup(key string) []string
	ForEachHeader(callback func(key string, values []string) error) error
	AddHeader(key, values string)
}

HeaderAccessor allows accessing HTTP header values.

Go packages use varying data structures and conventions for storing header key-values. Using this interface allows us our functions to not be tied to a particular such format.

func NewHeaderMapAccessor

func NewHeaderMapAccessor(h http.Header) HeaderAccessor

NewHeaderMapAccessor returns a HeaderAccessor

type Options

type Options struct {
	Filter filter.Filter
}

Options for HTTP handler instrumentation

Jump to

Keyboard shortcuts

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