metric

package
v0.9.46 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeMetricType added in v0.6.11

func MakeMetricType(v string) string

MakeMetricType creates a metric type string.

Types

type APICounter added in v0.6.11

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

APICounter is the API counter type.

func (*APICounter) Count added in v0.6.11

func (r *APICounter) Count(ctx context.Context, metricType string, count int64, labels map[string]string) error

Count records the metric to the monitoring API.

func (*APICounter) CountAll added in v0.6.11

func (r *APICounter) CountAll(ctx context.Context, records ...*Record) error

CountAll records multiple metrics to the monitoring API.

type ConsoleCounter added in v0.6.11

type ConsoleCounter struct {
}

Counter is the interface for metric implementations.

func (*ConsoleCounter) Count added in v0.6.11

func (r *ConsoleCounter) Count(ctx context.Context, metric string, count int64, labels map[string]string) error

Count records the metric to the console.

func (*ConsoleCounter) CountAll added in v0.6.11

func (r *ConsoleCounter) CountAll(ctx context.Context, records ...*Record) error

CountAll records multiple metrics to the console.

type Counter

type Counter interface {
	Count(ctx context.Context, metric string, count int64, labels map[string]string) error
	CountAll(ctx context.Context, records ...*Record) error
}

Counter is the interface for metric counter.

func NewAPICounter added in v0.6.11

func NewAPICounter(project string) (Counter, error)

NewAPICounter creates new API counter instance.

type Record added in v0.7.3

type Record struct {
	MetricType  string
	MetricValue int64
	Labels      map[string]string
}

Record is the metric record type.

type Recorder added in v0.7.4

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

Recorder is the metric recorder type.

func NewRecorder added in v0.7.4

func NewRecorder(client Counter, labels map[string]string) *Recorder

NewRecorder creates new recorder instance.

func (*Recorder) Add added in v0.7.4

func (r *Recorder) Add(ctx context.Context, name string, labels map[string]string) error

Add adds a metric record to the recorder.

func (*Recorder) Flush added in v0.7.4

func (r *Recorder) Flush(ctx context.Context) error

Flush flushes the recorder.

func (*Recorder) Size added in v0.7.4

func (r *Recorder) Size() int

Jump to

Keyboard shortcuts

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