Documentation ¶
Index ¶
Constants ¶
const ( FormatDefault = "" FormatPrometheus = "prometheus" FormatText = "text" ContentTypeText = `text/plain; version=` + expfmt.TextVersion + `; charset=utf-8` MetricSinkInMem = "mem" MetricSinkStatsd = "statsd" MetricSinkDogsStatsd = "dogstatsd" )
Metrics supported format types.
const ServerName = "telemetry"
Variables ¶
var GlobalLabels = []metrics.Label{} //nolint: ignore // false positive
GlobalLabels defines the set of global labels that will be applied to all metrics emitted using the telemetry package function wrappers.
Functions ¶
Types ¶
type Config ¶
type Config struct { // Enable enables the application telemetry functionality. When enabled, // an in-memory sink is also enabled by default. Operators may also enabled // other sinks such as Prometheus. Enable bool `` /* 220-byte string literal not displayed */ // Address defines the API server to listen on Address string `mapstructure:"address" toml:"address" comment:"Address defines the metrics server address to bind to."` // Prefixed with keys to separate services ServiceName string `mapstructure:"service-name" toml:"service-name" comment:"Prefixed with keys to separate services."` // Enable prefixing gauge values with hostname EnableHostname bool `mapstructure:"enable-hostname" toml:"enable-hostname" comment:"Enable prefixing gauge values with hostname."` // Enable adding hostname to labels EnableHostnameLabel bool `mapstructure:"enable-hostname-label" toml:"enable-hostname-label" comment:"Enable adding hostname to labels."` // Enable adding service to labels EnableServiceLabel bool `mapstructure:"enable-service-label" toml:"enable-service-label" comment:"Enable adding service to labels."` // PrometheusRetentionTime, when positive, enables a Prometheus metrics sink. // It defines the retention duration in seconds. PrometheusRetentionTime int64 `` /* 204-byte string literal not displayed */ // GlobalLabels defines a global set of name/value label tuples applied to all // metrics emitted using the wrapper functions defined in telemetry package. // // Example: // [["chain_id", "cosmoshub-1"]] GlobalLabels [][]string `` /* 257-byte string literal not displayed */ // MetricsSink defines the type of metrics backend to use. MetricsSink string `` /* 126-byte string literal not displayed */ // StatsdAddr defines the address of a statsd server to send metrics to. // Only utilized if MetricsSink is set to "statsd" or "dogstatsd". StatsdAddr string `` /* 192-byte string literal not displayed */ // DatadogHostname defines the hostname to use when emitting metrics to // Datadog. Only utilized if MetricsSink is set to "dogstatsd". DatadogHostname string `` /* 198-byte string literal not displayed */ }
func DefaultConfig ¶
func DefaultConfig() *Config
type DisplayableSink ¶
type DisplayableSink interface {
DisplayMetrics(resp http.ResponseWriter, req *http.Request) (any, error)
}
DisplayableSink is an interface that defines a method for displaying metrics.
type GatherResponse ¶
GatherResponse is the response type of registered metrics
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics defines a wrapper around application telemetry functionality. It allows metrics to be gathered at any point in time. When creating a Metrics object, internally, a global metrics is registered with a set of sinks as configured by the operator. In addition to the sinks, when a process gets a SIGUSR1, a dump of formatted recent metrics will be sent to STDERR.
func NewMetrics ¶
NewMetrics creates a new instance of Metrics