Documentation ΒΆ
Index ΒΆ
- Variables
- func Middleware(options ...Option) gin.HandlerFunc
- type Option
- func WithAttributes(attributes func(route string, request *http.Request) []attribute.KeyValue) Option
- func WithGlobalAttributes(attributes []attribute.KeyValue) Option
- func WithGroupedStatusDisabled() Option
- func WithMetricPrefix(prefix string) Option
- func WithPrometheusPort(port int) Option
- func WithRecordDurationDisabled() Option
- func WithRecordInFlightDisabled() Option
- func WithRecordSizeDisabled() Option
- func WithRecorder(recorder Recorder) Option
- func WithService(serviceName string, version string) Option
- func WithShouldRecordFunc(shouldRecord func(route string, request *http.Request) bool) Option
- func WithSystemMetricDisabled() Option
- type Recorder
Constants ΒΆ
This section is empty.
Variables ΒΆ
View Source
var DefaultAttributes = func(route string, request *http.Request) []attribute.KeyValue { attrs := []attribute.KeyValue{ semconv.HTTPMethodKey.String(request.Method), } if route != "" { attrs = append(attrs, semconv.HTTPRouteKey.String(route)) } return attrs }
Functions ΒΆ
Types ΒΆ
type Option ΒΆ
type Option interface {
// contains filtered or unexported methods
}
Option applies a configuration to the given config
func WithAttributes ΒΆ
func WithGlobalAttributes ΒΆ
func WithGroupedStatusDisabled ΒΆ
func WithGroupedStatusDisabled() Option
func WithMetricPrefix ΒΆ
func WithPrometheusPort ΒΆ
func WithRecordDurationDisabled ΒΆ
func WithRecordDurationDisabled() Option
func WithRecordInFlightDisabled ΒΆ
func WithRecordInFlightDisabled() Option
func WithRecordSizeDisabled ΒΆ
func WithRecordSizeDisabled() Option
func WithRecorder ΒΆ
func WithService ΒΆ
func WithShouldRecordFunc ΒΆ
func WithSystemMetricDisabled ΒΆ
func WithSystemMetricDisabled() 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) // ObserveSystemMetric measures the cpu and memory usage ObserveSystemMetric(ctx context.Context, attributes []attribute.KeyValue) }
func NewHttpMetricsRecorder ΒΆ
Source Files ΒΆ
Click to show internal directories.
Click to hide internal directories.