http

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 16 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitHttpMetrics added in v0.3.0

func InitHttpMetrics(meter metric.Meter)

InitHttpMetrics TODO: The init function may be executed after the HttpServerOperationListener() method so we need to make sure the otel_setup is executed before all the init() function related to issue https://github.com/alibaba/opentelemetry-go-auto-instrumentation/issues/48

Types

type HttpClientAttrsExtractor

type HttpClientAttrsExtractor[REQUEST any, RESPONSE any, GETTER1 HttpClientAttrsGetter[REQUEST, RESPONSE], GETTER2 net.NetworkAttrsGetter[REQUEST, RESPONSE]] struct {
	Base             HttpCommonAttrsExtractor[REQUEST, RESPONSE, GETTER1, GETTER2]
	NetworkExtractor net.NetworkAttrsExtractor[REQUEST, RESPONSE, GETTER2]
}

func (*HttpClientAttrsExtractor[REQUEST, RESPONSE, GETTER1, GETTER2]) GetSpanKey added in v0.6.0

func (h *HttpClientAttrsExtractor[REQUEST, RESPONSE, GETTER1, GETTER2]) GetSpanKey() attribute.Key

func (*HttpClientAttrsExtractor[REQUEST, RESPONSE, GETTER1, GETTER2]) OnEnd

func (h *HttpClientAttrsExtractor[REQUEST, RESPONSE, GETTER1, GETTER2]) OnEnd(attributes []attribute.KeyValue, context context.Context, request REQUEST, response RESPONSE, err error) ([]attribute.KeyValue, context.Context)

func (*HttpClientAttrsExtractor[REQUEST, RESPONSE, GETTER1, GETTER2]) OnStart

func (h *HttpClientAttrsExtractor[REQUEST, RESPONSE, GETTER1, GETTER2]) OnStart(attributes []attribute.KeyValue, parentContext context.Context, request REQUEST) ([]attribute.KeyValue, context.Context)

type HttpClientAttrsGetter

type HttpClientAttrsGetter[REQUEST any, RESPONSE any] interface {
	HttpCommonAttrsGetter[REQUEST, RESPONSE]
	net.NetworkAttrsGetter[REQUEST, RESPONSE]
	GetUrlFull(request REQUEST) string
	GetServerAddress(request REQUEST) string
	GetServerPort(request REQUEST) int
}

type HttpClientMetric added in v0.3.0

type HttpClientMetric struct {
	// contains filtered or unexported fields
}

func HttpClientMetrics added in v0.3.0

func HttpClientMetrics() *HttpClientMetric

func (HttpClientMetric) OnAfterEnd added in v0.3.0

func (h HttpClientMetric) OnAfterEnd(context context.Context, endAttributes []attribute.KeyValue, endTime time.Time)

func (HttpClientMetric) OnAfterStart added in v0.3.0

func (h HttpClientMetric) OnAfterStart(context context.Context, endTime time.Time)

func (HttpClientMetric) OnBeforeEnd added in v0.3.0

func (h HttpClientMetric) OnBeforeEnd(ctx context.Context, startAttributes []attribute.KeyValue, startTime time.Time) context.Context

func (HttpClientMetric) OnBeforeStart added in v0.3.0

func (h HttpClientMetric) OnBeforeStart(parentContext context.Context, startTime time.Time) context.Context

type HttpClientSpanNameExtractor

type HttpClientSpanNameExtractor[REQUEST any, RESPONSE any] struct {
	Getter HttpClientAttrsGetter[REQUEST, RESPONSE]
}

func (*HttpClientSpanNameExtractor[REQUEST, RESPONSE]) Extract

func (h *HttpClientSpanNameExtractor[REQUEST, RESPONSE]) Extract(request REQUEST) string

type HttpClientSpanStatusExtractor added in v0.0.2

type HttpClientSpanStatusExtractor[REQUEST any, RESPONSE any] struct {
	Getter HttpCommonAttrsGetter[REQUEST, RESPONSE]
}

func (HttpClientSpanStatusExtractor[REQUEST, RESPONSE]) Extract added in v0.0.2

func (h HttpClientSpanStatusExtractor[REQUEST, RESPONSE]) Extract(span trace.Span, request REQUEST, response RESPONSE, err error)

type HttpCommonAttrsExtractor

type HttpCommonAttrsExtractor[REQUEST any, RESPONSE any, GETTER1 HttpCommonAttrsGetter[REQUEST, RESPONSE], GETTER2 net.NetworkAttrsGetter[REQUEST, RESPONSE]] struct {
	HttpGetter       GETTER1
	NetGetter        GETTER2
	AttributesFilter func(attrs []attribute.KeyValue) []attribute.KeyValue
}

func (*HttpCommonAttrsExtractor[REQUEST, RESPONSE, GETTER, GETTER2]) OnEnd

func (h *HttpCommonAttrsExtractor[REQUEST, RESPONSE, GETTER, GETTER2]) OnEnd(attributes []attribute.KeyValue, context context.Context, request REQUEST, response RESPONSE, err error) ([]attribute.KeyValue, context.Context)

func (*HttpCommonAttrsExtractor[REQUEST, RESPONSE, GETTER1, GETTER2]) OnStart

func (h *HttpCommonAttrsExtractor[REQUEST, RESPONSE, GETTER1, GETTER2]) OnStart(attributes []attribute.KeyValue, parentContext context.Context, request REQUEST) ([]attribute.KeyValue, context.Context)

type HttpCommonAttrsGetter

type HttpCommonAttrsGetter[REQUEST any, RESPONSE any] interface {
	GetRequestMethod(request REQUEST) string
	GetHttpRequestHeader(request REQUEST, name string) []string
	GetHttpResponseStatusCode(request REQUEST, response RESPONSE, err error) int
	GetHttpResponseHeader(request REQUEST, response RESPONSE, name string) []string
	GetErrorType(request REQUEST, response RESPONSE, err error) string
}

type HttpServerAttrsExtractor

type HttpServerAttrsExtractor[REQUEST any, RESPONSE any, GETTER1 HttpServerAttrsGetter[REQUEST, RESPONSE], GETTER2 net.NetworkAttrsGetter[REQUEST, RESPONSE], GETTER3 net.UrlAttrsGetter[REQUEST]] struct {
	Base             HttpCommonAttrsExtractor[REQUEST, RESPONSE, GETTER1, GETTER2]
	NetworkExtractor net.NetworkAttrsExtractor[REQUEST, RESPONSE, GETTER2]
	UrlExtractor     net.UrlAttrsExtractor[REQUEST, RESPONSE, GETTER3]
}

func (*HttpServerAttrsExtractor[REQUEST, RESPONSE, GETTER1, GETTER2, GETTER3]) GetSpanKey added in v0.6.0

func (h *HttpServerAttrsExtractor[REQUEST, RESPONSE, GETTER1, GETTER2, GETTER3]) GetSpanKey() attribute.Key

func (*HttpServerAttrsExtractor[REQUEST, RESPONSE, GETTER1, GETTER2, GETTER3]) OnEnd

func (h *HttpServerAttrsExtractor[REQUEST, RESPONSE, GETTER1, GETTER2, GETTER3]) OnEnd(attributes []attribute.KeyValue, context context.Context, request REQUEST, response RESPONSE, err error) ([]attribute.KeyValue, context.Context)

func (*HttpServerAttrsExtractor[REQUEST, RESPONSE, GETTER1, GETTER2, GETTER3]) OnStart

func (h *HttpServerAttrsExtractor[REQUEST, RESPONSE, GETTER1, GETTER2, GETTER3]) OnStart(attributes []attribute.KeyValue, parentContext context.Context, request REQUEST) ([]attribute.KeyValue, context.Context)

type HttpServerAttrsGetter

type HttpServerAttrsGetter[REQUEST any, RESPONSE any] interface {
	HttpCommonAttrsGetter[REQUEST, RESPONSE]
	net.UrlAttrsGetter[REQUEST]
	net.NetworkAttrsGetter[REQUEST, RESPONSE]
	GetUrlScheme(request REQUEST) string
	GetUrlPath(request REQUEST) string
	GetUrlQuery(request REQUEST) string
	GetHttpRoute(request REQUEST) string
}

type HttpServerMetric added in v0.3.0

type HttpServerMetric struct {
	// contains filtered or unexported fields
}

func HttpServerMetrics added in v0.3.0

func HttpServerMetrics() *HttpServerMetric

func (*HttpServerMetric) OnAfterEnd added in v0.3.0

func (h *HttpServerMetric) OnAfterEnd(context context.Context, endAttributes []attribute.KeyValue, endTime time.Time)

func (*HttpServerMetric) OnAfterStart added in v0.3.0

func (h *HttpServerMetric) OnAfterStart(context context.Context, endTime time.Time)

func (*HttpServerMetric) OnBeforeEnd added in v0.3.0

func (h *HttpServerMetric) OnBeforeEnd(ctx context.Context, startAttributes []attribute.KeyValue, startTime time.Time) context.Context

func (*HttpServerMetric) OnBeforeStart added in v0.3.0

func (h *HttpServerMetric) OnBeforeStart(parentContext context.Context, startTime time.Time) context.Context

type HttpServerSpanNameExtractor

type HttpServerSpanNameExtractor[REQUEST any, RESPONSE any] struct {
	Getter HttpServerAttrsGetter[REQUEST, RESPONSE]
}

func (*HttpServerSpanNameExtractor[REQUEST, RESPONSE]) Extract

func (h *HttpServerSpanNameExtractor[REQUEST, RESPONSE]) Extract(request REQUEST) string

type HttpServerSpanStatusExtractor added in v0.0.2

type HttpServerSpanStatusExtractor[REQUEST any, RESPONSE any] struct {
	Getter HttpCommonAttrsGetter[REQUEST, RESPONSE]
}

func (HttpServerSpanStatusExtractor[REQUEST, RESPONSE]) Extract added in v0.0.2

func (h HttpServerSpanStatusExtractor[REQUEST, RESPONSE]) Extract(span trace.Span, request REQUEST, response RESPONSE, err error)

Jump to

Keyboard shortcuts

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