stats

package
v0.0.0-...-0ade494 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2022 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CountType     = "count"
	TimerType     = "timer"
	GaugeType     = "gauge"
	HistogramType = "histogram"
)

Variables

This section is empty.

Functions

func Init

func Init()

func Setup

func Setup()

Setup creates a new statsd client

func StopPeriodicStats

func StopPeriodicStats()

StopPeriodicStats stops periodic collection of stats.

Types

type HandleT

type HandleT struct{}

HandleT is the default implementation of Stats

func (*HandleT) NewSampledTaggedStat

func (s *HandleT) NewSampledTaggedStat(Name, StatType string, tags Tags) (rStats RudderStats)

func (*HandleT) NewStat

func (s *HandleT) NewStat(Name, StatType string) (rStats RudderStats)

NewStat creates a new RudderStats with provided Name and Type

func (*HandleT) NewTaggedStat

func (s *HandleT) NewTaggedStat(Name, StatType string, tags Tags) (rStats RudderStats)

type RudderStats

type RudderStats interface {
	Count(n int)
	Increment()

	Gauge(value interface{})

	Start()
	End()
	Observe(value float64)
	SendTiming(duration time.Duration)
	Since(start time.Time)
}

RudderStats provides functions to interact with StatsD stats

func NewTaggedStat

func NewTaggedStat(Name, StatType string, tags Tags) (rStats RudderStats)

type RudderStatsT

type RudderStatsT struct {
	Name     string
	StatType string
	Timing   statsd.Timing
	DestID   string
	Client   *statsd.Client
	// contains filtered or unexported fields
}

RudderStatsT is the default implementation of a StatsD stat

func (*RudderStatsT) Count

func (rStats *RudderStatsT) Count(n int)

func (*RudderStatsT) End

func (rStats *RudderStatsT) End()

End send the time elapsed since the Start() call of this stat. Only applies to TimerType stats Deprecated: Use concurrent safe SendTiming() instead

func (*RudderStatsT) Gauge

func (rStats *RudderStatsT) Gauge(value interface{})

Gauge records an absolute value for this stat. Only applies to GaugeType stats

func (*RudderStatsT) Increment

func (rStats *RudderStatsT) Increment()

Increment increases the stat by 1. Is the Equivalent of Count(1). Only applies to CountType stats

func (*RudderStatsT) Observe

func (rStats *RudderStatsT) Observe(value float64)

Timing sends a timing for this stat. Only applies to TimerType stats

func (*RudderStatsT) SendTiming

func (rStats *RudderStatsT) SendTiming(duration time.Duration)

Timing sends a timing for this stat. Only applies to TimerType stats

func (*RudderStatsT) Since

func (rStats *RudderStatsT) Since(start time.Time)

Since sends the time elapsed since duration start. Only applies to TimerType stats

func (*RudderStatsT) Start

func (rStats *RudderStatsT) Start()

type Stats

type Stats interface {
	NewStat(Name, StatType string) (rStats RudderStats)
	NewTaggedStat(Name, StatType string, tags Tags) RudderStats
	NewSampledTaggedStat(Name, StatType string, tags Tags) RudderStats
}

Stats manages provisioning of RudderStats

var DefaultStats Stats

DefaultStats is a common implementation of StatsD stats managements

type Tags

type Tags map[string]string

func CleanupTagsBasedOnDeploymentType

func CleanupTagsBasedOnDeploymentType(tags Tags, key string) Tags

func (Tags) String

func (t Tags) String() string

String returns all key value pairs as a single string, separated by commas, sorted by increasing key order

func (Tags) Strings

func (t Tags) Strings() []string

Strings returns all key value pairs as an ordered list of strings, sorted by increasing key order

Jump to

Keyboard shortcuts

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