Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultGRPCServerMetrics create default gRPC server metrics DefaultGRPCServerMetrics = openmetrics.NewServerMetrics(openmetrics.WithServerHandlingTimeHistogram()) // DefaultGRPCClientMetrics create default gRPC client metrics DefaultGRPCClientMetrics = openmetrics.NewClientMetrics(openmetrics.WithClientHandlingTimeHistogram(), openmetrics.WithClientStreamSendHistogram(), openmetrics.WithClientStreamRecvHistogram()) // DefaultHTTPServerMetrics create default HTTP server metrics DefaultHTTPServerMetrics = metricshttp.NewServerMetrics() // PanicsTotal record the number of rpc panics PanicsTotal = prometheus.NewCounterVec(prometheus.CounterOpts{ Name: "grpc_req_panics_recovered_total", Help: "Total number of gRPC requests recovered from internal panic.", }, []string{"grpc_type", "grpc_service", "grpc_method"}) )
this file is used to write metric items in sp service
Functions ¶
This section is empty.
Types ¶
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics is used to monitor sp services
type MetricsConfig ¶
type MetricsConfig struct { Enabled bool `toml:",omitempty"` HTTPAddress string `toml:",omitempty"` }
MetricsConfig contains the configuration for the metric collection.
type MetricsMonitor ¶
MetricsMonitor defines abstract method
func NewMetrics ¶
func NewMetrics(cfg *MetricsConfig) MetricsMonitor
NewMetrics returns a singleton instance of Metrics. Note: enable metrics should call NewMetrics with MetricsConfig and MetricsConfig.Enabled is set true. GetMetrics will return the singleton instance of Metrics to use at anywhere. If NewMetrics is not called, then the metrics is disabled when calls GetMetrics.
Click to show internal directories.
Click to hide internal directories.