metric

package
v2.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: MIT Imports: 7 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  Name
	Type  Type
	Value float64
	// MetricTags level empty if no categories required to relate metric
	MetricTags []Tag
}

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
}

DatadogMetricsClient ...

type Name

type Name string

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

type Tag

type Tag struct {
	Name  string
	Value string
}

Tag categories metric value with Name for Value to display category like PaymentID.

type Type

type Type byte

Type is an Enum type for metric types

const (
	// MetricTypeCountEvents Datadog will aggregate events to show how many events happened in second
	MetricTypeCountEvents Type = 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