Documentation ¶
Index ¶
- Variables
- func NewTransport(base http.RoundTripper, options ...Option) *transport
- func SemVersion() string
- func Version() string
- type Option
- func WithAttributes(attributes func(*http.Request) []attribute.KeyValue) Option
- func WithGroupedStatusDisabled() Option
- func WithRecordDurationDisabled() Option
- func WithRecordInFlightDisabled() Option
- func WithRecordSizeDisabled() Option
- func WithRecorder(recorder Recorder) Option
- func WithShouldRecordFunc(shouldRecord func(*http.Request) bool) Option
- type Recorder
Constants ¶
This section is empty.
Variables ¶
var DefaultAttributes = func(request *http.Request) []attribute.KeyValue { attrs := []attribute.KeyValue{ semconv.HTTPMethodKey.String(request.Method), } origin := request.Host target := request.URL.Path if origin != "" { attrs = append(attrs, semconv.HTTPHostKey.String(origin)) } if target != "" { attrs = append(attrs, semconv.HTTPTargetKey.String(target)) } return attrs }
Functions ¶
func NewTransport ¶
func NewTransport(base http.RoundTripper, options ...Option) *transport
func SemVersion ¶
func SemVersion() string
SemVersion is the semantic version to be supplied to tracer/meter creation.
Types ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option applies a configuration to the given config
func WithAttributes ¶
WithAttributes sets a func using which what attributes to be recorded can be specified. By default the DefaultAttributes is used
func WithGroupedStatusDisabled ¶
func WithGroupedStatusDisabled() Option
WithGroupedStatus determines whether to group the response status codes or not. If true 2xx, 3xx will be stored By default the groupedStatus is true
func WithRecordDurationDisabled ¶
func WithRecordDurationDisabled() Option
WithRecordDuration determines whether to record Duration of Requests or not By default the recordDuration is true
func WithRecordInFlightDisabled ¶
func WithRecordInFlightDisabled() Option
WithRecordInFlight determines whether to record In Flight Requests or not By default the recordInFlight is true
func WithRecordSizeDisabled ¶
func WithRecordSizeDisabled() Option
WithRecordSize determines whether to record Size of Requests and Responses or not By default the recordSize is true
func WithRecorder ¶
WithRecorder sets a recorder for recording requests By default the open telemetry recorder is used
type Recorder ¶
type Recorder interface { // AddRequests increments the number of requests being processed. AddRequests(ctx context.Context, quantity int64, attributes []attribute.KeyValue) // ObserveHTTPRequestDuration measures the duration of an HTTP request. ObserveHTTPRequestDuration(ctx context.Context, duration time.Duration, attributes []attribute.KeyValue) // ObserveHTTPRequestSize measures the size of an HTTP request in bytes. ObserveHTTPRequestSize(ctx context.Context, sizeBytes int64, attributes []attribute.KeyValue) // ObserveHTTPResponseSize measures the size of an HTTP response in bytes. ObserveHTTPResponseSize(ctx context.Context, sizeBytes int64, attributes []attribute.KeyValue) // AddInflightRequests increments and decrements the number of inflight request being processed. AddInflightRequests(ctx context.Context, quantity int64, attributes []attribute.KeyValue) }