package metrics

import "github.com/ydb-platform/ydb-go-sdk/v3/metrics"

Index

Examples

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

Code:

{
	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
}

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

Source Files

config.go coordination.go counter.go discovery.go driver.go error_brief.go gauge.go histogram.go node_id.go query.go ratelimiter.go registry.go retry.go scheme.go scripting.go sql.go table.go timer.go traces.go

Version
v3.75.2
Published
Jul 17, 2024
Platform
linux/amd64
Imports
12 packages
Last checked
1 hour ago

Tools for package owners.