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 records 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"}) // BlockHeightLagGauge records the current block height of block syncer service BlockHeightLagGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{ Name: "block_syncer_height", Help: "Current block number of block syncer progress.", }, []string{serviceLabelName}) // SealObjectTimeHistogram records sealing object time of task node service SealObjectTimeHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{ Name: "task_node_seal_object_time", Help: "Track task node service the time of sealing object on chain.", Buckets: prometheus.DefBuckets, }, []string{serviceLabelName}) // SealObjectTotalCounter records total seal object number SealObjectTotalCounter = prometheus.NewCounterVec(prometheus.CounterOpts{ Name: "task_node_seal_object_total", Help: "Track task node service handles total seal object number", }, []string{"success_or_failure"}) // ReplicateObjectTaskGauge records total replicate object number ReplicateObjectTaskGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{ Name: "task_node_replicate_object_task_number", Help: "Track task node service replicate object task", }, []string{serviceLabelName}) // PieceStoreTimeHistogram records piece store request time PieceStoreTimeHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{ Name: "piece_store_handling_seconds", Help: "Track the latency for piece store requests", Buckets: prometheus.DefBuckets, }, []string{"method_name"}) // PieceStoreRequestTotal records piece store total request PieceStoreRequestTotal = prometheus.NewCounterVec(prometheus.CounterOpts{ Name: "piece_store_total_requests", Help: "Track piece store handles total request", }, []string{"method_name"}) SPDBTimeHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{ Name: "sp_db_handling_seconds", Help: "Track the latency for spdb requests", Buckets: prometheus.DefBuckets, }, []string{"method_name"}) )
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.