Help us shape the future of Go! Take the 2026 Go Developer Survey

telemetry

package
v1.1.15 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const LevelLoggingDisabled slog.Level = 100

LevelLoggingDisabled sets the slog log level for LoggingDisabled string constant

View Source
const LoggingDisabled = "DISABLED"

LoggingDisabled holds a value to use when logging should be globally disabled, without removing the log handler

View Source
const (
	// MetricsClientContextKey sets the context key for the metrics client
	MetricsClientContextKey contextKey = "metrics"
)

Variables

This section is empty.

Functions

func ConfigureLogger

func ConfigureLogger(ctx context.Context, loggerConfig *DatadogLoggerConfiguration, globalTags map[string]string, logLevel string) (*slog.Logger, error)

func Gauge

func Gauge(metrics *statsd.Client, name string, value float64, tags map[string]string, rate float64)

Gauge reports a GAUGE metric using best-effort approach

func GaugeDuration

func GaugeDuration(metrics *statsd.Client, name string, startedAt time.Time, tags map[string]string, rate float64)

GaugeDuration reports a GAUGE metric corresponding to a duration of an operation that started at a specified time, in milliseconds

func GetClient

func GetClient(ctx context.Context) *statsd.Client

GetClient returns an initialized statsd client, if it exists

func Increment

func Increment(metrics *statsd.Client, name string, tags map[string]string)

Increment reports COUNT metric with a value of 1

Types

type Config

type Config struct {
	// LogLevel sets the logging level (e.g., "debug", "info", "warn", "error").
	LogLevel string `mapstructure:"log-level,omitempty"`

	// ClusterName sets the name of the cluster where the application is running.
	ClusterName string `mapstructure:"cluster-name,omitempty"`

	// MetricsBindAddress sets the address for binding the metrics server.
	MetricsBindAddress string `mapstructure:"metrics-bind-address,omitempty"`
}

type DatadogLoggerConfiguration

type DatadogLoggerConfiguration struct {
	Endpoint    string
	ApiKey      string
	Hostname    string
	ServiceName string
}

func NewDatadogLoggerConfiguration

func NewDatadogLoggerConfiguration() (*DatadogLoggerConfiguration, error)

type PeriodicMetricsReporter

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

func NewPeriodicMetricsReporter

func NewPeriodicMetricsReporter(client *statsd.Client, settings *PeriodicMetricsReporterConfig) *PeriodicMetricsReporter

func (*PeriodicMetricsReporter) AddStreamClass

func (d *PeriodicMetricsReporter) AddStreamClass(kind string, metricName string, tags map[string]string)

func (*PeriodicMetricsReporter) RemoveStreamClass

func (d *PeriodicMetricsReporter) RemoveStreamClass(kind string)

func (*PeriodicMetricsReporter) RunPeriodicMetricsReporter

func (d *PeriodicMetricsReporter) RunPeriodicMetricsReporter(ctx context.Context)

RunPeriodicMetricsReporter starts the metrics reporting loop for stream classes. It reports a metric for each registered stream class at regular intervals. When context is cancelled, the reporting loop exits.

type PeriodicMetricsReporterConfig

type PeriodicMetricsReporterConfig struct {

	// InitialDelay is the delay before the first metrics report is sent.
	InitialDelay time.Duration `mapstructure:"initial-delay,omitempty"`

	// ReportInterval is the interval between successive metrics reports.
	ReportInterval time.Duration `mapstructure:"report-interval,omitempty"`
}

Jump to

Keyboard shortcuts

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