Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NoOpMetrics ¶
type NoOpMetrics struct{}
NoOpMetrics is a no-op implementation
func (*NoOpMetrics) ObserveAPICall ¶
func (m *NoOpMetrics) ObserveAPICall(call, status string, duration float64)
ObserveAPICall must be called on every API call made with the operation performed, the status code received and the duration of the call. This No-op implementation will perform no metrics accounting in return.
func (*NoOpMetrics) ObserveRateLimit ¶
func (m *NoOpMetrics) ObserveRateLimit(operation string, duration time.Duration)
ObserveRateLimit must be called in case an API call was subject to rate limiting. This No-op implementation will perform no metrics accounting in return.
type PrometheusMetrics ¶
type PrometheusMetrics struct { ApiDuration *prometheus.HistogramVec RateLimit *prometheus.HistogramVec // contains filtered or unexported fields }
PrometheusMetrics is an implementation of Prometheus metrics for external API usage
func NewPrometheusMetrics ¶
func NewPrometheusMetrics(namespace, subsystem string, registry *prometheus.Registry) *PrometheusMetrics
NewPrometheusMetrics returns a new metrics tracking implementation to cover external API usage.
func (*PrometheusMetrics) ObserveAPICall ¶
func (p *PrometheusMetrics) ObserveAPICall(operation, status string, duration float64)
ObserveAPICall must be called on every API call made with the operation performed, the status code received and the duration of the call
func (*PrometheusMetrics) ObserveRateLimit ¶
func (p *PrometheusMetrics) ObserveRateLimit(operation string, delay time.Duration)
ObserveRateLimit must be called in case an API call was subject to rate limiting