Documentation
¶
Index ¶
- Constants
- Variables
- type Histogram
- type HistogramOpts
- type Metrics
- func (m *Metrics) OnClientClose(_ *client.Client)
- func (m *Metrics) OnHandleConn(_ context.Context, cs stats.ConnStats)
- func (m *Metrics) OnHandleRPC(_ context.Context, rs stats.RPCStats)
- func (m *Metrics) OnKVCall(ctx context.Context, table string, op client.Op, fn client.KvDo) (resp client.OpResponse, err error)
- func (m *Metrics) OnNewClient(_ *client.Client)
- type Opt
- func Buckets(buckets []float64) Opt
- func Gatherer(gatherer prometheus.Gatherer) Opt
- func Histograms(hs ...Histogram) Opt
- func HistogramsFromOpts(hs ...HistogramOpts) Opt
- func Namespace(namespace string) Opt
- func Registerer(reg prometheus.Registerer) Opt
- func Registry(rg RegistererGatherer) Opt
- func Subsystem(ss string) Opt
- func WithClientLabel() Opt
- type RegistererGatherer
Constants ¶
const DefNamespace = "regatta"
DefNamespace is the default namespace for the metrics
Variables ¶
var DefBuckets = []float64{0.001, 0.002, 0.004, 0.008, 0.016, 0.032, 0.064, 0.128, 0.256, 0.512, 1.024, 2.048}
DefBuckets are the default Histogram buckets. The default buckets are tailored to broadly measure the kafka timings (in seconds).
Functions ¶
This section is empty.
Types ¶
type Histogram ¶
type Histogram uint8
A Histogram is an identifier for a rprom histogram that can be enabled
type HistogramOpts ¶
HistogramOpts allows histograms to be enabled with custom buckets
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
func NewMetrics ¶
NewMetrics returns a new Metrics that adds prometheus metrics to the registry under the given namespace.
func (*Metrics) OnClientClose ¶
func (*Metrics) OnHandleConn ¶
func (*Metrics) OnNewClient ¶
type Opt ¶
type Opt interface {
// contains filtered or unexported methods
}
Opt is an option to configure Metrics.
func Buckets ¶
Buckets sets the buckets to be used with Histograms, overriding the default of rprom.DefBuckets. If custom buckets per histogram is needed, HistogramOpts can be used.
func Gatherer ¶
func Gatherer(gatherer prometheus.Gatherer) Opt
Gatherer sets the gatherer to add gather to, rather than a new registry.
func Histograms ¶
Histograms sets the histograms to be enabled for rprom, overiding the default of disabling all histograms.
metrics, _ := rprom.NewMetrics( rprom.Histograms( rprom.RequestDurationE2E, ), )
func HistogramsFromOpts ¶
func HistogramsFromOpts(hs ...HistogramOpts) Opt
HistogramsFromOpts allows the user full control of what histograms to enable and define buckets to be used with each histogram.
metrics, _ := rprom.NewMetrics( rprom.HistogramsFromOpts( rprom.HistogramOpts{ Enable: rprom.ReadWait, Buckets: prometheus.LinearBuckets(10, 10, 8), }, rprom.HistogramOpts{ Enable: rprom.ReadeTime, // rprom default bucket will be used }, ), )
func Namespace ¶ added in v0.1.2
Namespace sets the Prometheus namespace for exposed metrics, overriding the default "regatta" namespace
func Registerer ¶
func Registerer(reg prometheus.Registerer) Opt
Registerer sets the registerer to add register to, rather than a new registry.
func Registry ¶
func Registry(rg RegistererGatherer) Opt
Registry sets the registerer and gatherer to add metrics to, rather than a new registry. Use this option if you want to configure both Gatherer and Registerer with the same object.
func Subsystem ¶
Subsystem sets the subsystem for the rprom metrics, overriding the default empty string.
func WithClientLabel ¶
func WithClientLabel() Opt
WithClientLabel adds a "cliend_id" label to all metrics.
type RegistererGatherer ¶
type RegistererGatherer interface { prometheus.Registerer prometheus.Gatherer }