metrics

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

type Interface interface {
	// CountHook records this hook as having been received, along with it's kind.
	CountHook(h scm.Webhook)

	// CountInvalidHook records "bad" hooks, probably due to non-matching secrets.
	CountInvalidHook()

	// CountAPICall records API calls to the upstream hosting service.
	CountAPICall(name string)

	// CountFailedAPICall records failed API calls to the upstream hosting service.
	CountFailedAPICall(name string)
}

Interface implementations provide metrics for the system.

type MockMetrics

type MockMetrics struct {
	Hooks          int
	InvalidHooks   int
	APICalls       int
	FailedAPICalls int
}

MockMetrics is a type that provides a simple counter for metrics for test purposes.

func NewMock

func NewMock() *MockMetrics

NewMock creates and returns a MockMetrics.

func (*MockMetrics) CountAPICall

func (m *MockMetrics) CountAPICall(name string)

CountAPICall records outgoing API calls to upstream services.

func (*MockMetrics) CountFailedAPICall

func (m *MockMetrics) CountFailedAPICall(name string)

CountFailedAPICall records failed outgoing API calls to upstream services.

func (*MockMetrics) CountHook

func (m *MockMetrics) CountHook(h scm.Webhook)

CountHook records this hook as having been received, along with it's kind.

func (*MockMetrics) CountInvalidHook

func (m *MockMetrics) CountInvalidHook()

CountInvalidHook records "bad" hooks, probably due to non-matching secrets.

type PrometheusMetrics

type PrometheusMetrics struct {
	// contains filtered or unexported fields
}

PrometheusMetrics is a wrapper around Prometheus metrics for counting events in the system.

func New

New creates and returns a PrometheusMetrics initialised with prometheus counters.

func (*PrometheusMetrics) CountAPICall

func (m *PrometheusMetrics) CountAPICall(name string)

CountAPICall records outgoing API calls to upstream services.

func (*PrometheusMetrics) CountFailedAPICall

func (m *PrometheusMetrics) CountFailedAPICall(name string)

CountFailedAPICall records failled outgoing API calls to upstream services.

func (*PrometheusMetrics) CountHook

func (m *PrometheusMetrics) CountHook(h scm.Webhook)

CountHook records this hook as having been received, along with it's kind.

func (*PrometheusMetrics) CountInvalidHook

func (m *PrometheusMetrics) CountInvalidHook()

CountInvalidHook records "bad" hooks, probably due to non-matching secrets.

Jump to

Keyboard shortcuts

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