mirror of
https://github.com/prymitive/karma
synced 2026-05-21 04:33:07 +00:00
committed by
Łukasz Mierzwa
parent
7f14a39b34
commit
466428d8dd
@@ -5,6 +5,7 @@
|
||||
### Added
|
||||
|
||||
- Added ability to delete multiple silences from the silence browser modal - #4618.
|
||||
- Added `build_info` metric - #4764.
|
||||
|
||||
### Fixed
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
)
|
||||
|
||||
type karmaCollector struct {
|
||||
buildInfo *prometheus.Desc
|
||||
collectedAlerts *prometheus.Desc
|
||||
collectedGroups *prometheus.Desc
|
||||
cyclesTotal *prometheus.Desc
|
||||
@@ -19,6 +20,12 @@ type karmaCollector struct {
|
||||
|
||||
func newKarmaCollector() *karmaCollector {
|
||||
return &karmaCollector{
|
||||
buildInfo: prometheus.NewDesc(
|
||||
"build_info",
|
||||
"Runtime version information",
|
||||
[]string{"version"},
|
||||
prometheus.Labels{},
|
||||
),
|
||||
collectedAlerts: prometheus.NewDesc(
|
||||
"karma_collected_alerts_count",
|
||||
"Total number of alerts collected from Alertmanager API",
|
||||
@@ -59,6 +66,7 @@ func newKarmaCollector() *karmaCollector {
|
||||
}
|
||||
|
||||
func (c *karmaCollector) Describe(ch chan<- *prometheus.Desc) {
|
||||
ch <- c.buildInfo
|
||||
ch <- c.collectedAlerts
|
||||
ch <- c.collectedGroups
|
||||
ch <- c.cyclesTotal
|
||||
@@ -68,6 +76,8 @@ func (c *karmaCollector) Describe(ch chan<- *prometheus.Desc) {
|
||||
}
|
||||
|
||||
func (c *karmaCollector) Collect(ch chan<- prometheus.Metric) {
|
||||
ch <- prometheus.MustNewConstMetric(c.buildInfo, prometheus.GaugeValue, 1, version)
|
||||
|
||||
upstreams := alertmanager.GetAlertmanagers()
|
||||
|
||||
for _, am := range upstreams {
|
||||
|
||||
@@ -7,6 +7,9 @@ cmp stderr stderr.txt
|
||||
cmp curl.txt metrics.txt
|
||||
|
||||
-- metrics.txt --
|
||||
# HELP build_info Runtime version information
|
||||
# TYPE build_info gauge
|
||||
build_info{version="dev"}
|
||||
# HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles.
|
||||
# TYPE go_gc_duration_seconds summary
|
||||
go_gc_duration_seconds{quantile="0"}
|
||||
|
||||
Reference in New Issue
Block a user