metrics

package
v3.74.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: Apache-2.0 Imports: 12 Imported by: 4

README

metrics

Experimental package metrics contains adopter interfaces for monitoring system and common metrics of ydb-go-sdk

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithTraces

func WithTraces(config Config) ydb.Option

Types

type Config

type Config interface {
	Registry

	// Details returns bitmask for customize details of NewScope
	// If zero - use full set of driver NewScope
	Details() trace.Details

	// WithSystem returns new Config with subsystem scope
	// Separator for split scopes of NewScope provided Config implementation
	WithSystem(subsystem string) Config
}

Config is interface for metrics registry config

Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental

Example
var registryConfig metrics.Config // registryConfig is an implementation registry.Config
db, err := ydb.Open(
	context.TODO(),
	os.Getenv("YDB_CONNECTION_STRING"),
	metrics.WithTraces(registryConfig),
)
if err != nil {
	panic(err)
}
defer func() {
	_ = db.Close(context.TODO())
}()
// work with db
Output:

type Counter

type Counter interface {
	Inc()
}

Counter counts value

type CounterVec

type CounterVec interface {
	With(labels map[string]string) Counter
}

CounterVec returns Counter from CounterVec by labels

type Gauge

type Gauge interface {
	Add(delta float64)
	Set(value float64)
}

Gauge tracks single float64 value.

type GaugeVec

type GaugeVec interface {
	With(labels map[string]string) Gauge
}

GaugeVec returns Gauge from GaugeVec by labels

type Histogram

type Histogram interface {
	Record(value float64)
}

Histogram tracks distribution of value.

type HistogramVec

type HistogramVec interface {
	With(labels map[string]string) Histogram
}

HistogramVec stores multiple dynamically created timers

type Registry

type Registry interface {
	// CounterVec returns CounterVec by name, subsystem and labels
	// If counter by args already created - return counter from cache
	// If counter by args nothing - create and return newest counter
	CounterVec(name string, labelNames ...string) CounterVec

	// GaugeVec returns GaugeVec by name, subsystem and labels
	// If gauge by args already created - return gauge from cache
	// If gauge by args nothing - create and return newest gauge
	GaugeVec(name string, labelNames ...string) GaugeVec

	// TimerVec returns TimerVec by name, subsystem and labels
	// If timer by args already created - return timer from cache
	// If timer by args nothing - create and return newest timer
	TimerVec(name string, labelNames ...string) TimerVec

	// HistogramVec returns HistogramVec by name, subsystem and labels
	// If histogram by args already created - return histogram from cache
	// If histogram by args nothing - create and return newest histogram
	HistogramVec(name string, buckets []float64, labelNames ...string) HistogramVec
}

Registry is interface for metrics registry

Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental

type Timer

type Timer interface {
	Record(value time.Duration)
}

Timer tracks distribution of value.

type TimerVec

type TimerVec interface {
	With(labels map[string]string) Timer
}

TimerVec stores multiple dynamically created timers

Jump to

Keyboard shortcuts

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