Documentation ¶
Index ¶
- Constants
- func Client(opts ...Option) middleware.Middleware
- func DefaultRequestsCounter(meter metric.Meter, histogramName string) (metric.Int64Counter, error)
- func DefaultSecondsHistogram(meter metric.Meter, histogramName string) (metric.Float64Histogram, error)
- func DefaultSecondsHistogramView(histogramName string) metricsdk.View
- func EnableOTELExemplar() error
- func Server(opts ...Option) middleware.Middleware
- type Option
Constants ¶
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
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
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)