2015-02-18 21:40:55 +00:00
|
|
|
// Copyright 2013 The Prometheus Authors
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
2013-07-08 18:37:12 +00:00
|
|
|
//
|
2015-02-18 21:40:55 +00:00
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
2013-07-08 18:37:12 +00:00
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2014-06-26 13:56:21 +00:00
|
|
|
eventStats = prometheus.NewCounterVec(
|
|
|
|
prometheus.CounterOpts{
|
2015-10-10 00:34:28 +00:00
|
|
|
Name: "statsd_exporter_events_total",
|
2014-06-26 13:56:21 +00:00
|
|
|
Help: "The total number of StatsD events seen.",
|
|
|
|
},
|
|
|
|
[]string{"type"},
|
|
|
|
)
|
2019-05-26 13:08:54 +00:00
|
|
|
eventsFlushed = prometheus.NewCounter(
|
|
|
|
prometheus.CounterOpts{
|
2019-06-07 13:00:14 +00:00
|
|
|
Name: "statsd_exporter_event_queue_flushed_total",
|
2019-05-26 13:08:54 +00:00
|
|
|
Help: "Number of times events were flushed to exporter",
|
|
|
|
},
|
|
|
|
)
|
2016-05-02 19:19:46 +00:00
|
|
|
eventsUnmapped = prometheus.NewCounter(prometheus.CounterOpts{
|
|
|
|
Name: "statsd_exporter_events_unmapped_total",
|
|
|
|
Help: "The total number of StatsD events no mapping was found for.",
|
|
|
|
})
|
2017-11-10 19:23:54 +00:00
|
|
|
udpPackets = prometheus.NewCounter(
|
2014-06-26 13:56:21 +00:00
|
|
|
prometheus.CounterOpts{
|
2017-11-10 19:23:54 +00:00
|
|
|
Name: "statsd_exporter_udp_packets_total",
|
|
|
|
Help: "The total number of StatsD packets received over UDP.",
|
|
|
|
},
|
|
|
|
)
|
|
|
|
tcpConnections = prometheus.NewCounter(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Name: "statsd_exporter_tcp_connections_total",
|
|
|
|
Help: "The total number of TCP connections handled.",
|
|
|
|
},
|
|
|
|
)
|
|
|
|
tcpErrors = prometheus.NewCounter(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Name: "statsd_exporter_tcp_connection_errors_total",
|
|
|
|
Help: "The number of errors encountered reading from TCP.",
|
|
|
|
},
|
|
|
|
)
|
|
|
|
tcpLineTooLong = prometheus.NewCounter(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Name: "statsd_exporter_tcp_too_long_lines_total",
|
|
|
|
Help: "The number of lines discarded due to being too long.",
|
|
|
|
},
|
|
|
|
)
|
2019-04-05 23:37:23 +00:00
|
|
|
unixgramPackets = prometheus.NewCounter(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Name: "statsd_exporter_unixgram_packets_total",
|
|
|
|
Help: "The total number of StatsD packets received over Unixgram.",
|
|
|
|
},
|
|
|
|
)
|
2017-11-10 19:23:54 +00:00
|
|
|
linesReceived = prometheus.NewCounter(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Name: "statsd_exporter_lines_total",
|
|
|
|
Help: "The total number of StatsD lines received.",
|
|
|
|
},
|
|
|
|
)
|
|
|
|
samplesReceived = prometheus.NewCounter(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Name: "statsd_exporter_samples_total",
|
|
|
|
Help: "The total number of StatsD samples received.",
|
|
|
|
},
|
|
|
|
)
|
|
|
|
sampleErrors = prometheus.NewCounterVec(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Name: "statsd_exporter_sample_errors_total",
|
|
|
|
Help: "The total number of errors parsing StatsD samples.",
|
|
|
|
},
|
|
|
|
[]string{"reason"},
|
|
|
|
)
|
|
|
|
tagsReceived = prometheus.NewCounter(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Name: "statsd_exporter_tags_total",
|
|
|
|
Help: "The total number of DogStatsD tags processed.",
|
|
|
|
},
|
|
|
|
)
|
|
|
|
tagErrors = prometheus.NewCounter(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Name: "statsd_exporter_tag_errors_total",
|
2019-05-26 13:08:54 +00:00
|
|
|
Help: "The number of errors parsing DogStatsD tags.",
|
2014-06-26 13:56:21 +00:00
|
|
|
},
|
|
|
|
)
|
|
|
|
configLoads = prometheus.NewCounterVec(
|
|
|
|
prometheus.CounterOpts{
|
2015-10-10 00:34:28 +00:00
|
|
|
Name: "statsd_exporter_config_reloads_total",
|
2014-06-26 13:56:21 +00:00
|
|
|
Help: "The number of configuration reloads.",
|
|
|
|
},
|
|
|
|
[]string{"outcome"},
|
|
|
|
)
|
|
|
|
mappingsCount = prometheus.NewGauge(prometheus.GaugeOpts{
|
2016-05-03 16:48:49 +00:00
|
|
|
Name: "statsd_exporter_loaded_mappings",
|
2016-05-02 19:19:46 +00:00
|
|
|
Help: "The current number of configured metric mappings.",
|
2014-06-26 13:56:21 +00:00
|
|
|
})
|
2017-07-18 15:56:27 +00:00
|
|
|
conflictingEventStats = prometheus.NewCounterVec(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Name: "statsd_exporter_events_conflict_total",
|
|
|
|
Help: "The total number of StatsD events with conflicting names.",
|
|
|
|
},
|
|
|
|
[]string{"type"},
|
|
|
|
)
|
2019-03-25 23:44:17 +00:00
|
|
|
errorEventStats = prometheus.NewCounterVec(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Name: "statsd_exporter_events_error_total",
|
|
|
|
Help: "The total number of StatsD events discarded due to errors.",
|
|
|
|
},
|
|
|
|
[]string{"reason"},
|
|
|
|
)
|
2019-03-25 22:16:38 +00:00
|
|
|
eventsActions = prometheus.NewCounterVec(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Name: "statsd_exporter_events_actions_total",
|
|
|
|
Help: "The total number of StatsD events by action.",
|
|
|
|
},
|
|
|
|
[]string{"action"},
|
|
|
|
)
|
2019-04-12 17:29:25 +00:00
|
|
|
metricsCount = prometheus.NewGaugeVec(
|
|
|
|
prometheus.GaugeOpts{
|
2019-04-10 16:23:07 +00:00
|
|
|
Name: "statsd_exporter_metrics_total",
|
|
|
|
Help: "The total number of metrics.",
|
|
|
|
},
|
2019-04-12 17:29:25 +00:00
|
|
|
[]string{"type"},
|
2019-04-10 16:23:07 +00:00
|
|
|
)
|
2013-07-08 18:37:12 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
2014-06-26 13:56:21 +00:00
|
|
|
prometheus.MustRegister(eventStats)
|
2019-05-26 13:08:54 +00:00
|
|
|
prometheus.MustRegister(eventsFlushed)
|
2018-11-02 15:46:53 +00:00
|
|
|
prometheus.MustRegister(eventsUnmapped)
|
2017-11-10 19:23:54 +00:00
|
|
|
prometheus.MustRegister(udpPackets)
|
|
|
|
prometheus.MustRegister(tcpConnections)
|
|
|
|
prometheus.MustRegister(tcpErrors)
|
|
|
|
prometheus.MustRegister(tcpLineTooLong)
|
2019-04-05 23:37:23 +00:00
|
|
|
prometheus.MustRegister(unixgramPackets)
|
2017-11-10 19:23:54 +00:00
|
|
|
prometheus.MustRegister(linesReceived)
|
|
|
|
prometheus.MustRegister(samplesReceived)
|
|
|
|
prometheus.MustRegister(sampleErrors)
|
|
|
|
prometheus.MustRegister(tagsReceived)
|
|
|
|
prometheus.MustRegister(tagErrors)
|
2014-06-26 13:56:21 +00:00
|
|
|
prometheus.MustRegister(configLoads)
|
|
|
|
prometheus.MustRegister(mappingsCount)
|
2017-07-18 15:56:27 +00:00
|
|
|
prometheus.MustRegister(conflictingEventStats)
|
2019-03-25 23:44:17 +00:00
|
|
|
prometheus.MustRegister(errorEventStats)
|
2019-03-25 22:16:38 +00:00
|
|
|
prometheus.MustRegister(eventsActions)
|
2019-04-10 16:23:07 +00:00
|
|
|
prometheus.MustRegister(metricsCount)
|
2013-07-08 18:37:12 +00:00
|
|
|
}
|