mirror of
https://github.com/prometheus/statsd_exporter.git
synced 2024-11-29 18:50: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
|
@ -37,6 +37,7 @@ type Relay struct {
|
||||||
|
|
||||||
packetsTotal prometheus.Counter
|
packetsTotal prometheus.Counter
|
||||||
longLinesTotal prometheus.Counter
|
longLinesTotal prometheus.Counter
|
||||||
|
relayedLinesTotal prometheus.Counter
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -54,6 +55,13 @@ var (
|
||||||
},
|
},
|
||||||
[]string{"target"},
|
[]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
|
// NewRelay creates a statsd UDP relay. It can be used to send copies of statsd raw
|
||||||
|
@ -79,6 +87,7 @@ func NewRelay(l log.Logger, target string, packetLength uint) (*Relay, error) {
|
||||||
|
|
||||||
packetsTotal: relayPacketsTotal.WithLabelValues(target),
|
packetsTotal: relayPacketsTotal.WithLabelValues(target),
|
||||||
longLinesTotal: relayLongLinesTotal.WithLabelValues(target),
|
longLinesTotal: relayLongLinesTotal.WithLabelValues(target),
|
||||||
|
relayedLinesTotal: relayLinesRelayedTotal.WithLabelValues(target),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Startup the UDP sender.
|
// Startup the UDP sender.
|
||||||
|
@ -152,5 +161,6 @@ func (r *Relay) RelayLine(l string) {
|
||||||
if !strings.HasSuffix(l, "\n") {
|
if !strings.HasSuffix(l, "\n") {
|
||||||
l = l + "\n"
|
l = l + "\n"
|
||||||
}
|
}
|
||||||
|
r.relayedLinesTotal.Inc()
|
||||||
r.bufferChannel <- []byte(l)
|
r.bufferChannel <- []byte(l)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue