mirror of
https://github.com/minio/minio.git
synced 2025-01-25 21:53:16 -05:00
parent
48f2c98052
commit
be72609d1f
@ -34,11 +34,25 @@ var (
|
|||||||
},
|
},
|
||||||
[]string{"request_type"},
|
[]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() {
|
func init() {
|
||||||
prometheus.MustRegister(httpRequestsDuration)
|
prometheus.MustRegister(httpRequestsDuration)
|
||||||
prometheus.MustRegister(newMinioCollector())
|
prometheus.MustRegister(newMinioCollector())
|
||||||
|
prometheus.MustRegister(minioVersionInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
// newMinioCollector describes the collector
|
// 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.
|
// Collect is called by the Prometheus registry when collecting metrics.
|
||||||
func (c *minioCollector) Collect(ch chan<- prometheus.Metric) {
|
func (c *minioCollector) Collect(ch chan<- prometheus.Metric) {
|
||||||
|
|
||||||
|
// Expose MinIO's version information
|
||||||
|
minioVersionInfo.WithLabelValues(Version, CommitID).Add(1)
|
||||||
|
|
||||||
// Always expose network stats
|
// Always expose network stats
|
||||||
|
|
||||||
// Network Sent/Received Bytes
|
// Network Sent/Received Bytes
|
||||||
@ -184,7 +201,10 @@ func (c *minioCollector) Collect(ch chan<- prometheus.Metric) {
|
|||||||
func metricsHandler() http.Handler {
|
func metricsHandler() http.Handler {
|
||||||
registry := prometheus.NewRegistry()
|
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)
|
logger.LogIf(context.Background(), err)
|
||||||
|
|
||||||
err = registry.Register(newMinioCollector())
|
err = registry.Register(newMinioCollector())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user