Documentation
¶
Overview ¶
Package rkgrpcmetrics is a middleware for grpc framework which record prometheus metrics for RPC
Index ¶
- Constants
- Variables
- func GetDurationMetrics(ctx context.Context) prometheus.Observer
- func GetErrorMetrics(ctx context.Context) prometheus.Counter
- func GetMetricsSet(ctx context.Context) *rkprom.MetricsSet
- func GetResCodeMetrics(ctx context.Context) prometheus.Counter
- func StreamClientInterceptor(opts ...Option) grpc.StreamClientInterceptor
- func StreamServerInterceptor(opts ...Option) grpc.StreamServerInterceptor
- func UnaryClientInterceptor(opts ...Option) grpc.UnaryClientInterceptor
- func UnaryServerInterceptor(opts ...Option) grpc.UnaryServerInterceptor
- type Option
Constants ¶
View Source
const ( // ElapsedNano records RPC duration in nano ElapsedNano = "elapsedNano" // Errors records RPC error count Errors = "errors" // ResCode record RPC resCode ResCode = "resCode" )
Variables ¶
View Source
var ( // DefaultLabelKeys are default labels for prometheus metrics DefaultLabelKeys = []string{ "entryName", "entryType", "realm", "region", "az", "domain", "instance", "appVersion", "appName", "grpcService", "grpcMethod", "restMethod", "restPath", "grpcType", "resCode", } )
Functions ¶
func GetDurationMetrics ¶
func GetDurationMetrics(ctx context.Context) prometheus.Observer
GetDurationMetrics Get duration metrics.
func GetErrorMetrics ¶
func GetErrorMetrics(ctx context.Context) prometheus.Counter
GetErrorMetrics Get error metrics.
func GetMetricsSet ¶
GetMetricsSet Get metrics set.
func GetResCodeMetrics ¶
func GetResCodeMetrics(ctx context.Context) prometheus.Counter
GetResCodeMetrics Get res code metrics.
func StreamClientInterceptor ¶
func StreamClientInterceptor(opts ...Option) grpc.StreamClientInterceptor
StreamClientInterceptor Create new stream client interceptor.
func StreamServerInterceptor ¶
func StreamServerInterceptor(opts ...Option) grpc.StreamServerInterceptor
StreamServerInterceptor Create new stream server interceptor.
func UnaryClientInterceptor ¶
func UnaryClientInterceptor(opts ...Option) grpc.UnaryClientInterceptor
UnaryClientInterceptor Create new unary client interceptor.
func UnaryServerInterceptor ¶
func UnaryServerInterceptor(opts ...Option) grpc.UnaryServerInterceptor
UnaryServerInterceptor Create new unary server interceptor.
Types ¶
type Option ¶
type Option func(*optionSet)
Option options while creating optionSet
func WithEntryNameAndType ¶
WithEntryNameAndType Provide entry name and type.
func WithRegisterer ¶
func WithRegisterer(registerer prometheus.Registerer) Option
WithRegisterer Provide prometheus registerer.
Click to show internal directories.
Click to hide internal directories.