statsd

package
v1.3.19 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package statsd provides a client to send basic statd metrics (timer, counter and gauge) to listening UDP StatsD server.

  • Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved. *

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client implements a StatsD client

func New

func New(ip string, port int, prefix string, probe bool) (*Client, error)

New returns a UDP client that we then use to send metrics to the specified IP:port

func (Client) AppMetric

func (c Client) AppMetric(m Metric, sgl *memsys.SGL)

TODO: MTU size limitation

func (*Client) Close

func (c *Client) Close() error

Close closes the UDP connection

func (*Client) Send

func (c *Client) Send(bucket string, aggCnt int64, metrics ...Metric)

Send sends metrics to StatsD server bucket - StatsD "bucket" - not to confuse with storage aggCnt - if stats were aggregated - number of stats which were aggregated, 1 otherwise 1/ratio - how many samples are aggregated into single metric see: https://github.com/statsd/statsd/blob/master/docs/metric_types.md#sampling

func (*Client) SendSGL

func (c *Client) SendSGL(sgl *memsys.SGL)

NOTE: ignoring potential race vs client.Close() - disregarding write errors, if any

type Metric

type Metric struct {
	Type  MetricType // time, counter or gauge
	Name  string     // Name for this particular metric
	Value any
}

Metric is a generic structure for all type of StatsD metrics

type MetricType

type MetricType int

MetricType is the type of StatsD metric

const (
	// Timer is StatsD's timer type
	Timer MetricType = iota
	// Counter is StatsD's counter type
	Counter
	// Gauge is StatsD's gauge type
	Gauge
	// PersistentCounter is StatsD's gauge type which is increased every time by its value
	PersistentCounter
)

Jump to

Keyboard shortcuts

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