mock

package
v1.9.5 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

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().

func (*MockMetrics) RateLimit

func (m *MockMetrics) RateLimit(operation string) time.Duration

RateLimit returns the sum of all rate limited durations of all API for a given operation

Jump to

Keyboard shortcuts

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