metric

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: May 5, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseMetricCollector

type BaseMetricCollector struct {
	DatadogMetrics DatadogMetricsClient
}

BaseMetricCollector ...

func NewBaseMetricCollector

func NewBaseMetricCollector(dm *DatadogMetrics) *BaseMetricCollector

NewBaseMetricCollector instance

func (BaseMetricCollector) AddMetric

func (m BaseMetricCollector) AddMetric(ctx context.Context, d Data)

AddMetric related to name with given value

type Data

type Data struct {
	Name  MetricName
	Type  MetricType
	Value float64
	// MetricTags level empty if no categories required to relate metric
	MetricTags []MetricTag
}

Data for metrics

type DatadogMetrics

type DatadogMetrics struct {
	ServicePrefix      string
	DefaultMetricsTags []string
	// contains filtered or unexported fields
}

DatadogMetrics ready to use client to send statsd metrics

func NewDatadogMetrics

func NewDatadogMetrics(cfg config.DatadogParameters, orgPrefix string) (*DatadogMetrics, error)

NewDatadogMetrics instance required to have cfg config.DatadogParameters to get information about service and optional orgPrefix to append into for metric name

func (DatadogMetrics) GetClient

func (d DatadogMetrics) GetClient() statsd.ClientInterface

GetClient statsd client

func (DatadogMetrics) GetDefaultTags

func (d DatadogMetrics) GetDefaultTags() []string

GetDefaultTags that will be used in Datadog metrics

func (DatadogMetrics) GetServiceNamePrefix

func (d DatadogMetrics) GetServiceNamePrefix() string

GetServiceNamePrefix for metric name

type DatadogMetricsClient

type DatadogMetricsClient interface {
	// GetClient statsd client
	GetClient() statsd.ClientInterface
	// GetDefaultTags that will be used in Datadog metrics
	GetDefaultTags() []string
	// GetServiceNamePrefix for metric name
	GetServiceNamePrefix() string
}

type MetricName

type MetricName string

MetricName must be in specific format like cart.amount, request.my_request.x etc

type MetricTag

type MetricTag struct {
	MetricTagName  string
	MetricTagValue string
}

MetricTag categories metric value with MetricTagName for MetricTagValue to display category like PaymentID.

type MetricType

type MetricType byte
const (
	// MetricTypeCountEvents Datadog will aggregate events to show how many events happened in second
	MetricTypeCountEvents MetricType = iota
	// MetricTypeEvent send single event to Datadog
	MetricTypeEvent
	// MetricTypeMeasurement aggregates value of metrics in Datadog for measuring it, like memory or cart value
	MetricTypeMeasurement
)

Jump to

Keyboard shortcuts

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