mirror of
https://github.com/prometheus/statsd_exporter.git
synced 2024-11-14 11:21:17 +00:00
cdf79ba2f9
The "packets" metric had heavily overloaded meaning for different "outcomes", and would often be incremented multiple times, sometimes even with a single (per-line) increment in one outcome corresponding to multiple increments in another. This removes the broken metric, and replaces it with separate total and error counters for each level of processing. This allows monitoring the network traffic handled separately from the samples incurred by it.
121 lines
3.7 KiB
Go
121 lines
3.7 KiB
Go
// 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
|
|
//
|
|
// 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.
|
|
|
|
package main
|
|
|
|
import (
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
)
|
|
|
|
var (
|
|
eventStats = prometheus.NewCounterVec(
|
|
prometheus.CounterOpts{
|
|
Name: "statsd_exporter_events_total",
|
|
Help: "The total number of StatsD events seen.",
|
|
},
|
|
[]string{"type"},
|
|
)
|
|
eventsUnmapped = prometheus.NewCounter(prometheus.CounterOpts{
|
|
Name: "statsd_exporter_events_unmapped_total",
|
|
Help: "The total number of StatsD events no mapping was found for.",
|
|
})
|
|
udpPackets = prometheus.NewCounter(
|
|
prometheus.CounterOpts{
|
|
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.",
|
|
},
|
|
)
|
|
configLoads = prometheus.NewCounterVec(
|
|
prometheus.CounterOpts{
|
|
Name: "statsd_exporter_config_reloads_total",
|
|
Help: "The number of configuration reloads.",
|
|
},
|
|
[]string{"outcome"},
|
|
)
|
|
mappingsCount = prometheus.NewGauge(prometheus.GaugeOpts{
|
|
Name: "statsd_exporter_loaded_mappings",
|
|
Help: "The current number of configured metric mappings.",
|
|
})
|
|
conflictingEventStats = prometheus.NewCounterVec(
|
|
prometheus.CounterOpts{
|
|
Name: "statsd_exporter_events_conflict_total",
|
|
Help: "The total number of StatsD events with conflicting names.",
|
|
},
|
|
[]string{"type"},
|
|
)
|
|
)
|
|
|
|
func init() {
|
|
prometheus.MustRegister(eventStats)
|
|
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)
|
|
prometheus.MustRegister(configLoads)
|
|
prometheus.MustRegister(mappingsCount)
|
|
prometheus.MustRegister(conflictingEventStats)
|
|
}
|