metrics

package
v0.89.4 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2021 License: Apache-2.0 Imports: 12 Imported by: 53

Documentation

Overview

Package metrics provides simple metrics tracking features.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider interface {
	// MeasureSince adds a measurement for key to the metric store.
	// Used with defer and time.Now().
	MeasureSince(key string, start time.Time)

	// WriteMetrics will write a summary of the metrics to w.
	WriteMetrics(w io.Writer)

	// TrackValue tracks the value for diff calculations etc.
	TrackValue(key string, value interface{})

	// Reset clears the metric store.
	Reset()
}

The Provider interface defines an interface for measuring metrics.

func NewProvider

func NewProvider(calculateHints bool) Provider

NewProvider returns a new instance of a metric store.

type Store

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

Store provides storage for a set of metrics.

func (*Store) MeasureSince

func (s *Store) MeasureSince(key string, start time.Time)

MeasureSince adds a measurement for key to the metric store.

func (*Store) Reset

func (s *Store) Reset()

Reset clears the metrics store.

func (*Store) TrackValue

func (s *Store) TrackValue(key string, value interface{})

TrackValue tracks the value for diff calculations etc.

func (*Store) WriteMetrics

func (s *Store) WriteMetrics(w io.Writer)

WriteMetrics writes a summary of the metrics to w.

Jump to

Keyboard shortcuts

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