rkgrpcmetrics

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package rkgrpcmetrics is a middleware for grpc framework which record prometheus metrics for RPC

Index

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

func GetMetricsSet(ctx context.Context) *rkprom.MetricsSet

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

func WithEntryNameAndType(entryName, entryType string) Option

WithEntryNameAndType Provide entry name and type.

func WithRegisterer

func WithRegisterer(registerer prometheus.Registerer) Option

WithRegisterer Provide prometheus registerer.

Jump to

Keyboard shortcuts

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