metrics

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Now   = time.Now
	Since = time.Since
)

Functions

func StreamInterceptor

func StreamInterceptor(opts ...Option) grpc.StreamServerInterceptor

StreamInterceptor returns a grpc.StreamServerInterceptor that handle request metrics.

func UnaryInterceptor

func UnaryInterceptor(opts ...Option) grpc.UnaryServerInterceptor

UnaryInterceptor returns a grpc.UnaryServerInterceptor that handle request metrics.

Types

type Option

type Option func(mw *metricsWrapper)

Option is metrics option func.

func WithDurationObserver

func WithDurationObserver(m metrics.Observer) Option

WithDurationObserver returns an Option that configures request handling duration observer. We suggest these labels are set before passing the observer to this function:

app_id: domain.biz.module
env: prd/uat/fat/dev
region: regionId. optional
zone: zoneId. optional
cluster: clusterId. optional
host: hostname
addr: ip:port
transport: grpc
actor: server

func WithInflightGauge

func WithInflightGauge(m metrics.Gauge) Option

WithInflightGauge returns an Option that configures inflight request count gauge. We suggest these labels are set before passing the gauge to this function:

app_id: domain.biz.module
env: prd/uat/fat/dev
region: regionId. optional
zone: zoneId. optional
cluster: clusterId. optional
host: hostname
addr: ip:port
transport: grpc
actor: server

func WithRequestCounter

func WithRequestCounter(m metrics.Counter) Option

WithRequestCounter returns an Option that configures request counter. We suggest these labels are set before passing the counter to this function:

app_id: domain.biz.module
env: prd/uat/fat/dev
region: regionId. optional
zone: zoneId. optional
cluster: clusterId. optional
host: hostname
addr: ip:port
transport: grpc
actor: server

Jump to

Keyboard shortcuts

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