Documentation ¶
Overview ¶
Package kgmetrics provides rcrowley/go-metrics drop-in metrics for a kgo client.
This package tracks the following metrics under the following names, all metrics are meters:
broker.<id>.connects broker.<id>.connect_errors broker.<id>.disconnects broker.<id>.write_errors broker.<id>.write_bytes broker.<id>.read_errors broker.<id>.read_bytes broker.<id>.topic.<topic>.produce_bytes broker.<id>.topic.<topic>.fetch_bytes
The metrics can be prefixed with the NamePrefix option.
This can be used in a client like so:
m := kgmetrics.NewMetrics() cl, err := kgo.NewClient( kgo.WithHooks(m), // ...other opts )
By default, metrics are installed under the DefaultRegistry, but this can be overridden with the Registry option.
Note that seed brokers use broker IDs starting at math.MinInt32.
Index ¶
- type Metrics
- func (m *Metrics) OnBrokerConnect(meta kgo.BrokerMetadata, _ time.Duration, _ net.Conn, err error)
- func (m *Metrics) OnBrokerDisconnect(meta kgo.BrokerMetadata, _ net.Conn)
- func (m *Metrics) OnBrokerRead(meta kgo.BrokerMetadata, _ int16, bytesRead int, _, _ time.Duration, err error)
- func (m *Metrics) OnBrokerWrite(meta kgo.BrokerMetadata, _ int16, bytesWritten int, _, _ time.Duration, ...)
- func (m *Metrics) OnFetchBatchRead(meta kgo.BrokerMetadata, topic string, _ int32, fbm kgo.FetchBatchMetrics)
- func (m *Metrics) OnProduceBatchWritten(meta kgo.BrokerMetadata, topic string, _ int32, pbm kgo.ProduceBatchMetrics)
- func (m *Metrics) Registry() metrics.Registry
- type Opt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics provides rcrowley/go-metrics.
func (*Metrics) OnBrokerConnect ¶
func (*Metrics) OnBrokerDisconnect ¶
func (m *Metrics) OnBrokerDisconnect(meta kgo.BrokerMetadata, _ net.Conn)
func (*Metrics) OnBrokerRead ¶
func (*Metrics) OnBrokerWrite ¶
func (*Metrics) OnFetchBatchRead ¶
func (m *Metrics) OnFetchBatchRead(meta kgo.BrokerMetadata, topic string, _ int32, fbm kgo.FetchBatchMetrics)
func (*Metrics) OnProduceBatchWritten ¶
func (m *Metrics) OnProduceBatchWritten(meta kgo.BrokerMetadata, topic string, _ int32, pbm kgo.ProduceBatchMetrics)
type Opt ¶
type Opt interface {
// contains filtered or unexported methods
}
Opt applies options to further tune how metrics are gathered.
func NamePrefix ¶
NamePrefix sets configures all register names to be prefixed with this value.
Click to show internal directories.
Click to hide internal directories.