mirror of
https://github.com/prometheus/statsd_exporter.git
synced 2024-11-22 15:30:59 +00:00
Use a Parser interface to allow alternate implementations
Signed-off-by: bakins <brian@akins.org>
This commit is contained in:
parent
8b2b4c1a2b
commit
709c0da81b
1 changed files with 8 additions and 4 deletions
|
@ -23,15 +23,19 @@ import (
|
||||||
"github.com/go-kit/kit/log"
|
"github.com/go-kit/kit/log"
|
||||||
"github.com/go-kit/kit/log/level"
|
"github.com/go-kit/kit/log/level"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
|
||||||
"github.com/prometheus/statsd_exporter/pkg/event"
|
"github.com/prometheus/statsd_exporter/pkg/event"
|
||||||
pkgLine "github.com/prometheus/statsd_exporter/pkg/line"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type Parser interface {
|
||||||
|
LineToEvents(line string, sampleErrors prometheus.CounterVec, samplesReceived prometheus.Counter, tagErrors prometheus.Counter, tagsReceived prometheus.Counter, logger log.Logger) event.Events
|
||||||
|
}
|
||||||
|
|
||||||
type StatsDUDPListener struct {
|
type StatsDUDPListener struct {
|
||||||
Conn *net.UDPConn
|
Conn *net.UDPConn
|
||||||
EventHandler event.EventHandler
|
EventHandler event.EventHandler
|
||||||
Logger log.Logger
|
Logger log.Logger
|
||||||
LineParser *pkgLine.Parser
|
LineParser Parser
|
||||||
UDPPackets prometheus.Counter
|
UDPPackets prometheus.Counter
|
||||||
LinesReceived prometheus.Counter
|
LinesReceived prometheus.Counter
|
||||||
EventsFlushed prometheus.Counter
|
EventsFlushed prometheus.Counter
|
||||||
|
@ -76,7 +80,7 @@ type StatsDTCPListener struct {
|
||||||
Conn *net.TCPListener
|
Conn *net.TCPListener
|
||||||
EventHandler event.EventHandler
|
EventHandler event.EventHandler
|
||||||
Logger log.Logger
|
Logger log.Logger
|
||||||
LineParser *pkgLine.Parser
|
LineParser Parser
|
||||||
LinesReceived prometheus.Counter
|
LinesReceived prometheus.Counter
|
||||||
EventsFlushed prometheus.Counter
|
EventsFlushed prometheus.Counter
|
||||||
SampleErrors prometheus.CounterVec
|
SampleErrors prometheus.CounterVec
|
||||||
|
@ -138,7 +142,7 @@ type StatsDUnixgramListener struct {
|
||||||
Conn *net.UnixConn
|
Conn *net.UnixConn
|
||||||
EventHandler event.EventHandler
|
EventHandler event.EventHandler
|
||||||
Logger log.Logger
|
Logger log.Logger
|
||||||
LineParser *pkgLine.Parser
|
LineParser Parser
|
||||||
UnixgramPackets prometheus.Counter
|
UnixgramPackets prometheus.Counter
|
||||||
LinesReceived prometheus.Counter
|
LinesReceived prometheus.Counter
|
||||||
EventsFlushed prometheus.Counter
|
EventsFlushed prometheus.Counter
|
||||||
|
|
Loading…
Reference in a new issue