Skip to content

Commit

Permalink
Fix tracing details check for some metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Golov committed Sep 30, 2024
1 parent 607e86f commit 0f4bbeb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
* Fixed tracing details check for some metrics

## v3.81.2
* Removed `experimantal` comment for query service client

Expand Down
10 changes: 6 additions & 4 deletions metrics/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
16 changes: 10 additions & 6 deletions metrics/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 0f4bbeb

Please sign in to comment.