Documentation
¶
Overview ¶
package admission is a fast way to ingest/send metrics.
Index ¶
Constants ¶
View Source
const ( // DefaultMessages is the number of Messages passed to a ReadBatch call // in the Dispatcher Run loop. DefaultMessages = 16 // DefaultInFlight is the number of concurrent calls to the Handler // allowed in the Run loop. If it would go over, the message is dropped. DefaultInFlight = 256 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
type Dispatcher struct {
// Handler is an interface called with each read Message.
Handler Handler
// Conn is the connection the packets are read from.
Conn syscall.RawConn
// NumMessages is the number of messages to attempt to read at once. If
// zero, DefaultMessages is used.
NumMessages int
// InFlight controls the number of parallel calls to the Handler. Zero is
// DefaultInFlight.
InFlight int
// Hooks provide callbacks for events in the dispatcher.
Hooks struct {
// when messages were read with how many.
ReadMessages func(ctx context.Context, n int)
// when a message is dropped.
DroppedMessage func(ctx context.Context)
}
}
Dispatcher reads Messages on the PacketConn and forwards them into the Handler in parallel.
Click to show internal directories.
Click to hide internal directories.