metric

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Count added in v1.0.0

func Count(ctx context.Context, name string, tags []attribute.KeyValue, rate float64)

Count records a new metric instance with a value of 1. Example (to increment the new_users counter -- i.e to record a new instance of new_user):

metric.Count(ctx, "new_users", nil, 1)

func Duration added in v1.0.0

func Duration(ctx context.Context, name string, value time.Duration, tags []attribute.KeyValue, rate float64)

Duration records duration information for an event (in seconds).

Example:

duration := time.Millisecond * 30

tags = []attribute.KeyValue{
	{
		Key:   attribute.Key("table"),
		Value: attribute.StringValue("users"),
	},
}
metric.Duration(ctx, "queries.select", duration, tags, 1)

func Histogram

func Histogram(ctx context.Context, name string, value float64, tags []attribute.KeyValue, rate float64)

Histogram tracks the statistical distribution of a set of values for an event.

Example:

metric.Histogram(ctx, "logins.successful", 1.0, []{Key: "email", Value: "x@example.com"}, 1)

Types

This section is empty.

Jump to

Keyboard shortcuts

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