mirror of
https://github.com/prometheus/statsd_exporter.git
synced 2024-11-22 15:30:59 +00:00
Adding new metric to relay
Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
This commit is contained in:
parent
60742e1bd6
commit
2d339b0853
1 changed files with 14 additions and 4 deletions
|
@ -35,8 +35,9 @@ type Relay struct {
|
|||
logger log.Logger
|
||||
packetLength uint
|
||||
|
||||
packetsTotal prometheus.Counter
|
||||
longLinesTotal prometheus.Counter
|
||||
packetsTotal prometheus.Counter
|
||||
longLinesTotal prometheus.Counter
|
||||
relayedLinesTotal prometheus.Counter
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -54,6 +55,13 @@ var (
|
|||
},
|
||||
[]string{"target"},
|
||||
)
|
||||
relayLinesRelayedTotal = promauto.NewCounterVec(
|
||||
prometheus.CounterOpts{
|
||||
Name: "statsd_exporter_relay_lines_relayed_total",
|
||||
Help: "The number of lines that were buffered to be relayed.",
|
||||
},
|
||||
[]string{"target"},
|
||||
)
|
||||
)
|
||||
|
||||
// NewRelay creates a statsd UDP relay. It can be used to send copies of statsd raw
|
||||
|
@ -77,8 +85,9 @@ func NewRelay(l log.Logger, target string, packetLength uint) (*Relay, error) {
|
|||
logger: l,
|
||||
packetLength: packetLength,
|
||||
|
||||
packetsTotal: relayPacketsTotal.WithLabelValues(target),
|
||||
longLinesTotal: relayLongLinesTotal.WithLabelValues(target),
|
||||
packetsTotal: relayPacketsTotal.WithLabelValues(target),
|
||||
longLinesTotal: relayLongLinesTotal.WithLabelValues(target),
|
||||
relayedLinesTotal: relayLinesRelayedTotal.WithLabelValues(target),
|
||||
}
|
||||
|
||||
// Startup the UDP sender.
|
||||
|
@ -152,5 +161,6 @@ func (r *Relay) RelayLine(l string) {
|
|||
if !strings.HasSuffix(l, "\n") {
|
||||
l = l + "\n"
|
||||
}
|
||||
r.relayedLinesTotal.Inc()
|
||||
r.bufferChannel <- []byte(l)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue