Skip to content

Commit

Permalink
add fields for Help text
Browse files Browse the repository at this point in the history
  • Loading branch information
mkcp committed Oct 12, 2020
1 parent 1c0b6cf commit ff0aeb9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions prometheus/prometheus.go
Expand Up @@ -62,6 +62,7 @@ type PrometheusSink struct {
type PrometheusGauge struct {
Name []string
ConstLabels []metrics.Label
Help string
prometheus.Gauge
updatedAt time.Time
// canDelete is set if the metric is created during runtime so we know it's ephemeral and can delete it on expiry.
Expand All @@ -71,6 +72,7 @@ type PrometheusGauge struct {
type PrometheusSummary struct {
Name []string
ConstLabels []metrics.Label
Help string
prometheus.Summary
updatedAt time.Time
canDelete bool
Expand All @@ -79,6 +81,7 @@ type PrometheusSummary struct {
type PrometheusCounter struct {
Name []string
ConstLabels []metrics.Label
Help string
prometheus.Counter
updatedAt time.Time
canDelete bool
Expand Down Expand Up @@ -174,7 +177,7 @@ func initGauges(m *sync.Map, gauges []PrometheusGauge) {
key, hash := flattenKey(gauge.Name, gauge.ConstLabels)
g := prometheus.NewGauge(prometheus.GaugeOpts{
Name: key,
Help: key,
Help: gauge.Help,
ConstLabels: prometheusLabels(gauge.ConstLabels),
})
g.Set(float64(0)) // Initialize at zero
Expand All @@ -189,7 +192,7 @@ func initSummaries(m *sync.Map, summaries []PrometheusSummary) {
key, hash := flattenKey(summary.Name, summary.ConstLabels)
s := prometheus.NewSummary(prometheus.SummaryOpts{
Name: key,
Help: key,
Help: summary.Help,
ConstLabels: prometheusLabels(summary.ConstLabels),
})
s.Observe(float64(0)) // Initialize at zero
Expand All @@ -204,7 +207,7 @@ func initCounters(m *sync.Map, counters []PrometheusCounter) {
key, hash := flattenKey(counter.Name, counter.ConstLabels)
c := prometheus.NewCounter(prometheus.CounterOpts{
Name: key,
Help: key,
Help: counter.Help,
ConstLabels: prometheusLabels(counter.ConstLabels),
})
c.Add(float64(0)) // Initialize at zero
Expand Down

0 comments on commit ff0aeb9

Please sign in to comment.