httpmetrics

package
v1.0.12197-5ee2a3a Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: MIT Imports: 7 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
}

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 new 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) StartPublishLoop

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

StartPublishLoop starts a loop which will publish metrics on an interval. It will attempt to flush data on close or context cancellation.

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