clorthometrics

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2022 License: Apache-2.0 Imports: 4 Imported by: 4

Documentation

Overview

Package clorthometrics integrates clortho events with Prometheus metrics.

Index

Constants

View Source
const (
	// MetricPrefix is prepended to all metrics exposed by this package.
	MetricPrefix = "keys_"

	// RefreshTotalName is the name of the counter for all refresh attempts,
	// both successful and unsuccessful.
	RefreshTotalName = MetricPrefix + "refresh_total"

	// RefreshTotalHelp is the help text for the refresh total metric.
	RefreshTotalHelp = "the total number of attempts to refresh keys, both successful and unsuccessful"

	// RefreshKeysName is the name of the gauge for the number of keys from a particular
	// source URI.
	RefreshKeysName = MetricPrefix + "refresh_keys"

	// RefreshKeysHelp is the help text for the refresh keys metric.
	RefreshKeysHelp = "the number of keys for a particular source URI"

	// RefreshErrorTotalName is the name of the counter for key refreshes that
	// resulted in an error.
	RefreshErrorTotalName = MetricPrefix + "refresh_error_total"

	// RefreshErrorTotalHelp is the help text for the refresh error total metric.
	RefreshErrorTotalHelp = "the total number of failed attempts to refresh keys"

	// ResolveTotalName is the name of the counter for all resolve attempts,
	// both successful and unsuccessful.  Individual keys, rather than key sets,
	// are resolved.  In contrast, the refresh metrics track key set refreshes.
	ResolveTotalName = MetricPrefix + "resolve_total"

	// ResolveTotalHelp is the help text for the resolve total metric.
	ResolveTotalHelp = "the total attempts to resolve individual keys by key id, both successful and unsuccessful"

	// ResolveErrorTotalName is the name of the counter for failed resolve attempts
	// for individual keys.
	ResolveErrorTotalName = MetricPrefix + "resolve_error_total"

	// ResolveErrorTotalHelp is the help text for the resolve error metric.
	ResolveErrorTotalHelp = "the total failed attempts to resolve individual keys"

	// SourceLabel is the metric label indicating the URI source of the key(s).
	SourceLabel = "source"

	// KeyIDLabel is the metric label indicating the key ID that was resolved.
	KeyIDLabel = "keyID"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Listener

type Listener struct {
	// contains filtered or unexported fields
}

Listener handles refresh and resolve events, tallying metrics for both.

func NewListener

func NewListener(options ...ListenerOption) (l *Listener, err error)

NewListener creates a metrics Listener using the supplied set of options. If no options are passed, the returned Listener will be a no-op.

func (*Listener) OnRefreshEvent

func (l *Listener) OnRefreshEvent(event clortho.RefreshEvent)

OnRefreshEvent tallies metrics for the given RefreshEvent.

func (*Listener) OnResolveEvent

func (l *Listener) OnResolveEvent(event clortho.ResolveEvent)

OnResolveEvent tallies metrics for the given ResolveEvent.

type ListenerOption

type ListenerOption interface {
	// contains filtered or unexported methods
}

ListenerOption is a configurable option passed to NewListener that can tailor the created Listener.

func WithFactory

func WithFactory(f *touchstone.Factory) ListenerOption

WithFactory populates a listener with metrics created via the given factory.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL