metrics

package
v0.0.0-...-967d409 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 6 Imported by: 8

Documentation

Index

Constants

View Source
const (
	IntType    = "int"
	DoubleType = "double"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Definition

type Definition struct {
	Name string
	Type string
}

Definition describes a single reportable metric's name and type.

func (*Definition) Validate

func (m *Definition) Validate() error

type MetricReport

type MetricReport struct {
	Name      string            `json:"name"`
	StartTime time.Time         `json:"startTime"`
	EndTime   time.Time         `json:"endTime"`
	Labels    map[string]string `json:"labels"`
	Value     MetricValue       `json:"value"`
}

MetricReport represents an aggregated interval for a unique metric + labels combination.

func (MetricReport) Copy

func (mr MetricReport) Copy() MetricReport

Copy returns a deep copy of the MetricReport

func (MetricReport) Equal

func (mr MetricReport) Equal(other MetricReport) bool

Equal returns if the two MetricReports are the same.

func (MetricReport) Validate

func (mr MetricReport) Validate(def Definition) error

Validate returns an error if the report does not match its definition.

type MetricValue

type MetricValue struct {
	Int64Value  *int64   `json:"int64Value,omitempty"`
	DoubleValue *float64 `json:"doubleValue,omitempty"`
}

MetricValue holds a single named metric value. Only one of the individual type fields should be non-nil.

func (MetricValue) Validate

func (mv MetricValue) Validate(def Definition) error

Validate returns an error if the metric value does not match its definition.

type StampedMetricReport

type StampedMetricReport struct {
	MetricReport `json:",inline"`
	Id           string
}

StampedMetricReport is a MetricReport stamped with a unique identifier.

func NewStampedMetricReport

func NewStampedMetricReport(report MetricReport) StampedMetricReport

NewStampedMetricReport creates a new StampedMetricReport with a random, unique identifier.

func (StampedMetricReport) Equal

func (smr StampedMetricReport) Equal(other StampedMetricReport) bool

Equal returns if the two StampedMetricReports are the same.

Jump to

Keyboard shortcuts

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