otelginmetrics

package module
v0.0.0-...-f20771f Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2022 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware(service string, options ...Option) gin.HandlerFunc

Middleware returns middleware that will trace incoming requests. The service parameter should describe the name of the (virtual) server handling the request.

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 gin instrumentation.

Types

type Option

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

Option applies a configuration to the given config

func WithAdditionalAttributes

func WithAdditionalAttributes(attributes map[string]string) Option

WithAdditionalAttributes sets a list of attribute.KeyValue labels for all metrics associated with this round tripper

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(recordDuration bool) Option

WithRecordDuration determines whether to record Duration of Requests or not By default the recordDuration is true

func WithRecordInFlightDisabled

func WithRecordInFlightDisabled(recordInFlight bool) Option

WithRecordInFlight determines whether to record In Flight Requests or not By default the recordInFlight is true

func WithRecordSizeDisabled

func WithRecordSizeDisabled(recordSize bool) Option

WithRecordSize determines whether to record Size of Requests and Responses or not By default the recordSize is true

func WithRecorder

func WithRecorder(recorder Recorder) Option

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)
}

func GetRecorder

func GetRecorder(metricsPrefix string) Recorder

type RequestURLLabelMappingFn

type RequestURLLabelMappingFn func(c *gin.Context) string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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