Documentation ¶
Overview ¶
Package listeners implements the StatsdListener interfaces.
Index ¶
Constants ¶
const RandomPortName = "__random__" // this would be zero if zero wasn't used already to disable udp support.
RandomPortName is the value for dogstatsd_port setting that indicates that the server should allocate a random unique port.
Variables ¶
This section is empty.
Functions ¶
func InitTelemetry ¶
func InitTelemetry(buckets []float64)
InitTelemetry initialize the telemetry.Histogram buckets for the internal telemetry. This will be called once the first dogstatsd server is created since we need the configuration to be fully loaded.
func NewUDSOobPoolManager ¶
func NewUDSOobPoolManager() *packets.PoolManager
NewUDSOobPoolManager returns an UDS OOB pool manager
Types ¶
type CloseFunction ¶
CloseFunction is a function that closes a connection
type ConnectionTracker ¶
type ConnectionTracker struct {
// contains filtered or unexported fields
}
ConnectionTracker tracks connections and closes them gracefully.
func NewConnectionTracker ¶
func NewConnectionTracker(name string, closeDelay time.Duration) *ConnectionTracker
NewConnectionTracker creates a new ConnectionTracker. closeDelay is the time to wait before closing a connection. First it will be shutdown for write, which will notify the client that we are disconnecting, then it will be closed. This gives some time to consume the remaining packets.
func (*ConnectionTracker) Close ¶
func (t *ConnectionTracker) Close(conn net.Conn)
Close closes a connection.
func (*ConnectionTracker) HandleConnections ¶
func (t *ConnectionTracker) HandleConnections()
HandleConnections handles connections.
func (*ConnectionTracker) Start ¶
func (t *ConnectionTracker) Start()
Start starts the connection tracker.
func (*ConnectionTracker) Stop ¶
func (t *ConnectionTracker) Stop()
Stop stops the connection tracker. To be called one the listener is stopped, after the server socket has been close.
func (*ConnectionTracker) Track ¶
func (t *ConnectionTracker) Track(conn net.Conn)
Track tracks a connection.
type NamedPipeListener ¶
type NamedPipeListener struct{}
NamedPipeListener implements the StatsdListener interface for named pipe protocol.
func NewNamedPipeListener ¶
func NewNamedPipeListener(pipeName string, packetOut chan packets.Packets, sharedPacketPoolManager *packets.PoolManager, cfg config.Reader, capture replay.Component) (*NamedPipeListener, error)
NewNamedPipeListener returns an named pipe Statsd listener
func (*NamedPipeListener) Listen ¶
func (l *NamedPipeListener) Listen()
Listen runs the intake loop. Should be called in its own goroutine
func (*NamedPipeListener) Stop ¶
func (l *NamedPipeListener) Stop()
Stop closes the connection and stops listening
type StatsdListener ¶
type StatsdListener interface { Listen() Stop() }
StatsdListener opens a communication channel to get statsd packets in.
type UDPListener ¶
type UDPListener struct {
// contains filtered or unexported fields
}
UDPListener implements the StatsdListener interface for UDP protocol. It listens to a given UDP address and sends back packets ready to be processed. Origin detection is not implemented for UDP.
func NewUDPListener ¶
func NewUDPListener(packetOut chan packets.Packets, sharedPacketPoolManager *packets.PoolManager, cfg config.Reader, capture replay.Component) (*UDPListener, error)
NewUDPListener returns an idle UDP Statsd listener
func (*UDPListener) Listen ¶
func (l *UDPListener) Listen()
Listen runs the intake loop. Should be called in its own goroutine
func (*UDPListener) LocalAddr ¶
func (l *UDPListener) LocalAddr() string
LocalAddr returns the local network address of the listener.
func (*UDPListener) Stop ¶
func (l *UDPListener) Stop()
Stop closes the UDP connection and stops listening
type UDSDatagramListener ¶
type UDSDatagramListener struct { UDSListener // contains filtered or unexported fields }
UDSDatagramListener implements the StatsdListener interface for Unix Domain (datagrams)
func NewUDSDatagramListener ¶
func NewUDSDatagramListener(packetOut chan packets.Packets, sharedPacketPoolManager *packets.PoolManager, sharedOobPoolManager *packets.PoolManager, cfg config.Reader, capture replay.Component, wmeta optional.Option[workloadmeta.Component], pidMap pidmap.Component) (*UDSDatagramListener, error)
NewUDSDatagramListener returns an idle UDS datagram Statsd listener
func (*UDSDatagramListener) Listen ¶
func (l *UDSDatagramListener) Listen()
Listen runs the intake loop. Should be called in its own goroutine
func (*UDSDatagramListener) Stop ¶
func (l *UDSDatagramListener) Stop()
Stop closes the UDS connection and stops listening
type UDSListener ¶
type UDSListener struct { OriginDetection bool // contains filtered or unexported fields }
UDSListener implements the StatsdListener interface for Unix Domain Socket datagram protocol. It listens to a given socket path and sends back packets ready to be processed. Origin detection will be implemented for UDS.
func NewUDSListener ¶
func NewUDSListener(packetOut chan packets.Packets, sharedPacketPoolManager *packets.PoolManager, sharedOobPacketPoolManager *packets.PoolManager, cfg config.Reader, capture replay.Component, transport string, wmeta optional.Option[workloadmeta.Component], pidMap pidmap.Component) (*UDSListener, error)
NewUDSListener returns an idle UDS Statsd listener
func (*UDSListener) Stop ¶
func (l *UDSListener) Stop()
Stop closes the UDS connection and stops listening
type UDSStreamListener ¶
type UDSStreamListener struct { UDSListener // contains filtered or unexported fields }
UDSStreamListener implements the StatsdListener interface for Unix Domain (streams)
func NewUDSStreamListener ¶
func NewUDSStreamListener(packetOut chan packets.Packets, sharedPacketPoolManager *packets.PoolManager, sharedOobPacketPoolManager *packets.PoolManager, cfg config.Reader, capture replay.Component, wmeta optional.Option[workloadmeta.Component], pidMap pidmap.Component) (*UDSStreamListener, error)
NewUDSStreamListener returns an idle UDS datagram Statsd listener
func (*UDSStreamListener) Listen ¶
func (l *UDSStreamListener) Listen()
Listen runs the intake loop. Should be called in its own goroutine
func (*UDSStreamListener) Stop ¶
func (l *UDSStreamListener) Stop()
Stop closes the UDS connection and stops listening