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"},
|
|
|
|
)
|
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.",
|
|
|
|
},
|
|
|
|
)
|
|
|
|
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",
|
|
|
|
Help: "The number of errors parsign 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"},
|
|
|
|
)
|
2013-07-08 18:37:12 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
2014-06-26 13:56:21 +00:00
|
|
|
prometheus.MustRegister(eventStats)
|
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)
|
|
|
|
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)
|
2013-07-08 18:37:12 +00:00
|
|
|
}
|