mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
parent
48f2c98052
commit
be72609d1f
@ -34,11 +34,25 @@ var (
|
||||
},
|
||||
[]string{"request_type"},
|
||||
)
|
||||
minioVersionInfo = prometheus.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Namespace: "minio",
|
||||
Name: "version_info",
|
||||
Help: "Version of current MinIO server instance",
|
||||
},
|
||||
[]string{
|
||||
// current version
|
||||
"version",
|
||||
// commit-id of the current version
|
||||
"commit",
|
||||
},
|
||||
)
|
||||
)
|
||||
|
||||
func init() {
|
||||
prometheus.MustRegister(httpRequestsDuration)
|
||||
prometheus.MustRegister(newMinioCollector())
|
||||
prometheus.MustRegister(minioVersionInfo)
|
||||
}
|
||||
|
||||
// newMinioCollector describes the collector
|
||||
@ -64,6 +78,9 @@ func (c *minioCollector) Describe(ch chan<- *prometheus.Desc) {
|
||||
// Collect is called by the Prometheus registry when collecting metrics.
|
||||
func (c *minioCollector) Collect(ch chan<- prometheus.Metric) {
|
||||
|
||||
// Expose MinIO's version information
|
||||
minioVersionInfo.WithLabelValues(Version, CommitID).Add(1)
|
||||
|
||||
// Always expose network stats
|
||||
|
||||
// Network Sent/Received Bytes
|
||||
@ -184,7 +201,10 @@ func (c *minioCollector) Collect(ch chan<- prometheus.Metric) {
|
||||
func metricsHandler() http.Handler {
|
||||
registry := prometheus.NewRegistry()
|
||||
|
||||
err := registry.Register(httpRequestsDuration)
|
||||
err := registry.Register(minioVersionInfo)
|
||||
logger.LogIf(context.Background(), err)
|
||||
|
||||
err = registry.Register(httpRequestsDuration)
|
||||
logger.LogIf(context.Background(), err)
|
||||
|
||||
err = registry.Register(newMinioCollector())
|
||||
|
Loading…
Reference in New Issue
Block a user