metric_sender

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: Apache-2.0 Imports: 5 Imported by: 59

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerMetricChainer

type ContainerMetricChainer interface {
	SetTag(key, value string) ContainerMetricChainer
	Send() error
}

type CounterChainer

type CounterChainer interface {
	SetTag(key, value string) CounterChainer
	Increment() error
	Add(delta uint64) error
}

type EventEmitter

type EventEmitter interface {
	Emit(events.Event) error
	EmitEnvelope(*events.Envelope) error
	Origin() string
}

type MetricSender

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

A MetricSender emits metric events.

func NewMetricSender

func NewMetricSender(eventEmitter EventEmitter) *MetricSender

NewMetricSender instantiates a MetricSender with the given EventEmitter.

func (*MetricSender) AddToCounter

func (ms *MetricSender) AddToCounter(name string, delta uint64) error

AddToCounter sends an event to increment the named counter by the specified (positive) delta. Maintaining the value of the counter is the responsibility of the receiver, as with IncrementCounter.

func (*MetricSender) ContainerMetric

func (ms *MetricSender) ContainerMetric(appID string, instance int32, cpu float64, mem, disk uint64) ContainerMetricChainer

ContainerMetric creates a container metric that can be manipulated via cascading calls and then sent.

func (*MetricSender) Counter

func (ms *MetricSender) Counter(name string) CounterChainer

Counter creates a counter event that can be manipulated via cascading calls and then sent via Increment or Add.

func (*MetricSender) IncrementCounter

func (ms *MetricSender) IncrementCounter(name string) error

IncrementCounter sends an event to increment the named counter by one. Maintaining the value of the counter is the responsibility of the receiver of the event, not the process that includes this package.

func (*MetricSender) Send

func (ms *MetricSender) Send(ev events.Event) error

Send sends an events.Event.

func (*MetricSender) SendContainerMetric

func (ms *MetricSender) SendContainerMetric(applicationId string, instanceIndex int32, cpuPercentage float64, memoryBytes uint64, diskBytes uint64) error

SendContainerMetric sends a metric that records resource usage of an app in a container. The container is identified by the applicationId and the instanceIndex. The resource metrics are CPU percentage, memory and disk usage in bytes. Returns an error if one occurs when sending the metric.

func (*MetricSender) SendValue

func (ms *MetricSender) SendValue(name string, value float64, unit string) error

SendValue sends a metric with the given name, value and unit. See http://metrics20.org/spec/#units for a specification of acceptable units. Returns an error if one occurs while sending the event.

func (*MetricSender) Value

func (ms *MetricSender) Value(name string, value float64, unit string) ValueChainer

Value creates a value metric that can be manipulated via cascading calls and then sent.

type ValueChainer

type ValueChainer interface {
	SetTag(key, value string) ValueChainer
	Send() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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