stats

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

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

Variables

View Source
var DefaultConfigStats = ConfigStats{StatsEnabled: false, StatsdServerURL: "localhost:8125", InstanceID: "", Enabled: true, StatsCollectionInterval: 10, EnableCPUStats: true, EnableMemStats: true, EnableGCStats: true, StatsSamplingRate: 1, ConfigLog: logger.DefaultConfigLogger, ErrorFilePath: "/tmp/error_store.json", KubeNameSpace: ""}

Functions

func Setup

func Setup(configList ...interface{})

Setup creates a new statsd client

func StopRuntimeStats

func StopRuntimeStats()

StopRuntimeStats stops collection of runtime stats.

Types

type ConfigStats

type ConfigStats struct {
	StatsEnabled            bool
	StatsdServerURL         string
	InstanceID              string
	Enabled                 bool
	StatsCollectionInterval int
	EnableCPUStats          bool
	EnableGCStats           bool
	EnableMemStats          bool
	StatsSamplingRate       int
	ErrorFilePath           string
	KubeNameSpace           string
	ConfigLog               logger.ConfigLogger
}

type HandleT

type HandleT struct {
}

HandleT is the default implementation of Stats

func (*HandleT) NewSampledTaggedStat

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

func (*HandleT) NewStat

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

NewStat creates a new RudderStats with provided Name and Type

func (*HandleT) NewTaggedStat

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

type RudderStats

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

	Gauge(value interface{})

	Start()
	End()
	DeferredTimer()
	SendTiming(duration time.Duration)
}

RudderStats provides functions to interact with StatsD stats

func NewStat

func NewStat(Name string, StatType string) (rStats RudderStats)

NewStat creates a new RudderStats with provided Name and Type Deprecated: Use DefaultStats for managing stats instead

func NewTaggedStat

func NewTaggedStat(Name string, 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)

Count increases the stat by n. Only applies to CountType stats

func (*RudderStatsT) DeferredTimer

func (rStats *RudderStatsT) DeferredTimer()

func (*RudderStatsT) End

func (rStats *RudderStatsT) End()

End send the time elapsed since the Start() call of this stat. Only applies to TimerType stats

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) SendTiming

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

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

func (*RudderStatsT) Start

func (rStats *RudderStatsT) Start()

Start starts a new timing for this stat. Only applies to TimerType stats

type Stats

type Stats interface {
	NewStat(Name string, StatType string) (rStats RudderStats)
	NewTaggedStat(Name string, StatType string, tags Tags) RudderStats
	NewSampledTaggedStat(Name string, 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

Jump to

Keyboard shortcuts

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