stats

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDatadogAPIKey

func GetDatadogAPIKey(sess *session.Session, apiKeySSMParam string) (string, error)

GetDatadogAPIKey gets the Datadog API key from an AWS SSM parameter.

Types

type DatadogStatsClient

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

DatadogStatsClient is an implementation of StatsClient that sends stats to the Datadog API directly.

func NewDatadogStatsClient

func NewDatadogStatsClient(
	prefix string,
	baseTags []string,
	datadogHost string,
	apiKey string,
) *DatadogStatsClient

NewDatadogStatsClient creates a new DatadogStatsClient instance.

func (*DatadogStatsClient) Update

func (d *DatadogStatsClient) Update(
	names []string,
	values []float64,
	tags []string,
	statType StatType,
) error

Update sends the argument stat values to Datadog.

type FakeStatsClient

type FakeStatsClient struct {
	Stats map[string]float64
}

FakeStatsClient is a fake implementation of StatsClient for testing purposes.

func NewFakeStatsClient

func NewFakeStatsClient() *FakeStatsClient

NewFakeStatsClient returns a new FakeStatsClient instance.

func (*FakeStatsClient) Update

func (s *FakeStatsClient) Update(
	names []string,
	values []float64,
	tags []string,
	statType StatType,
) error

Update updates the given stats.

type NullStatsClient

type NullStatsClient struct {
}

NullStatsClient is a StatsClient implementation that does not export stats.

func (*NullStatsClient) Update

func (n *NullStatsClient) Update(
	names []string,
	values []float64,
	tags []string,
	statType StatType,
) error

Update updates the given stats.

type SegmentStatsClient

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

SegmentStatsClient is an implementation of StatsClient that wraps a Segment stats.Engine.

func NewSegmentStatsClient

func NewSegmentStatsClient(engine *stats.Engine) *SegmentStatsClient

NewSegmentStatsClient returns a new SegmentStatsClient instance.

func (*SegmentStatsClient) Update

func (s *SegmentStatsClient) Update(
	names []string,
	values []float64,
	tags []string,
	statType StatType,
) error

Update updates the argument stat values by calling the appropriate methods in the underlying stats engine.

type StatType

type StatType string

StatType is a string type that stores the type of stat being exported.

const (
	// StatTypeGauge represents the type of a guage stat.
	StatTypeGauge StatType = "gauge"

	// StatTypeCount represents the type of a count stat.
	StatTypeCount StatType = "count"
)

type StatsClient

type StatsClient interface {
	Update(names []string, values []float64, tags []string, statType StatType) error
}

StatsClient is an interface for exposing stats from kubeapply lambda runs.

Jump to

Keyboard shortcuts

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