counter

package module
v1.51.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 1 Imported by: 3

Documentation

Overview

Package counter contains structs used to count telemetry grouped by resource and attributes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttributeCounter

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

AttributeCounter dimensions the counter by attributes.

func NewAttributeCounter

func NewAttributeCounter(values map[string]any) *AttributeCounter

NewAttributeCounter creates a new AttributeCounter.

func (*AttributeCounter) Add

func (a *AttributeCounter) Add()

Add increments the counter.

func (AttributeCounter) Count

func (a AttributeCounter) Count() int

Count returns the number of counts for this attribute counter.

func (AttributeCounter) Values

func (a AttributeCounter) Values() map[string]any

Values returns the attribute map that this counter tracks.

type ResourceCounter

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

ResourceCounter dimensions the counter by resource.

func NewResourceCounter

func NewResourceCounter(values map[string]any) *ResourceCounter

NewResourceCounter creates a new ResourceCounter.

func (*ResourceCounter) Add

func (r *ResourceCounter) Add(attributes map[string]any)

Add increments the counter with the supplied dimensions.

func (ResourceCounter) Attributes

func (r ResourceCounter) Attributes() map[string]*AttributeCounter

Attributes returns a map of attribute set ID to a counter for that attribute set.

func (ResourceCounter) Values

func (r ResourceCounter) Values() map[string]any

Values returns the raw map value of the resource that this counter counts.

type TelemetryCounter

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

TelemetryCounter tracks the number of times a set of resource and attribute dimensions have been seen.

func NewTelemetryCounter

func NewTelemetryCounter() *TelemetryCounter

NewTelemetryCounter creates a new TelemetryCounter.

func (*TelemetryCounter) Add

func (t *TelemetryCounter) Add(resource, attributes map[string]any)

Add increments the counter with the supplied dimensions.

func (*TelemetryCounter) Reset

func (t *TelemetryCounter) Reset()

Reset resets the counter.

func (TelemetryCounter) Resources

func (t TelemetryCounter) Resources() map[string]*ResourceCounter

Resources returns a map of resource ID to a counter for that resource.

Jump to

Keyboard shortcuts

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