package metrics
import "github.com/ydb-platform/ydb-go-sdk/v3/metrics"
Index ¶
- func DatabaseSQL(config Config) trace.DatabaseSQL
- func WithTraces(config Config) ydb.Option
- type Config
- type Counter
- type CounterVec
- type Gauge
- type GaugeVec
- type Histogram
- type HistogramVec
- type Registry
- type Timer
- type TimerVec
Examples ¶
Functions ¶
func DatabaseSQL ¶
func DatabaseSQL(config Config) trace.DatabaseSQL
DatabaseSQL makes trace.DatabaseSQL with measuring `database/sql` events
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
Code:
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
}
type Counter ¶
type Counter interface {
Inc()
}
Counter counts value
type CounterVec ¶
CounterVec returns Counter from CounterVec by labels
type Gauge ¶
Gauge tracks single float64 value.
type GaugeVec ¶
GaugeVec returns Gauge from GaugeVec by labels
type Histogram ¶
type Histogram interface {
Record(value float64)
}
Histogram tracks distribution of value.
type HistogramVec ¶
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 ¶
Timer tracks distribution of value.
type TimerVec ¶
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.115.0 (latest)
- Published
- Aug 17, 2025
- Platform
- linux/amd64
- Imports
- 13 packages
- Last checked
- 8 months ago –
Tools for package owners.