Skip to content

Commit

Permalink
* Added ydb.WithTraceRetry option
Browse files Browse the repository at this point in the history
  • Loading branch information
asmyasnikov committed Oct 22, 2023
1 parent 357d116 commit ba61306
Show file tree
Hide file tree
Showing 45 changed files with 1,457 additions and 1,004 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
* Added `ydb.WithTraceRetry` option
* Added `internal/credentials.IsAccessError(err)` helper for check access errors
* Changed period for re-fresh static credentials token from `1/2` to `1/10` to expiration time

Expand Down
6 changes: 6 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ func WithTrace(t trace.Driver, opts ...trace.DriverComposeOption) Option { //nol
}
}

func WithTraceRetry(t *trace.Retry, opts ...trace.RetryComposeOption) Option {
return func(c *Config) {
config.SetTraceRetry(&c.Common, t, opts...)
}
}

func WithUserAgent(userAgent string) Option {
return func(c *Config) {
c.metaOptions = append(c.metaOptions, meta.WithUserAgentOption(userAgent))
Expand Down
1 change: 1 addition & 0 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ func newConnectionFromOptions(ctx context.Context, opts ...Option) (_ *Driver, e
WithTraceDiscovery(log.Discovery(d.logger, d.loggerDetails, d.loggerOpts...)),
WithTraceTopic(log.Topic(d.logger, d.loggerDetails, d.loggerOpts...)),
WithTraceDatabaseSQL(log.DatabaseSQL(d.logger, d.loggerDetails, d.loggerOpts...)),
WithTraceRetry(log.Retry(d.logger, d.loggerDetails, d.loggerOpts...)),
} {
if opt != nil {
err = opt(ctx, d)
Expand Down
38 changes: 15 additions & 23 deletions examples/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,23 @@ go 1.20
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/lib/pq v1.10.7
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-sdk/v3 v3.48.7
github.com/ydb-platform/ydb-go-yc v0.10.1
google.golang.org/genproto v0.0.0-20230131230820-1c016267d619
gorm.io/driver/postgres v1.5.0
gorm.io/driver/sqlite v1.5.0
gorm.io/gorm v1.25.1
modernc.org/sqlite v1.14.2
modernc.org/sqlite v1.20.4
xorm.io/builder v0.3.11-0.20220531020008-1bd24a7dc978
xorm.io/xorm v1.3.2
)

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/dustin/go-humanize v1.0.0 // indirect
github.com/goccy/go-json v0.8.1 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/golang-jwt/jwt/v4 v4.4.3 // indirect
Expand All @@ -39,18 +36,13 @@ require (
github.com/json-iterator/go v1.1.12 // indirect
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/mattn/go-sqlite3 v1.14.16 // 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.2.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.8.0 // indirect
Expand All @@ -61,17 +53,17 @@ require (
golang.org/x/tools v0.6.0 // indirect
google.golang.org/grpc v1.53.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
lukechampine.com/uint128 v1.1.1 // indirect
modernc.org/cc/v3 v3.35.18 // indirect
modernc.org/ccgo/v3 v3.12.82 // indirect
modernc.org/libc v1.11.87 // indirect
modernc.org/mathutil v1.4.1 // indirect
modernc.org/memory v1.0.5 // indirect
modernc.org/opt v0.1.1 // indirect
modernc.org/strutil v1.1.1 // indirect
modernc.org/token v1.0.0 // indirect
lukechampine.com/uint128 v1.2.0 // indirect
modernc.org/cc/v3 v3.40.0 // indirect
modernc.org/ccgo/v3 v3.16.13 // indirect
modernc.org/libc v1.22.2 // indirect
modernc.org/mathutil v1.5.0 // indirect
modernc.org/memory v1.4.0 // indirect
modernc.org/opt v0.1.3 // indirect
modernc.org/strutil v1.1.3 // indirect
modernc.org/token v1.0.1 // indirect
)

replace github.com/ydb-platform/ydb-go-sdk/v3 => ../

replace xorm.io/xorm => github.com/ydb-platform/xorm v0.0.3
replace xorm.io/xorm => github.com/ydb-platform/xorm v0.0.6
Loading

0 comments on commit ba61306

Please sign in to comment.