From 0f4bbeb382d51c1c5eda875ed76a116d51ea33bd Mon Sep 17 00:00:00 2001 From: Roman Golov Date: Mon, 30 Sep 2024 18:29:01 +0300 Subject: [PATCH] Fix tracing details check for some metrics --- CHANGELOG.md | 2 ++ metrics/driver.go | 10 ++++++---- metrics/table.go | 16 ++++++++++------ 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb17f451f..2d3413934 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +* Fixed tracing details check for some metrics + ## v3.81.2 * Removed `experimantal` comment for query service client diff --git a/metrics/driver.go b/metrics/driver.go index 50d56092d..718fa2d02 100644 --- a/metrics/driver.go +++ b/metrics/driver.go @@ -95,10 +95,12 @@ func driver(config Config) (t trace.Driver) { eventType := repeater.EventType(*info.Context) return func(info trace.DriverBalancerClusterDiscoveryAttemptDoneInfo) { - balancersDiscoveries.With(map[string]string{ - "status": errorBrief(info.Error), - "cause": eventType, - }).Inc() + if config.Details()&trace.DriverBalancerEvents != 0 { + balancersDiscoveries.With(map[string]string{ + "status": errorBrief(info.Error), + "cause": eventType, + }).Inc() + } } } t.OnBalancerUpdate = func(info trace.DriverBalancerUpdateStartInfo) func(trace.DriverBalancerUpdateDoneInfo) { diff --git a/metrics/table.go b/metrics/table.go index 721ee2bc0..7698df89f 100644 --- a/metrics/table.go +++ b/metrics/table.go @@ -22,7 +22,9 @@ func table(config Config) (t trace.Table) { with := config.GaugeVec("with") t.OnInit = func(info trace.TableInitStartInfo) func(trace.TableInitDoneInfo) { return func(info trace.TableInitDoneInfo) { - limit.With(nil).Set(float64(info.Limit)) + if config.Details()&trace.TableEvents != 0 { + limit.With(nil).Set(float64(info.Limit)) + } } } t.OnSessionNew = func(info trace.TableSessionNewStartInfo) func(trace.TableSessionNewDoneInfo) { @@ -69,11 +71,13 @@ func table(config Config) (t trace.Table) { return nil } t.OnPoolStateChange = func(info trace.TablePoolStateChangeInfo) { - limit.With(nil).Set(float64(info.Limit)) - index.With(nil).Set(float64(info.Index)) - idle.With(nil).Set(float64(info.Idle)) - wait.With(nil).Set(float64(info.Wait)) - createInProgress.With(nil).Set(float64(info.CreateInProgress)) + if config.Details()&trace.TablePoolEvents != 0 { + limit.With(nil).Set(float64(info.Limit)) + index.With(nil).Set(float64(info.Index)) + idle.With(nil).Set(float64(info.Idle)) + wait.With(nil).Set(float64(info.Wait)) + createInProgress.With(nil).Set(float64(info.CreateInProgress)) + } } { latency := session.WithSystem("query").TimerVec("latency")