httpmetrics

package
v1.0.12868-f174f6f Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// URL configures a host for exporting metrics to http[s]://host[:port][/path]
	URL string
	// AuthToken is included as a bearer token on requests
	AuthToken secret.String
	// GlobalTags are added to each metric. Be aware of high cardinality issues
	GlobalTags Tags
	// ClientName provides a name & user agent to the http client for observability. Defaults to "o11y-metrics-client"
	ClientName string
	// PublishInterval how often to publish metrics, defaults to 1 minute
	PublishInterval time.Duration
	// Namespace gets prepended to all stat names
	Namespace string
}

type Provider

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

Provider is a struct that implements the CloseableMetricsProvider interface

func New

func New(cfg Config) *Provider

New creates a Provider that implements the ClosableMetricsProvider interface

func (*Provider) Close

func (m *Provider) Close() error

func (*Provider) Count

func (m *Provider) Count(n string, v int64, t []string, rate float64) error

func (*Provider) Gauge

func (m *Provider) Gauge(n string, v float64, t []string, rate float64) error

Gauge in an agent can be used for values that don't change,

func (*Provider) Histogram

func (m *Provider) Histogram(n string, v float64, t []string, rate float64) error

Histogram can be used for any value that changes.

func (*Provider) Publish

func (m *Provider) Publish(ctx context.Context)

Publish sends the stored metrics to receiver

func (*Provider) TimeInMilliseconds

func (m *Provider) TimeInMilliseconds(n string, v float64, t []string, rate float64) error

TimeInMilliseconds can be used for any timing data (recording how long something took)

type Tags

type Tags map[string]string

Jump to

Keyboard shortcuts

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