basculemetrics

package
v2.0.7 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthValidationOutcome = "auth_validation"
	NBFHistogram          = "auth_from_nbf_seconds"
	EXPHistogram          = "auth_from_exp_seconds"
)

Names for our metrics

View Source
const (
	OutcomeLabel = "outcome"
	ServerLabel  = "server"
)

labels

Variables

This section is empty.

Functions

func Metrics

func Metrics() []xmetrics.Metric

Metrics returns the Metrics relevant to this package targeting our older non uber/fx applications. To initialize the metrics, use NewAuthValidationMeasures().

func ProvideMetrics

func ProvideMetrics() fx.Option

ProvideMetrics provides the metrics relevant to this package as uber/fx options. This is now deprecated in favor of ProvideMetricsVec.

func ProvideMetricsVec

func ProvideMetricsVec() fx.Option

ProvideMetricsVec provides the metrics relevant to this package as uber/fx options. The provided metrics are prometheus vectors which gives access to more advanced operations such as CurryWith(labels).

Types

type AuthValidationMeasures

type AuthValidationMeasures struct {
	fx.In

	NBFHistogram      metrics.Histogram
	ExpHistogram      metrics.Histogram
	ValidationOutcome metrics.Counter
}

AuthValidationMeasures describes the defined metrics that will be used by clients

func NewAuthValidationMeasures

func NewAuthValidationMeasures(r xmetrics.Registry) *AuthValidationMeasures

NewAuthValidationMeasures realizes desired metrics. It's intended to be used alongside Metrics() for our older non uber/fx applications.

type BaseMeasuresIn

type BaseMeasuresIn struct {
	fx.In
	Logger log.Logger

	NBFHistogram      *prometheus.HistogramVec `name:"auth_from_nbf_seconds"`
	ExpHistogram      *prometheus.HistogramVec `name:"auth_from_exp_seconds"`
	ValidationOutcome *prometheus.CounterVec   `name:"auth_validation"`
}

BaseMeasuresIn is an uber/fx parameter with base metrics ready to be curried into child metrics based on custom labels.

type ListenerFactory

type ListenerFactory struct {
	ServerName string
}

ListenerFactory facilitates the creation of a server-aware metric listener.

func (ListenerFactory) Annotated

func (m ListenerFactory) Annotated() fx.Annotated

Annotated provides the listener as an annotated component with the name "[SERVER]_bascule_metric_listener"

func (ListenerFactory) New

New builds the metric listener from the provided metrics.

type MetricListener

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

func NewMetricListener

func NewMetricListener(m *AuthValidationMeasures, options ...Option) *MetricListener

func (*MetricListener) OnAuthenticated

func (m *MetricListener) OnAuthenticated(auth bascule.Authentication)

func (*MetricListener) OnErrorResponse

func (m *MetricListener) OnErrorResponse(e basculehttp.ErrorResponseReason, _ error)

type Option

type Option func(m *MetricListener)

func WithExpLeeway

func WithExpLeeway(e time.Duration) Option

func WithNbfLeeway

func WithNbfLeeway(n time.Duration) Option

Jump to

Keyboard shortcuts

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