forked from mirrors/statsd_exporter
Add metric to track unique metric names the exporter is tracking
Signed-off-by: Brian Akins <brian@akins.org>
This commit is contained in:
parent
468c70df7d
commit
92957ce080
2 changed files with 11 additions and 0 deletions
|
@ -102,6 +102,7 @@ func (c *CounterContainer) Get(metricName string, labels prometheus.Labels, help
|
|||
|
||||
counterVec, ok := c.Elements[mapKey]
|
||||
if !ok {
|
||||
metricsCount.Inc()
|
||||
counterVec = prometheus.NewCounterVec(prometheus.CounterOpts{
|
||||
Name: metricName,
|
||||
Help: help,
|
||||
|
@ -138,6 +139,7 @@ func (c *GaugeContainer) Get(metricName string, labels prometheus.Labels, help s
|
|||
|
||||
gaugeVec, ok := c.Elements[mapKey]
|
||||
if !ok {
|
||||
metricsCount.Inc()
|
||||
gaugeVec = prometheus.NewGaugeVec(prometheus.GaugeOpts{
|
||||
Name: metricName,
|
||||
Help: help,
|
||||
|
@ -176,6 +178,7 @@ func (c *SummaryContainer) Get(metricName string, labels prometheus.Labels, help
|
|||
|
||||
summaryVec, ok := c.Elements[mapKey]
|
||||
if !ok {
|
||||
metricsCount.Inc()
|
||||
quantiles := c.mapper.Defaults.Quantiles
|
||||
if mapping != nil && mapping.Quantiles != nil && len(mapping.Quantiles) > 0 {
|
||||
quantiles = mapping.Quantiles
|
||||
|
@ -224,6 +227,7 @@ func (c *HistogramContainer) Get(metricName string, labels prometheus.Labels, he
|
|||
|
||||
histogramVec, ok := c.Elements[mapKey]
|
||||
if !ok {
|
||||
metricsCount.Inc()
|
||||
buckets := c.mapper.Defaults.Buckets
|
||||
if mapping != nil && mapping.Buckets != nil && len(mapping.Buckets) > 0 {
|
||||
buckets = mapping.Buckets
|
||||
|
|
|
@ -116,6 +116,12 @@ var (
|
|||
},
|
||||
[]string{"action"},
|
||||
)
|
||||
metricsCount = prometheus.NewCounter(
|
||||
prometheus.CounterOpts{
|
||||
Name: "statsd_exporter_metrics_total",
|
||||
Help: "The total number of metrics.",
|
||||
},
|
||||
)
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -135,4 +141,5 @@ func init() {
|
|||
prometheus.MustRegister(conflictingEventStats)
|
||||
prometheus.MustRegister(errorEventStats)
|
||||
prometheus.MustRegister(eventsActions)
|
||||
prometheus.MustRegister(metricsCount)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue