metrics

package
v2.8.3 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 11 Imported by: 33

Documentation

Index

Constants

View Source
const (
	DefaultServerSecondsHistogramName = "server_requests_seconds_bucket"
	DefaultServerRequestsCounterName  = "server_requests_code_total"
	DefaultClientSecondsHistogramName = "client_requests_seconds_bucket"
	DefaultClientRequestsCounterName  = "client_requests_code_total"
)

Variables

This section is empty.

Functions

func Client

func Client(opts ...Option) middleware.Middleware

Client is middleware client-side metrics.

func DefaultRequestsCounter added in v2.8.0

func DefaultRequestsCounter(meter metric.Meter, histogramName string) (metric.Int64Counter, error)

DefaultRequestsCounter return metric.Int64Counter for WithRequests suggest histogramName = <client/server>_requests_code_total

func DefaultSecondsHistogram added in v2.8.0

func DefaultSecondsHistogram(meter metric.Meter, histogramName string) (metric.Float64Histogram, error)

DefaultSecondsHistogram return metric.Float64Histogram for WithSeconds suggest histogramName = <client/server>_requests_seconds_bucket

func DefaultSecondsHistogramView added in v2.8.0

func DefaultSecondsHistogramView(histogramName string) metricsdk.View

DefaultSecondsHistogramView need register in sdkmetric.MeterProvider eg: view := SecondsHistogramView() mp := sdkmetric.NewMeterProvider(sdkmetric.WithView(view)) otel.SetMeterProvider(mp)

func EnableOTELExemplar added in v2.8.0

func EnableOTELExemplar() error

func Server

func Server(opts ...Option) middleware.Middleware

Server is middleware server-side metrics.

Types

type Option

type Option func(*options)

Option is metrics option.

func WithRequests

func WithRequests(c metric.Int64Counter) Option

WithRequests with requests counter.

func WithSeconds

func WithSeconds(histogram metric.Float64Histogram) Option

WithSeconds with seconds histogram. notice: the record unit in current middleware is s(Seconds)

Jump to

Keyboard shortcuts

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