Documentation ¶
Overview ¶
Package metrics provides helpers for working with the library metrics.
Index ¶
- Constants
- func PrometheusLabels() prometheus.Labels
- type PrometheusMetrics
- func (pm *PrometheusMetrics) IncTokenIntrospectionsTotal(status string)
- func (pm *PrometheusMetrics) MustCurryWith(labels prometheus.Labels) *PrometheusMetrics
- func (pm *PrometheusMetrics) MustRegister()
- func (pm *PrometheusMetrics) ObserveGRPCClientRequest(method string, code grpccodes.Code, elapsed time.Duration)
- func (pm *PrometheusMetrics) ObserveHTTPClientRequest(method string, targetURL string, statusCode int, elapsed time.Duration, ...)
- func (pm *PrometheusMetrics) Unregister()
- type Source
Constants ¶
View Source
const ( PrometheusLibInstanceLabel = "lib_instance" PrometheusLibSourceLabel = "lib_source" )
View Source
const ( HTTPClientRequestLabelMethod = "method" HTTPClientRequestLabelURL = "url" HTTPClientRequestLabelStatusCode = "status_code" HTTPClientRequestLabelError = "error" GRPCClientRequestLabelMethod = "grpc_method" GRPCClientRequestLabelCode = "grpc_code" TokenIntrospectionLabelStatus = "status" )
View Source
const ( HTTPRequestErrorDo = "do_request_error" HTTPRequestErrorDecodeBody = "decode_body_error" HTTPRequestErrorUnexpectedStatusCode = "unexpected_status_code" TokenIntrospectionStatusActive = "active" TokenIntrospectionStatusNotActive = "not_active" TokenIntrospectionStatusNotNeeded = "not_needed" TokenIntrospectionStatusNotIntrospectable = "not_introspectable" TokenIntrospectionStatusInvalidClaims = "invalid_claims" TokenIntrospectionStatusError = "error" )
View Source
const DefaultPrometheusLibInstanceLabel = "default"
View Source
const PrometheusNamespace = "go_authkit"
Variables ¶
This section is empty.
Functions ¶
func PrometheusLabels ¶
func PrometheusLabels() prometheus.Labels
Types ¶
type PrometheusMetrics ¶
type PrometheusMetrics struct { HTTPClientRequestDuration *prometheus.HistogramVec GRPCClientRequestDuration *prometheus.HistogramVec TokenIntrospectionsTotal *prometheus.CounterVec TokenClaimsCache *lrucache.PrometheusMetrics TokenNegativeCache *lrucache.PrometheusMetrics EndpointDiscoveryCache *lrucache.PrometheusMetrics }
PrometheusMetrics represents the collector of metrics.
func GetPrometheusMetrics ¶
func GetPrometheusMetrics(instance string, source Source) *PrometheusMetrics
func (*PrometheusMetrics) IncTokenIntrospectionsTotal ¶ added in v0.12.0
func (pm *PrometheusMetrics) IncTokenIntrospectionsTotal(status string)
func (*PrometheusMetrics) MustCurryWith ¶
func (pm *PrometheusMetrics) MustCurryWith(labels prometheus.Labels) *PrometheusMetrics
MustCurryWith curries the metrics collector with the provided labels.
func (*PrometheusMetrics) MustRegister ¶
func (pm *PrometheusMetrics) MustRegister()
MustRegister does registration of metrics collector in Prometheus and panics if any error occurs.
func (*PrometheusMetrics) ObserveGRPCClientRequest ¶
func (*PrometheusMetrics) ObserveHTTPClientRequest ¶
func (*PrometheusMetrics) Unregister ¶
func (pm *PrometheusMetrics) Unregister()
Unregister cancels registration of metrics collector in Prometheus.
Click to show internal directories.
Click to hide internal directories.