package metrics

import "github.com/oslokommune/okctl-metrics-service/pkg/endpoints/metrics"

Index

Functions

func GetRoutes

func GetRoutes(cfg config.Config, logger *logrus.Logger) (endpoints.Routes, []endpoints.TeardownFn)

GetRoutes returns endpoints related to metric handling

Types

type Event

type Event struct {

	// A label used to categorize events
	Category types.Category `json:"category"`

	// A label used to identify the event type
	Action types.Action `json:"action"`

	// Labels that annotate the event
	Labels map[string]string `json:"labels"`
}

Event defines information necessary to process a metric event

func NewEvent

func NewEvent() Event

NewEvent initializes a metric event

func (Event) Validate

func (receiver Event) Validate() error

Validate ensures an Event contains the required and valid data

type MetricRegistry

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

func NewMetricRegistry

func NewMetricRegistry() *MetricRegistry

func (*MetricRegistry) Add

func (m *MetricRegistry) Add(d types.Definition)

func (*MetricRegistry) Increment

func (m *MetricRegistry) Increment(userAgent string, event Event) error

func (*MetricRegistry) Reset

func (m *MetricRegistry) Reset()

Source Files

api.go helpers.go metric_handler.go registry.go types.go validation.go

Directories

PathSynopsis
pkg/endpoints/metrics/types
pkg/endpoints/metrics/types/brewokctlinstallation
pkg/endpoints/metrics/types/commandexecution
pkg/endpoints/metrics/types/installation
Version
v0.1.9 (latest)
Published
Jan 20, 2022
Platform
linux/amd64
Imports
17 packages
Last checked
3 months ago

Tools for package owners.