metric

package
v0.1.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeMetricLabelKeySafe

func MakeMetricLabelKeySafe(v string) string

MakeMetricLabelKeySafe makes a metric label key safe.

func MakeMetricLabelValueSafe

func MakeMetricLabelValueSafe(v string) string

MakeMetricLabelValueSafe makes a metric label value safe.

func MakeMetricType

func MakeMetricType(v string) string

MakeMetricType creates a metric type string.

Types

type APICounter

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

APICounter is the API counter type.

func (*APICounter) Count

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

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

CountAll records multiple metrics to the monitoring API.

type ConsoleCounter

type ConsoleCounter struct {
}

Counter is the interface for metric implementations.

func (*ConsoleCounter) Count

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

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 New

func New(project string) (Counter, error)

New creates new API counter instance.

func NewConsoleCounter added in v0.0.6

func NewConsoleCounter() Counter

NewConsoleCounter returns a new ConsoleCounter.

type Record

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

Record is the metric record type.

Jump to

Keyboard shortcuts

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