Skip to content

Commit

Permalink
Merge branch 'master' into fix-tx
Browse files Browse the repository at this point in the history
  • Loading branch information
asmyasnikov authored Sep 13, 2024
2 parents fde609b + 200688b commit 1353925
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
* Added option `ydb.WithSessionPoolSessionIdleTimeToLive` for restrict idle time of query sessions
* Fixed bug with leak of query transactions
* Changed `ydb_go_sdk_ydb_driver_conn_requests` metrics splitted to `ydb_go_sdk_ydb_driver_conn_request_statuses` and `ydb_go_sdk_ydb_driver_conn_request_methods`
* Fixed metadata for operation service connection
* Fixed composing query traces in call `db.Query.Do[Tx]` using option `query.WithTrace`

Expand Down
11 changes: 8 additions & 3 deletions metrics/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ func driver(config Config) (t trace.Driver) {
balancerUpdates := config.WithSystem("balancer").CounterVec("updates", "cause")
conns := config.GaugeVec("conns", "endpoint", "node_id")
banned := config.WithSystem("conn").GaugeVec("banned", "endpoint", "node_id", "cause")
requests := config.WithSystem("conn").CounterVec("requests", "status", "method", "endpoint", "node_id")
requestStatuses := config.WithSystem("conn").CounterVec("request_statuses", "status", "endpoint", "node_id")
requestMethods := config.WithSystem("conn").CounterVec("request_methods", "method", "endpoint", "node_id")
tli := config.CounterVec("transaction_locks_invalidated")

type endpointKey struct {
Expand All @@ -35,8 +36,12 @@ func driver(config Config) (t trace.Driver) {

return func(info trace.DriverConnInvokeDoneInfo) {
if config.Details()&trace.DriverConnEvents != 0 {
requests.With(map[string]string{
requestStatuses.With(map[string]string{
"status": errorBrief(info.Error),
"endpoint": endpoint,
"node_id": strconv.FormatUint(uint64(nodeID), 10),
}).Inc()
requestMethods.With(map[string]string{
"method": string(method),
"endpoint": endpoint,
"node_id": strconv.FormatUint(uint64(nodeID), 10),
Expand All @@ -58,7 +63,7 @@ func driver(config Config) (t trace.Driver) {

return func(info trace.DriverConnNewStreamDoneInfo) {
if config.Details()&trace.DriverConnStreamEvents != 0 {
requests.With(map[string]string{
requestStatuses.With(map[string]string{
"status": errorBrief(info.Error),
"method": string(method),
"endpoint": endpoint,
Expand Down

0 comments on commit 1353925

Please sign in to comment.