Documentation ¶
Index ¶
Constants ¶
const ( AuthValidationOutcome = "auth_validation" NBFHistogram = "auth_from_nbf_seconds" EXPHistogram = "auth_from_exp_seconds" )
Names for our metrics
const ( OutcomeLabel = "outcome" ServerLabel = "server" )
labels
Variables ¶
This section is empty.
Functions ¶
func Metrics ¶
Metrics returns the Metrics relevant to this package targeting our older non uber/fx applications. To initialize the metrics, use NewAuthValidationMeasures().
func ProvideMetrics ¶ added in v1.10.2
ProvideMetrics provides the metrics relevant to this package as uber/fx options. This is now deprecated in favor of ProvideMetricsVec.
func ProvideMetricsVec ¶ added in v1.11.5
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 ¶ added in v1.11.5
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 ¶ added in v1.11.7
type ListenerFactory struct {
ServerName string
}
ListenerFactory facilitates the creation of a server-aware metric listener.
func (ListenerFactory) Annotated ¶ added in v1.11.7
func (m ListenerFactory) Annotated() fx.Annotated
Annotated provides the listener as an annotated component with the name "[SERVER]_bascule_metric_listener"
func (ListenerFactory) New ¶ added in v1.11.7
func (m ListenerFactory) New(in BaseMeasuresIn) (*MetricListener, error)
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)