Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockMetrics ¶
type MockMetrics struct {
// contains filtered or unexported fields
}
MockMetrics is a mock implementation of pkg/api/metrics
func NewMockMetrics ¶
func NewMockMetrics() *MockMetrics
NewMockMetrics returns a new metrics implementation with a mocked backend
func (*MockMetrics) APICall ¶
func (m *MockMetrics) APICall(operation, status string) float64
APICall returns the sum of all durations of all API for a given operation and status
func (*MockMetrics) ObserveAPICall ¶
func (m *MockMetrics) 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. The duration of the API call will be observed. The total can be retrieved with APICall().
func (*MockMetrics) ObserveRateLimit ¶
func (m *MockMetrics) ObserveRateLimit(operation string, delay time.Duration)
ObserveRateLimit must be called in case an API call was subject to rate limiting. The duration of the rate-limiting will be observed. The taotal of all durations can be retrieve with RateLimit().