diff --git a/CHANGELOG.md b/CHANGELOG.md index bfefa12af..572b7de27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +* Renamed `{retry,table}.WithID` option to `{retry,table}.WithLabel` * Added `ydb.WithTraceRetry` option * Moved `internal/allocator.Buffers` to package `internal/xstring` * Bumped `golang.org/x/sync` to `v0.3.0` diff --git a/examples/go.mod b/examples/go.mod index 1984047c3..bd32f8714 100644 --- a/examples/go.mod +++ b/examples/go.mod @@ -6,10 +6,8 @@ require ( github.com/google/uuid v1.3.0 github.com/gorilla/mux v1.8.0 github.com/lib/pq v1.10.2 - github.com/prometheus/client_golang v1.13.0 github.com/ydb-platform/gorm-driver v0.0.5 github.com/ydb-platform/ydb-go-sdk-auth-environ v0.1.2 - github.com/ydb-platform/ydb-go-sdk-prometheus v0.11.10 github.com/ydb-platform/ydb-go-sdk/v3 v3.47.3 github.com/ydb-platform/ydb-go-yc v0.10.1 google.golang.org/genproto v0.0.0-20230526161137-0005af68ea54 @@ -23,8 +21,6 @@ require ( require ( cloud.google.com/go/firestore v1.9.0 // indirect - github.com/beorn7/perks v1.0.1 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/goccy/go-json v0.9.11 // indirect github.com/golang-jwt/jwt v3.2.2+incompatible // indirect github.com/golang-jwt/jwt/v4 v4.4.3 // indirect @@ -40,17 +36,12 @@ require ( github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/mattn/go-isatty v0.0.16 // indirect github.com/mattn/go-sqlite3 v1.14.15 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/prometheus/client_model v0.3.0 // indirect - github.com/prometheus/common v0.37.0 // indirect - github.com/prometheus/procfs v0.8.0 // indirect github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect github.com/syndtr/goleveldb v1.0.0 // indirect github.com/yandex-cloud/go-genproto v0.0.0-20220815090733-4c139c0154e2 // indirect github.com/ydb-platform/ydb-go-genproto v0.0.0-20231012155159-f85a672542fd // indirect - github.com/ydb-platform/ydb-go-sdk-metrics v0.16.3 // indirect github.com/ydb-platform/ydb-go-yc-metadata v0.5.4 // indirect golang.org/x/crypto v0.13.0 // indirect golang.org/x/mod v0.9.0 // indirect @@ -63,6 +54,7 @@ require ( google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect google.golang.org/grpc v1.57.1 // indirect google.golang.org/protobuf v1.31.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect lukechampine.com/uint128 v1.2.0 // indirect modernc.org/cc/v3 v3.36.3 // indirect modernc.org/ccgo/v3 v3.16.9 // indirect diff --git a/examples/go.sum b/examples/go.sum index b804b0da3..502b92c1a 100644 --- a/examples/go.sum +++ b/examples/go.sum @@ -617,7 +617,6 @@ github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuy github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apache/arrow/go/v10 v10.0.1/go.mod h1:YvhnlEePVnBS4+0z3fhPfUy7W1Ikj0Ih0vcRo/gZ1M0= @@ -634,7 +633,6 @@ github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= @@ -646,8 +644,6 @@ github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= @@ -725,14 +721,11 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2 github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= -github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-latex/latex v0.0.0-20210118124228-b3d85cf34e07/go.mod h1:CO1AlKB2CSIqUrmQPqA0gdRIlnLEY0gK5JGjh37zN5U= github.com/go-latex/latex v0.0.0-20210823091927-c0d11ff05a81/go.mod h1:SX0U8uGpxhq9o2S/CELCSUxEWWAuoCUcVCQWv7G2OCk= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-pdf/fpdf v0.5.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M= github.com/go-pdf/fpdf v0.6.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= @@ -962,19 +955,15 @@ github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22 github.com/jonboulle/clockwork v0.3.0/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= github.com/jonboulle/clockwork v0.4.0 h1:p4Cf1aMWXnXAUh8lVfewRBx1zaTSYKrKMF2g3ST4RZ4= github.com/jonboulle/clockwork v0.4.0/go.mod h1:xgRqUGwRcjKCO1vbZUEtSLrqKoPSsUpK7fnezOII0kc= -github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/jung-kurt/gofpdf v1.0.0/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= @@ -986,7 +975,6 @@ github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHU github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -1026,7 +1014,6 @@ github.com/mattn/go-sqlite3 v1.14.9/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A github.com/mattn/go-sqlite3 v1.14.14/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/mattn/go-sqlite3 v1.14.15 h1:vfoHhTN1af61xCRSWzFIWzx2YskyMTwHLrExkBOjvxI= github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= -github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8/go.mod h1:mC1jAcsrzbxHt8iiaC+zU4b1ylILSosueou12R++wfY= @@ -1046,7 +1033,6 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= @@ -1095,37 +1081,20 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= -github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.13.0 h1:b71QUfeo5M8gq2+evJdTPfZhYMAU0uKPkyPJ7TPsloU= -github.com/prometheus/client_golang v1.13.0/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= -github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE= -github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= -github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= -github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rekby/fixenv v0.3.2/go.mod h1:/b5LRc06BYJtslRtHKxsPWFT/ySpHV+rWvzTg+XWk4c= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk= @@ -1152,7 +1121,6 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeV github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= @@ -1199,10 +1167,6 @@ github.com/ydb-platform/ydb-go-genproto v0.0.0-20231012155159-f85a672542fd h1:dz github.com/ydb-platform/ydb-go-genproto v0.0.0-20231012155159-f85a672542fd/go.mod h1:Er+FePu1dNUieD+XTMDduGpQuCPssK5Q4BjF+IIXJ3I= github.com/ydb-platform/ydb-go-sdk-auth-environ v0.1.2 h1:EYSI1kulnHb0H0zt3yOw4cRj4ABMSMGwNe43D+fX7e4= github.com/ydb-platform/ydb-go-sdk-auth-environ v0.1.2/go.mod h1:Xfjce+VMU9yJVr1lj60yK2fFPWjB4jr/4cp3K7cjzi4= -github.com/ydb-platform/ydb-go-sdk-metrics v0.16.3 h1:30D5jErLAiGjchVG2D9JiCLbST5LpAiyS7DoUtHkWsU= -github.com/ydb-platform/ydb-go-sdk-metrics v0.16.3/go.mod h1:bqOjIBSt5LtA8fcTprRPGLvlQGkNlqBSRqnL+yZUJh4= -github.com/ydb-platform/ydb-go-sdk-prometheus v0.11.10 h1:eXRJ8nKGv5Dyz7qTDFraahyqlSmOf1/8JqUtlxGlA4o= -github.com/ydb-platform/ydb-go-sdk-prometheus v0.11.10/go.mod h1:7OffPa+OmsJgIP5G+2Cg5oP9+xB5UJSLm5AUpLxi5Uc= github.com/ydb-platform/ydb-go-yc v0.8.3/go.mod h1:zUolAFGzJ5XG8uwiseTLr9Lapm7L7hdVdZgLSuv9FXE= github.com/ydb-platform/ydb-go-yc v0.10.1 h1:9SBUpR94tzasEzqYSbBuuEp9mY/jV6xbwPMy3muvV7U= github.com/ydb-platform/ydb-go-yc v0.10.1/go.mod h1:9HaZmOHUWy2MpJ4GZw9j9gR2I82/kb6H8fjsu8b2lxQ= @@ -1370,7 +1334,6 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= @@ -1469,7 +1432,6 @@ golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1483,8 +1445,6 @@ golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1493,7 +1453,6 @@ golang.org/x/sys v0.0.0-20201126233918-771906719818/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210304124612-50617c2ba197/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1505,7 +1464,6 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1520,7 +1478,6 @@ golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1947,7 +1904,6 @@ google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= @@ -1963,9 +1919,6 @@ gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bl gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/examples/serverless/url_shortener/service.go b/examples/serverless/url_shortener/service.go index 892970c92..4a484628b 100644 --- a/examples/serverless/url_shortener/service.go +++ b/examples/serverless/url_shortener/service.go @@ -15,21 +15,15 @@ import ( "strings" "sync" "text/template" - "time" "github.com/gorilla/mux" - "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promhttp" environ "github.com/ydb-platform/ydb-go-sdk-auth-environ" - ydbMetrics "github.com/ydb-platform/ydb-go-sdk-prometheus" - ydb "github.com/ydb-platform/ydb-go-sdk/v3" "github.com/ydb-platform/ydb-go-sdk/v3/table" "github.com/ydb-platform/ydb-go-sdk/v3/table/options" "github.com/ydb-platform/ydb-go-sdk/v3/table/result" "github.com/ydb-platform/ydb-go-sdk/v3/table/result/named" "github.com/ydb-platform/ydb-go-sdk/v3/table/types" - "github.com/ydb-platform/ydb-go-sdk/v3/trace" ) //go:embed static/index.html @@ -71,76 +65,16 @@ type templateConfig struct { } type service struct { - db *ydb.Driver - registry *prometheus.Registry - router *mux.Router - - calls *prometheus.GaugeVec - callsLatency *prometheus.HistogramVec - callsErrors *prometheus.GaugeVec + db *ydb.Driver + router *mux.Router } var once sync.Once func getService(ctx context.Context, dsn string, opts ...ydb.Option) (s *service, err error) { once.Do(func() { - var ( - registry = prometheus.NewRegistry() - calls = prometheus.NewGaugeVec(prometheus.GaugeOpts{ - Namespace: "app", - Name: "calls", - }, []string{ - "method", - "success", - }) - callsLatency = prometheus.NewHistogramVec(prometheus.HistogramOpts{ - Namespace: "app", - Name: "latency", - Buckets: []float64{ - (1 * time.Millisecond).Seconds(), - (5 * time.Millisecond).Seconds(), - (10 * time.Millisecond).Seconds(), - (50 * time.Millisecond).Seconds(), - (100 * time.Millisecond).Seconds(), - (500 * time.Millisecond).Seconds(), - (1000 * time.Millisecond).Seconds(), - (5000 * time.Millisecond).Seconds(), - (10000 * time.Millisecond).Seconds(), - }, - }, []string{ - "success", - "method", - }) - callsErrors = prometheus.NewGaugeVec(prometheus.GaugeOpts{ - Namespace: "app", - Name: "errors", - }, []string{ - "method", - }) - ) - - registry.MustRegister(calls) - registry.MustRegister(callsLatency) - registry.MustRegister(callsErrors) - - opts = append( - opts, - ydbMetrics.WithTraces( - registry, - ydbMetrics.WithSeparator("_"), - ydbMetrics.WithDetails( - trace.DetailsAll, - ), - ), - ) - s = &service{ - registry: registry, - router: mux.NewRouter(), - - calls: calls, - callsLatency: callsLatency, - callsErrors: callsErrors, + router: mux.NewRouter(), } s.db, err = ydb.Open(ctx, dsn, opts...) @@ -149,9 +83,6 @@ func getService(ctx context.Context, dsn string, opts ...ydb.Option) (s *service return } - s.router.Handle("/metrics", promhttp.InstrumentMetricHandler( - registry, promhttp.HandlerFor(registry, promhttp.HandlerOpts{}), - )) s.router.HandleFunc("/", s.handleIndex).Methods(http.MethodGet) s.router.HandleFunc("/shorten", s.handleShorten).Methods(http.MethodPost) s.router.HandleFunc("/{[0-9a-fA-F]{8}}", s.handleLonger).Methods(http.MethodGet) @@ -299,34 +230,11 @@ func writeResponse(w http.ResponseWriter, statusCode int, body string) { _, _ = w.Write([]byte(body)) } -func successToString(b bool) string { - if b { - return "true" - } - return "false" -} - func (s *service) handleIndex(w http.ResponseWriter, r *http.Request) { var ( - err error - tpl *template.Template - start = time.Now() + err error + tpl *template.Template ) - defer func() { - if err != nil { - s.callsErrors.With(prometheus.Labels{ - "method": "index", - }).Add(1) - } - s.callsLatency.With(prometheus.Labels{ - "method": "index", - "success": successToString(err == nil), - }).Observe(time.Since(start).Seconds()) - s.calls.With(prometheus.Labels{ - "method": "index", - "success": successToString(err == nil), - }).Add(1) - }() tpl, err = template.ParseFS(static, "static/index.html") if err != nil { writeResponse(w, http.StatusInternalServerError, err.Error()) @@ -345,26 +253,10 @@ func (s *service) handleIndex(w http.ResponseWriter, r *http.Request) { func (s *service) handleShorten(w http.ResponseWriter, r *http.Request) { var ( - err error - url []byte - hash string - start = time.Now() + err error + url []byte + hash string ) - defer func() { - if err != nil { - s.callsErrors.With(prometheus.Labels{ - "method": "shorten", - }).Add(1) - } - s.callsLatency.With(prometheus.Labels{ - "method": "shorten", - "success": successToString(err == nil), - }).Observe(time.Since(start).Seconds()) - s.calls.With(prometheus.Labels{ - "method": "index", - "success": successToString(err == nil), - }).Add(1) - }() url, err = io.ReadAll(r.Body) if err != nil { writeResponse(w, http.StatusInternalServerError, err.Error()) @@ -386,25 +278,9 @@ func (s *service) handleShorten(w http.ResponseWriter, r *http.Request) { func (s *service) handleLonger(w http.ResponseWriter, r *http.Request) { var ( - err error - url string - start = time.Now() + err error + url string ) - defer func() { - if err != nil { - s.callsErrors.With(prometheus.Labels{ - "method": "longer", - }).Add(1) - } - s.callsLatency.With(prometheus.Labels{ - "method": "longer", - "success": successToString(err == nil), - }).Observe(time.Since(start).Seconds()) - s.calls.With(prometheus.Labels{ - "method": "index", - "success": successToString(err == nil), - }).Add(1) - }() path := strings.Split(r.URL.Path, "/") if !isShortCorrect(path[len(path)-1]) { err = fmt.Errorf("'%s' is not a valid short path", path[len(path)-1]) diff --git a/internal/table/retry.go b/internal/table/retry.go index 7bd6d79a9..b1b276100 100644 --- a/internal/table/retry.go +++ b/internal/table/retry.go @@ -49,7 +49,7 @@ func doTx( attempts, onIntermediate := 0, trace.TableOnDoTx( opts.Trace, &ctx, - opts.ID, + opts.Label, opts.Idempotent, isRetryCalledAbove(ctx), ) @@ -119,7 +119,7 @@ func do( if opts.Trace == nil { opts.Trace = &trace.Table{} } - attempts, onIntermediate := 0, trace.TableOnDo(opts.Trace, &ctx, opts.ID, opts.Idempotent, isRetryCalledAbove(ctx)) + attempts, onIntermediate := 0, trace.TableOnDo(opts.Trace, &ctx, opts.Label, opts.Idempotent, isRetryCalledAbove(ctx)) defer func() { onIntermediate(err)(attempts, err) }() diff --git a/log/retry.go b/log/retry.go index e7ec38f19..4f0c582b6 100644 --- a/log/retry.go +++ b/log/retry.go @@ -25,17 +25,17 @@ func internalRetry(l *wrapper, d trace.Detailer) (t trace.Retry) { return nil } ctx := with(*info.Context, TRACE, "ydb", "retry") - id := info.ID + label := info.Label idempotent := info.Idempotent l.Log(ctx, "start", - String("id", id), + String("label", label), Bool("idempotent", idempotent), ) start := time.Now() return func(info trace.RetryLoopIntermediateInfo) func(trace.RetryLoopDoneInfo) { if info.Error == nil { l.Log(ctx, "attempt done", - String("id", id), + String("label", label), latencyField(start), ) } else { @@ -46,7 +46,7 @@ func internalRetry(l *wrapper, d trace.Detailer) (t trace.Retry) { m := retry.Check(info.Error) l.Log(WithLevel(ctx, lvl), "attempt failed", Error(info.Error), - String("id", id), + String("label", label), latencyField(start), Bool("retryable", m.MustRetry(idempotent)), Int64("code", m.StatusCode()), @@ -57,7 +57,7 @@ func internalRetry(l *wrapper, d trace.Detailer) (t trace.Retry) { return func(info trace.RetryLoopDoneInfo) { if info.Error == nil { l.Log(ctx, "done", - String("id", id), + String("label", label), latencyField(start), Int("attempts", info.Attempts), ) @@ -69,7 +69,7 @@ func internalRetry(l *wrapper, d trace.Detailer) (t trace.Retry) { m := retry.Check(info.Error) l.Log(WithLevel(ctx, lvl), "failed", Error(info.Error), - String("id", id), + String("label", label), latencyField(start), Int("attempts", info.Attempts), Bool("retryable", m.MustRetry(idempotent)), diff --git a/log/table.go b/log/table.go index 9e70d5183..0570dcbf1 100644 --- a/log/table.go +++ b/log/table.go @@ -28,8 +28,10 @@ func internalTable(l *wrapper, d trace.Detailer) (t trace.Table) { } ctx := with(*info.Context, TRACE, "ydb", "table", "do") idempotent := info.Idempotent + label := info.Label l.Log(ctx, "start", Bool("idempotent", idempotent), + String("label", label), ) start := time.Now() return func(info trace.TableDoIntermediateInfo) func(trace.TableDoDoneInfo) { @@ -37,6 +39,7 @@ func internalTable(l *wrapper, d trace.Detailer) (t trace.Table) { l.Log(ctx, "done", latencyField(start), Bool("idempotent", idempotent), + String("label", label), ) } else { lvl := WARN @@ -47,6 +50,7 @@ func internalTable(l *wrapper, d trace.Detailer) (t trace.Table) { l.Log(WithLevel(ctx, lvl), "failed", latencyField(start), Bool("idempotent", idempotent), + String("label", label), Error(info.Error), Bool("retryable", m.MustRetry(idempotent)), Int64("code", m.StatusCode()), @@ -59,6 +63,7 @@ func internalTable(l *wrapper, d trace.Detailer) (t trace.Table) { l.Log(ctx, "done", latencyField(start), Bool("idempotent", idempotent), + String("label", label), Int("attempts", info.Attempts), ) } else { @@ -70,6 +75,7 @@ func internalTable(l *wrapper, d trace.Detailer) (t trace.Table) { l.Log(WithLevel(ctx, lvl), "done", latencyField(start), Bool("idempotent", idempotent), + String("label", label), Int("attempts", info.Attempts), Error(info.Error), Bool("retryable", m.MustRetry(idempotent)), @@ -93,8 +99,10 @@ func internalTable(l *wrapper, d trace.Detailer) (t trace.Table) { } ctx := with(*info.Context, TRACE, "ydb", "table", "do", "tx") idempotent := info.Idempotent + label := info.Label l.Log(ctx, "start", Bool("idempotent", idempotent), + String("label", label), ) start := time.Now() return func(info trace.TableDoTxIntermediateInfo) func(trace.TableDoTxDoneInfo) { @@ -102,6 +110,7 @@ func internalTable(l *wrapper, d trace.Detailer) (t trace.Table) { l.Log(ctx, "done", latencyField(start), Bool("idempotent", idempotent), + String("label", label), ) } else { lvl := ERROR @@ -112,6 +121,7 @@ func internalTable(l *wrapper, d trace.Detailer) (t trace.Table) { l.Log(WithLevel(ctx, lvl), "done", latencyField(start), Bool("idempotent", idempotent), + String("label", label), Error(info.Error), Bool("retryable", m.MustRetry(idempotent)), Int64("code", m.StatusCode()), @@ -124,6 +134,7 @@ func internalTable(l *wrapper, d trace.Detailer) (t trace.Table) { l.Log(ctx, "done", latencyField(start), Bool("idempotent", idempotent), + String("label", label), Int("attempts", info.Attempts), ) } else { @@ -135,6 +146,7 @@ func internalTable(l *wrapper, d trace.Detailer) (t trace.Table) { l.Log(WithLevel(ctx, lvl), "done", latencyField(start), Bool("idempotent", idempotent), + String("label", label), Int("attempts", info.Attempts), Error(info.Error), Bool("retryable", m.MustRetry(idempotent)), diff --git a/metrics/table.go b/metrics/table.go index 961bcabcf..01c2dd9f2 100644 --- a/metrics/table.go +++ b/metrics/table.go @@ -36,14 +36,14 @@ func table(config Config) (t trace.Table) { trace.TableDoDoneInfo, ) { var ( - name = info.ID + label = info.Label start = time.Now() ) return func(info trace.TableDoIntermediateInfo) func(trace.TableDoDoneInfo) { if info.Error != nil && config.Details()&trace.TableEvents != 0 { doIntermediateErrors.With(map[string]string{ "status": errorBrief(info.Error), - "name": name, + "label": label, }).Inc() } return func(info trace.TableDoDoneInfo) { @@ -51,11 +51,11 @@ func table(config Config) (t trace.Table) { doAttempts.With(nil).Record(float64(info.Attempts)) doErrors.With(map[string]string{ "status": errorBrief(info.Error), - "name": name, + "label": label, }).Inc() doLatency.With(map[string]string{ "status": errorBrief(info.Error), - "name": name, + "label": label, }).Record(time.Since(start)) } } @@ -67,14 +67,14 @@ func table(config Config) (t trace.Table) { trace.TableDoTxDoneInfo, ) { var ( - name = info.ID + label = info.Label start = time.Now() ) return func(info trace.TableDoTxIntermediateInfo) func(trace.TableDoTxDoneInfo) { if info.Error != nil && config.Details()&trace.TableEvents != 0 { doTxIntermediateErrors.With(map[string]string{ "status": errorBrief(info.Error), - "name": name, + "label": label, }).Inc() } return func(info trace.TableDoTxDoneInfo) { @@ -82,11 +82,11 @@ func table(config Config) (t trace.Table) { doTxAttempts.With(nil).Record(float64(info.Attempts)) doTxErrors.With(map[string]string{ "status": errorBrief(info.Error), - "name": name, + "label": label, }).Inc() doTxLatency.With(map[string]string{ "status": errorBrief(info.Error), - "name": name, + "label": label, }).Record(time.Since(start)) } } diff --git a/retry/retry.go b/retry/retry.go index 2cada7b09..23644f732 100644 --- a/retry/retry.go +++ b/retry/retry.go @@ -17,7 +17,7 @@ import ( type retryOperation func(context.Context) (err error) type retryOptions struct { - id string + label string trace *trace.Retry idempotent bool stackTrace bool @@ -31,25 +31,25 @@ type Option interface { ApplyRetryOption(opts *retryOptions) } -var _ Option = idOption("") +var _ Option = labelOption("") -type idOption string +type labelOption string -func (id idOption) ApplyDoOption(opts *doOptions) { - opts.retryOptions = append(opts.retryOptions, WithID(string(id))) +func (label labelOption) ApplyDoOption(opts *doOptions) { + opts.retryOptions = append(opts.retryOptions, WithLabel(string(label))) } -func (id idOption) ApplyDoTxOption(opts *doTxOptions) { - opts.retryOptions = append(opts.retryOptions, WithID(string(id))) +func (label labelOption) ApplyDoTxOption(opts *doTxOptions) { + opts.retryOptions = append(opts.retryOptions, WithLabel(string(label))) } -func (id idOption) ApplyRetryOption(opts *retryOptions) { - opts.id = string(id) +func (label labelOption) ApplyRetryOption(opts *retryOptions) { + opts.label = string(label) } -// WithID applies id for identification call Retry in trace.Retry.OnRetry -func WithID(id string) idOption { - return idOption(id) +// WithLabel applies label for identification call Retry in trace.Retry.OnRetry +func WithLabel(label string) labelOption { + return labelOption(label) } var _ Option = stackTraceOption{} @@ -241,7 +241,7 @@ func Retry(ctx context.Context, op retryOperation, opts ...Option) (err error) { attempts int code = int64(0) - onIntermediate = trace.RetryOnRetry(options.trace, &ctx, options.id, options.idempotent, isRetryCalledAbove(ctx)) + onIntermediate = trace.RetryOnRetry(options.trace, &ctx, options.label, options.idempotent, isRetryCalledAbove(ctx)) ) defer func() { onIntermediate(err)(attempts, err) diff --git a/retry/sql.go b/retry/sql.go index 8df0ad1cd..f921755e4 100644 --- a/retry/sql.go +++ b/retry/sql.go @@ -20,7 +20,7 @@ type doOption interface { var ( _ doOption = doRetryOptionsOption(nil) - _ doOption = idOption("") + _ doOption = labelOption("") ) type doRetryOptionsOption []Option diff --git a/table/table.go b/table/table.go index 171b3b5e6..953f557e9 100644 --- a/table/table.go +++ b/table/table.go @@ -560,7 +560,7 @@ func ValueParam(name string, v types.Value) ParameterOption { } type Options struct { - ID string + Label string Idempotent bool TxSettings *TransactionSettings TxCommitOptions []options.CommitTransactionOption @@ -572,17 +572,17 @@ type Option interface { ApplyTableOption(opts *Options) } -var _ Option = idOption("") +var _ Option = labelOption("") -type idOption string +type labelOption string -func (id idOption) ApplyTableOption(opts *Options) { - opts.ID = string(id) - opts.RetryOptions = append(opts.RetryOptions, retry.WithID(string(id))) +func (label labelOption) ApplyTableOption(opts *Options) { + opts.Label = string(label) + opts.RetryOptions = append(opts.RetryOptions, retry.WithLabel(string(label))) } -func WithID(id string) idOption { - return idOption(id) +func WithLabel(label string) labelOption { + return labelOption(label) } var _ Option = retryOptionsOption{} diff --git a/tests/integration/with_trace_retry_test.go b/tests/integration/with_trace_retry_test.go index 0d27ecf06..42bc1958b 100644 --- a/tests/integration/with_trace_retry_test.go +++ b/tests/integration/with_trace_retry_test.go @@ -29,7 +29,7 @@ func TestWithTraceRetry(t *testing.T) { OnRetry: func( info trace.RetryLoopStartInfo, ) func(trace.RetryLoopIntermediateInfo) func(trace.RetryLoopDoneInfo) { - retryCalled[info.ID] = true + retryCalled[info.Label] = true return nil }, }), @@ -40,14 +40,14 @@ func TestWithTraceRetry(t *testing.T) { func(ctx context.Context, s table.Session) error { return nil }, - table.WithID("db.Table().Do"), + table.WithLabel("db.Table().Do"), )) require.NoError(t, db.Table().DoTx(ctx, func(ctx context.Context, tx table.TransactionActor) error { return nil }, - table.WithID("db.Table().DoTx"), + table.WithLabel("db.Table().DoTx"), )) for _, key := range []string{ @@ -67,7 +67,7 @@ func TestWithTraceRetry(t *testing.T) { OnRetry: func( info trace.RetryLoopStartInfo, ) func(trace.RetryLoopIntermediateInfo) func(trace.RetryLoopDoneInfo) { - retryCalled[info.ID] = true + retryCalled[info.Label] = true return nil }, }), @@ -78,14 +78,14 @@ func TestWithTraceRetry(t *testing.T) { func(ctx context.Context, cc *sql.Conn) error { return nil }, - retry.WithID("retry.Do"), + retry.WithLabel("retry.Do"), )) require.NoError(t, retry.DoTx(ctx, db, func(ctx context.Context, tx *sql.Tx) error { return nil }, - retry.WithID("retry.DoTx"), + retry.WithLabel("retry.DoTx"), )) for _, key := range []string{ diff --git a/trace/retry.go b/trace/retry.go index 4daa7e6f5..45f89ea4c 100644 --- a/trace/retry.go +++ b/trace/retry.go @@ -20,7 +20,7 @@ type ( // Warning: concurrent access to pointer on client side must be excluded. // Safe replacement of context are provided only inside callback function Context *context.Context - ID string + Label string Idempotent bool NestedCall bool // flag when Retry called inside head Retry } diff --git a/trace/retry_gtrace.go b/trace/retry_gtrace.go index ee8f7c75a..7c42faf3f 100644 --- a/trace/retry_gtrace.go +++ b/trace/retry_gtrace.go @@ -110,10 +110,10 @@ func (t *Retry) onRetry(r RetryLoopStartInfo) func(RetryLoopIntermediateInfo) fu return res } } -func RetryOnRetry(t *Retry, c *context.Context, iD string, idempotent bool, nestedCall bool) func(error) func(attempts int, _ error) { +func RetryOnRetry(t *Retry, c *context.Context, label string, idempotent bool, nestedCall bool) func(error) func(attempts int, _ error) { var p RetryLoopStartInfo p.Context = c - p.ID = iD + p.Label = label p.Idempotent = idempotent p.NestedCall = nestedCall res := t.onRetry(p) diff --git a/trace/table.go b/trace/table.go index 8fd59d2a1..1794636e8 100644 --- a/trace/table.go +++ b/trace/table.go @@ -379,7 +379,7 @@ type ( // Warning: concurrent access to pointer on client side must be excluded. // Safe replacement of context are provided only inside callback function Context *context.Context - ID string + Label string Idempotent bool NestedCall bool // flag when Retry called inside head Retry } @@ -396,7 +396,7 @@ type ( // Warning: concurrent access to pointer on client side must be excluded. // Safe replacement of context are provided only inside callback function Context *context.Context - ID string + Label string Idempotent bool NestedCall bool // flag when Retry called inside head Retry } diff --git a/trace/table_gtrace.go b/trace/table_gtrace.go index 706859753..6082e2498 100644 --- a/trace/table_gtrace.go +++ b/trace/table_gtrace.go @@ -1420,10 +1420,10 @@ func TableOnClose(t *Table, c *context.Context) func(error) { res(p) } } -func TableOnDo(t *Table, c *context.Context, iD string, idempotent bool, nestedCall bool) func(error) func(attempts int, _ error) { +func TableOnDo(t *Table, c *context.Context, label string, idempotent bool, nestedCall bool) func(error) func(attempts int, _ error) { var p TableDoStartInfo p.Context = c - p.ID = iD + p.Label = label p.Idempotent = idempotent p.NestedCall = nestedCall res := t.onDo(p) @@ -1439,10 +1439,10 @@ func TableOnDo(t *Table, c *context.Context, iD string, idempotent bool, nestedC } } } -func TableOnDoTx(t *Table, c *context.Context, iD string, idempotent bool, nestedCall bool) func(error) func(attempts int, _ error) { +func TableOnDoTx(t *Table, c *context.Context, label string, idempotent bool, nestedCall bool) func(error) func(attempts int, _ error) { var p TableDoTxStartInfo p.Context = c - p.ID = iD + p.Label = label p.Idempotent = idempotent p.NestedCall = nestedCall res := t.onDoTx(p)