Documentation
¶
Overview ¶
Package rkginmetrics is a middleware for gin framework which record prometheus metrics for RPC
Index ¶
- Constants
- Variables
- func GetServerDurationMetrics(ctx *gin.Context) prometheus.Observer
- func GetServerErrorMetrics(ctx *gin.Context) prometheus.Counter
- func GetServerMetricsSet(ctx *gin.Context) *rkprom.MetricsSet
- func GetServerResCodeMetrics(ctx *gin.Context) prometheus.Counter
- func Interceptor(opts ...Option) gin.HandlerFunc
- func ListServerMetricsSets() []*rkprom.MetricsSet
- type Option
Constants ¶
View Source
const ( // ElapsedNano records RPC duration ElapsedNano = "elapsedNano" // Errors records RPC error Errors = "errors" // ResCode records response code ResCode = "resCode" )
Variables ¶
View Source
var ( // DefaultLabelKeys are default labels for prometheus metrics DefaultLabelKeys = []string{ "entryName", "entryType", "realm", "region", "az", "domain", "instance", "appVersion", "appName", "restMethod", "restPath", "type", "resCode", } )
Functions ¶
func GetServerDurationMetrics ¶
func GetServerDurationMetrics(ctx *gin.Context) prometheus.Observer
GetServerDurationMetrics server request elapsed metrics.
func GetServerErrorMetrics ¶
func GetServerErrorMetrics(ctx *gin.Context) prometheus.Counter
GetServerErrorMetrics server error metrics.
func GetServerMetricsSet ¶
GetServerMetricsSet server metrics set.
func GetServerResCodeMetrics ¶
func GetServerResCodeMetrics(ctx *gin.Context) prometheus.Counter
GetServerResCodeMetrics server response code metrics.
func Interceptor ¶
func Interceptor(opts ...Option) gin.HandlerFunc
Interceptor create a new prometheus metrics interceptor with options.
func ListServerMetricsSets ¶
func ListServerMetricsSets() []*rkprom.MetricsSet
ListServerMetricsSets list all server metrics set associate with GinEntry.
Types ¶
type Option ¶
type Option func(*optionSet)
Option options provided to Interceptor or optionsSet while creating
func WithEntryNameAndType ¶
WithEntryNameAndType provide entry name and entry type.
func WithRegisterer ¶
func WithRegisterer(registerer prometheus.Registerer) Option
WithRegisterer provide prometheus.Registerer.
Click to show internal directories.
Click to hide internal directories.