mirror of
https://github.com/prometheus/statsd_exporter.git
synced 2024-06-20 22:10:32 +00:00
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
|
@ -102,6 +102,7 @@ func (c *CounterContainer) Get(metricName string, labels prometheus.Labels, help
|
||||||
|
|
||||||
counterVec, ok := c.Elements[mapKey]
|
counterVec, ok := c.Elements[mapKey]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
metricsCount.Inc()
|
||||||
counterVec = prometheus.NewCounterVec(prometheus.CounterOpts{
|
counterVec = prometheus.NewCounterVec(prometheus.CounterOpts{
|
||||||
Name: metricName,
|
Name: metricName,
|
||||||
Help: help,
|
Help: help,
|
||||||
|
@ -138,6 +139,7 @@ func (c *GaugeContainer) Get(metricName string, labels prometheus.Labels, help s
|
||||||
|
|
||||||
gaugeVec, ok := c.Elements[mapKey]
|
gaugeVec, ok := c.Elements[mapKey]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
metricsCount.Inc()
|
||||||
gaugeVec = prometheus.NewGaugeVec(prometheus.GaugeOpts{
|
gaugeVec = prometheus.NewGaugeVec(prometheus.GaugeOpts{
|
||||||
Name: metricName,
|
Name: metricName,
|
||||||
Help: help,
|
Help: help,
|
||||||
|
@ -176,6 +178,7 @@ func (c *SummaryContainer) Get(metricName string, labels prometheus.Labels, help
|
||||||
|
|
||||||
summaryVec, ok := c.Elements[mapKey]
|
summaryVec, ok := c.Elements[mapKey]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
metricsCount.Inc()
|
||||||
quantiles := c.mapper.Defaults.Quantiles
|
quantiles := c.mapper.Defaults.Quantiles
|
||||||
if mapping != nil && mapping.Quantiles != nil && len(mapping.Quantiles) > 0 {
|
if mapping != nil && mapping.Quantiles != nil && len(mapping.Quantiles) > 0 {
|
||||||
quantiles = mapping.Quantiles
|
quantiles = mapping.Quantiles
|
||||||
|
@ -224,6 +227,7 @@ func (c *HistogramContainer) Get(metricName string, labels prometheus.Labels, he
|
||||||
|
|
||||||
histogramVec, ok := c.Elements[mapKey]
|
histogramVec, ok := c.Elements[mapKey]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
metricsCount.Inc()
|
||||||
buckets := c.mapper.Defaults.Buckets
|
buckets := c.mapper.Defaults.Buckets
|
||||||
if mapping != nil && mapping.Buckets != nil && len(mapping.Buckets) > 0 {
|
if mapping != nil && mapping.Buckets != nil && len(mapping.Buckets) > 0 {
|
||||||
buckets = mapping.Buckets
|
buckets = mapping.Buckets
|
||||||
|
|
|
@ -116,6 +116,12 @@ var (
|
||||||
},
|
},
|
||||||
[]string{"action"},
|
[]string{"action"},
|
||||||
)
|
)
|
||||||
|
metricsCount = prometheus.NewCounter(
|
||||||
|
prometheus.CounterOpts{
|
||||||
|
Name: "statsd_exporter_metrics_total",
|
||||||
|
Help: "The total number of metrics.",
|
||||||
|
},
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -135,4 +141,5 @@ func init() {
|
||||||
prometheus.MustRegister(conflictingEventStats)
|
prometheus.MustRegister(conflictingEventStats)
|
||||||
prometheus.MustRegister(errorEventStats)
|
prometheus.MustRegister(errorEventStats)
|
||||||
prometheus.MustRegister(eventsActions)
|
prometheus.MustRegister(eventsActions)
|
||||||
|
prometheus.MustRegister(metricsCount)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue