metrics

package
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package metrics provides helpers for setting up metrics reporting.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartLibrato

func StartLibrato(logger log.FieldLogger, cfg Config) metrics.Provider

StartLibrato initializes a new librato provider given the Config, and sets up a runtimemetrics.Collector on it. The runtime collector will emit on the librato.Provider every Config.ReportInterval ticks. You need to call Stop on the librato.Provider before you tear down the process.

Types

type Config

type Config struct {
	ReportInterval time.Duration `env:"METRICS_REPORT_INTERVAL,default=60s"`
	Source         string        `env:"METRICS_SOURCE"`
	Prefix         string        `env:"METRICS_PREFIX"`
	DefaultTags    []string      `env:"METRICS_DEFAULT_TAGS"`
	Librato        Librato
}

Config stores all the env related config to bootstrap metrics.

type Librato

type Librato struct {
	APIURL      *url.URL `env:"LIBRATO_API_URL"`
	User        string   `env:"LIBRATO_USER"`
	Password    string   `env:"LIBRATO_PASSWORD"`
	TagsEnabled bool     `env:"LIBRATO_TAGS_ENABLED"`
}

Librato stores all related librato config to be able to connect to its API.

func (Librato) URL

func (l Librato) URL() *url.URL

URL returns the specified LIBRATO_API_URL, if any. Otherwise it defaults to the default Librato URL. The credentials are applied from LIBRATO_USER and LIBRATO_PASSWORD.

Jump to

Keyboard shortcuts

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