metrics

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package metrics provides a wrapper to interact with StatsD.

Index

Constants

View Source
const (
	// DefaultMetricsClientAddr is the default metrics client address.
	DefaultMetricsClientAddr = "localhost:8125"
)

Variables

View Source
var (
	// ClientNotInitializedMsg is logged when the metrics client is not
	// initialized and metrics are enabled.
	ClientNotInitializedMsg = "metrics client not initialized"
)

Functions

This section is empty.

Types

type Client

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

Client represents a metrics service client.

func NewClient

func NewClient(ctx context.Context, logger *slog.Logger, cfg config.MetricsConfig) (*Client, error)

NewClient creates a new metrics client based on environment variables config.

func (*Client) Close

func (c *Client) Close()

Close closes the metrics client.

func (*Client) Flush

func (c *Client) Flush()

Flush flushes the metrics client.

func (*Client) Gauge

func (c *Client) Gauge(name string, value int, tags []string)

Gauge sends a gauge metric to the metrics service.

func (*Client) ServiceCheck

func (c *Client) ServiceCheck(status byte, message string, tags []string)

ServiceCheck sends a service satus signal to the metrics service.

Jump to

Keyboard shortcuts

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