mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-12-05 21:27:47 +08:00
128 lines
4.0 KiB
Go
128 lines
4.0 KiB
Go
// Copyright (C) 2014-2018 Goodrain Co., Ltd.
|
|
// RAINBOND, Application Management Platform
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version. For any non-GPL usage of Rainbond,
|
|
// one or multiple Commercial Licenses authorized by Goodrain Co., Ltd.
|
|
// must be obtained first.
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
package exporter
|
|
|
|
import (
|
|
"github.com/goodrain/rainbond/node/statsd/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"},
|
|
)
|
|
)
|
|
|
|
//MetryInit init
|
|
func MetryInit(registry *prometheus.Registry) {
|
|
registry.MustRegister(eventStats)
|
|
registry.MustRegister(udpPackets)
|
|
registry.MustRegister(tcpConnections)
|
|
registry.MustRegister(tcpErrors)
|
|
registry.MustRegister(tcpLineTooLong)
|
|
registry.MustRegister(linesReceived)
|
|
registry.MustRegister(samplesReceived)
|
|
registry.MustRegister(sampleErrors)
|
|
registry.MustRegister(tagsReceived)
|
|
registry.MustRegister(tagErrors)
|
|
registry.MustRegister(ConfigLoads)
|
|
registry.MustRegister(mappingsCount)
|
|
registry.MustRegister(conflictingEventStats)
|
|
}
|