metrics

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 7 Imported by: 0

README

metrics

Contains interfaces and methods for generating application metrics and sending them to external services. Metrics can be generated anywhere in the application and optionally sent to a single external service. The naming convention for metrics names and attributes is PascalCase, also known as upper camel case (e.g. UpperCamelCase).

Information for each metrics generator is available in the GoDoc.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	// Contextual information related to the metric. If the external service accepts key-value pairs (e.g., identifiers, tags), then this is passed directly to the service.
	Attributes map[string]string

	// A short name that describes the metric. This is passed directly to the external service and should use the upper camel case (UpperCamelCase) naming convention.
	Name string

	// The metric data point. This value is converted to the correct data type before being sent to the external service.
	Value interface{}
}

Data contains a metric that can be sent to external services.

func (*Data) AddAttributes

func (d *Data) AddAttributes(attr map[string]string)

AddAttributes is a convenience method for adding attributes to a metric.

type Generator

type Generator interface {
	Generate(context.Context, Data) error
}

func New added in v1.0.0

func New(ctx context.Context, cfg config.Config) (Generator, error)

Jump to

Keyboard shortcuts

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