Skip to content

Commit

Permalink
Update to latest dskit (new flagext.Secret and move of pkg/tenant) (g…
Browse files Browse the repository at this point in the history
…rafana#1356)

* Update dskit

* Refactor to make use of new secret flag type

* Use tenant package from dskit

* Add CHANGELOG entry
  • Loading branch information
simonswine authored Apr 5, 2022
1 parent b79e432 commit 464dcbf
Show file tree
Hide file tree
Showing 45 changed files with 609 additions and 435 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
**BREAKING CHANGE** Dropped `tempo-search-retention-duration` parameter. [#1297](https://github.com/grafana/tempo/pull/1297) (@joe-elliott)
* [CHANGE] Updated storage.trace.pool.queue_depth default from 200->10000. [#1345](https://github.com/grafana/tempo/pull/1345) (@joe-elliott)
* [CHANGE] Update alpine images to 3.15 [#1330](https://github.com/grafana/tempo/pull/1330) (@zalegrala)
* [CHANGE] Updated flags `-storage.trace.azure.storage-account-name` and `-storage.trace.s3.access_key` to no longer to be considered as secrets [#1356](https://github.com/grafana/tempo/pull/1356) (@simonswine)
* [FEATURE]: v2 object encoding added. This encoding adds a start/end timestamp to every record to reduce proto marshalling and increase search speed.
**BREAKING CHANGE** After this rollout the distributors will use a new API on the ingesters. As such you must rollout all ingesters before rolling the
distributors. Also, during this period, the ingesters will use considerably more resources and as such should be scaled up (or incoming traffic should be
Expand Down
3 changes: 2 additions & 1 deletion cmd/tempo-serverless/cloud-functions/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1092,8 +1092,9 @@ github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/grafana/dskit v0.0.0-20211021180445-3bd016e9d7f1/go.mod h1:uPG2nyK4CtgNDmWv7qyzYcdI+S90kHHRWvHnBtEMBXM=
github.com/grafana/dskit v0.0.0-20220112093026-95274ccc858d h1:YwUtZIQFjlH6e2b5dFLfW1h/vTkTXNkZqv9qeU8b5h0=
github.com/grafana/dskit v0.0.0-20220112093026-95274ccc858d/go.mod h1:M0/dlftwBvH7+hdNNpjMa/CUXD7gsew67mbkCuDlFXE=
github.com/grafana/dskit v0.0.0-20220331160727-49faf69f72ca h1:0qHzm6VS0bCsSWKHuyfpt+pdpyScdZbzY/IFIyKSYOk=
github.com/grafana/dskit v0.0.0-20220331160727-49faf69f72ca/go.mod h1:q51XdMLLHNZJSG6KOGujC20ed2OoLFdx0hBmOEVfRs0=
github.com/grafana/e2e v0.1.0/go.mod h1:+26VJWpczg2OU3D0537acnHSHzhJORpxOs6F+M27tZo=
github.com/grafana/regexp v0.0.0-20220202152315-e74e38789280 h1:MOND6wXrwVXEzmL2bZ+Jcbgycwt1LD5q6NQbqz/Nlic=
github.com/grafana/regexp v0.0.0-20220202152315-e74e38789280/go.mod h1:M5qHK+eWfAv8VR/265dIuEpL3fNfeC21tXXp9itM24A=
Expand Down
4 changes: 1 addition & 3 deletions cmd/tempo-serverless/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,7 @@ func stringToFlagExt() mapstructure.DecodeHookFunc {
if t != reflect.TypeOf(flagext.Secret{}) {
return data, nil
}
return flagext.Secret{
Value: data.(string),
}, nil
return flagext.SecretWithValue(data.(string)), nil
}
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/tempo-serverless/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestLoadConfigS3(t *testing.T) {
if cfg.S3.Endpoint != "glerg" {
t.Error("s3 endpoint should be glerg", cfg.S3.Endpoint)
}
if cfg.S3.AccessKey.String() != "access" {
if cfg.S3.AccessKey != "access" {
t.Error("s3 access key should be access", cfg.S3.AccessKey)
}
if cfg.S3.SecretKey.String() != "secret" {
Expand Down
3 changes: 2 additions & 1 deletion cmd/tempo-serverless/lambda/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1084,8 +1084,9 @@ github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/grafana/dskit v0.0.0-20211021180445-3bd016e9d7f1/go.mod h1:uPG2nyK4CtgNDmWv7qyzYcdI+S90kHHRWvHnBtEMBXM=
github.com/grafana/dskit v0.0.0-20220112093026-95274ccc858d h1:YwUtZIQFjlH6e2b5dFLfW1h/vTkTXNkZqv9qeU8b5h0=
github.com/grafana/dskit v0.0.0-20220112093026-95274ccc858d/go.mod h1:M0/dlftwBvH7+hdNNpjMa/CUXD7gsew67mbkCuDlFXE=
github.com/grafana/dskit v0.0.0-20220331160727-49faf69f72ca h1:0qHzm6VS0bCsSWKHuyfpt+pdpyScdZbzY/IFIyKSYOk=
github.com/grafana/dskit v0.0.0-20220331160727-49faf69f72ca/go.mod h1:q51XdMLLHNZJSG6KOGujC20ed2OoLFdx0hBmOEVfRs0=
github.com/grafana/e2e v0.1.0/go.mod h1:+26VJWpczg2OU3D0537acnHSHzhJORpxOs6F+M27tZo=
github.com/grafana/regexp v0.0.0-20220202152315-e74e38789280 h1:MOND6wXrwVXEzmL2bZ+Jcbgycwt1LD5q6NQbqz/Nlic=
github.com/grafana/regexp v0.0.0-20220202152315-e74e38789280/go.mod h1:M5qHK+eWfAv8VR/265dIuEpL3fNfeC21tXXp9itM24A=
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ require (
github.com/aws/aws-sdk-go v1.43.4
github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b
github.com/cespare/xxhash v1.1.0
github.com/cespare/xxhash/v2 v2.1.2
github.com/cristalhq/hedgedhttp v0.7.0
github.com/drone/envsubst v1.0.3
github.com/dustin/go-humanize v1.0.0
Expand All @@ -28,7 +29,7 @@ require (
github.com/google/go-cmp v0.5.7
github.com/google/uuid v1.3.0
github.com/gorilla/mux v1.8.0
github.com/grafana/dskit v0.0.0-20220112093026-95274ccc858d
github.com/grafana/dskit v0.0.0-20220331160727-49faf69f72ca
github.com/grafana/e2e v0.1.0
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645
github.com/hashicorp/go-hclog v1.0.0
Expand Down Expand Up @@ -102,7 +103,6 @@ require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.1.2 // indirect
github.com/census-instrumentation/opencensus-proto v0.3.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/coreos/etcd v3.3.25+incompatible // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect
Expand Down
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1128,8 +1128,9 @@ github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/grafana/dskit v0.0.0-20211021180445-3bd016e9d7f1/go.mod h1:uPG2nyK4CtgNDmWv7qyzYcdI+S90kHHRWvHnBtEMBXM=
github.com/grafana/dskit v0.0.0-20220112093026-95274ccc858d h1:YwUtZIQFjlH6e2b5dFLfW1h/vTkTXNkZqv9qeU8b5h0=
github.com/grafana/dskit v0.0.0-20220112093026-95274ccc858d/go.mod h1:M0/dlftwBvH7+hdNNpjMa/CUXD7gsew67mbkCuDlFXE=
github.com/grafana/dskit v0.0.0-20220331160727-49faf69f72ca h1:0qHzm6VS0bCsSWKHuyfpt+pdpyScdZbzY/IFIyKSYOk=
github.com/grafana/dskit v0.0.0-20220331160727-49faf69f72ca/go.mod h1:q51XdMLLHNZJSG6KOGujC20ed2OoLFdx0hBmOEVfRs0=
github.com/grafana/e2e v0.1.0 h1:nThd0U0TjUqyOOupSb+qDd4BOdhqwhR/oYbjoqiMlZk=
github.com/grafana/e2e v0.1.0/go.mod h1:+26VJWpczg2OU3D0537acnHSHzhJORpxOs6F+M27tZo=
github.com/grafana/opentelemetry-collector v0.4.1-0.20211201123047-86905635e8f8 h1:jZAKyumYgG79/hCc+PKux00HpbzXcbjN1wc5fO4p4bU=
Expand Down
2 changes: 1 addition & 1 deletion modules/frontend/transport/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ import (

"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/grafana/dskit/tenant"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/weaveworks/common/httpgrpc"
"github.com/weaveworks/common/httpgrpc/server"

querier_stats "github.com/grafana/tempo/modules/querier/stats"
"github.com/grafana/tempo/pkg/tenant"
"github.com/grafana/tempo/pkg/util"
util_log "github.com/grafana/tempo/pkg/util/log"
)
Expand Down
2 changes: 1 addition & 1 deletion modules/frontend/v1/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/grafana/dskit/services"
"github.com/grafana/dskit/tenant"
"github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
Expand All @@ -19,7 +20,6 @@ import (
"github.com/grafana/tempo/modules/frontend/v1/frontendv1pb"
"github.com/grafana/tempo/modules/querier/stats"
"github.com/grafana/tempo/pkg/scheduler/queue"
"github.com/grafana/tempo/pkg/tenant"
"github.com/grafana/tempo/pkg/util"
"github.com/grafana/tempo/pkg/util/httpgrpcutil"
"github.com/grafana/tempo/pkg/validation"
Expand Down
2 changes: 1 addition & 1 deletion modules/frontend/v2/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/grafana/dskit/flagext"
"github.com/grafana/dskit/grpcclient"
"github.com/grafana/dskit/services"
"github.com/grafana/dskit/tenant"
"github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
Expand All @@ -23,7 +24,6 @@ import (

"github.com/grafana/tempo/modules/frontend/v2/frontendv2pb"
"github.com/grafana/tempo/modules/querier/stats"
"github.com/grafana/tempo/pkg/tenant"
"github.com/grafana/tempo/pkg/util/httpgrpcutil"
)

Expand Down
8 changes: 4 additions & 4 deletions modules/storage/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ func (cfg *Config) RegisterFlagsAndApplyDefaults(prefix string, f *flag.FlagSet)
cfg.Trace.Block.SearchPageSizeBytes = 1024 * 1024 // 1 MB

cfg.Trace.Azure = &azure.Config{}
f.StringVar(&cfg.Trace.Azure.StorageAccountName.Value, util.PrefixConfig(prefix, "trace.azure.storage-account-name"), "", "Azure storage account name.")
f.StringVar(&cfg.Trace.Azure.StorageAccountKey.Value, util.PrefixConfig(prefix, "trace.azure.storage-account-key"), "", "Azure storage access key.")
f.StringVar(&cfg.Trace.Azure.StorageAccountName, util.PrefixConfig(prefix, "trace.azure.storage-account-name"), "", "Azure storage account name.")
f.Var(&cfg.Trace.Azure.StorageAccountKey, util.PrefixConfig(prefix, "trace.azure.storage-account-key"), "Azure storage access key.")
f.StringVar(&cfg.Trace.Azure.ContainerName, util.PrefixConfig(prefix, "trace.azure.container-name"), "", "Azure container name to store blocks in.")
f.StringVar(&cfg.Trace.Azure.Endpoint, util.PrefixConfig(prefix, "trace.azure.endpoint"), "blob.core.windows.net", "Azure endpoint to push blocks to.")
f.IntVar(&cfg.Trace.Azure.MaxBuffers, util.PrefixConfig(prefix, "trace.azure.max-buffers"), 4, "Number of simultaneous uploads.")
Expand All @@ -64,8 +64,8 @@ func (cfg *Config) RegisterFlagsAndApplyDefaults(prefix string, f *flag.FlagSet)
cfg.Trace.S3 = &s3.Config{}
f.StringVar(&cfg.Trace.S3.Bucket, util.PrefixConfig(prefix, "trace.s3.bucket"), "", "s3 bucket to store blocks in.")
f.StringVar(&cfg.Trace.S3.Endpoint, util.PrefixConfig(prefix, "trace.s3.endpoint"), "", "s3 endpoint to push blocks to.")
f.StringVar(&cfg.Trace.S3.AccessKey.Value, util.PrefixConfig(prefix, "trace.s3.access_key"), "", "s3 access key.")
f.StringVar(&cfg.Trace.S3.SecretKey.Value, util.PrefixConfig(prefix, "trace.s3.secret_key"), "", "s3 secret key.")
f.StringVar(&cfg.Trace.S3.AccessKey, util.PrefixConfig(prefix, "trace.s3.access_key"), "", "s3 access key.")
f.Var(&cfg.Trace.S3.SecretKey, util.PrefixConfig(prefix, "trace.s3.secret_key"), "s3 secret key.")
cfg.Trace.S3.HedgeRequestsUpTo = 2

cfg.Trace.GCS = &gcs.Config{}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cache/redis_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func NewRedisClient(cfg *RedisConfig) *RedisClient {
opt := &redis.UniversalOptions{
Addrs: strings.Split(cfg.Endpoint, ","),
MasterName: cfg.MasterName,
Password: cfg.Password.Value,
Password: cfg.Password.String(),
DB: cfg.DB,
PoolSize: cfg.PoolSize,
IdleTimeout: cfg.IdleTimeout,
Expand Down
2 changes: 1 addition & 1 deletion pkg/scheduler/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/go-kit/log/level"
"github.com/grafana/dskit/grpcclient"
"github.com/grafana/dskit/services"
"github.com/grafana/dskit/tenant"
otgrpc "github.com/opentracing-contrib/go-grpc"
"github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
Expand All @@ -25,7 +26,6 @@ import (
"github.com/grafana/tempo/modules/frontend/v2/frontendv2pb"
"github.com/grafana/tempo/pkg/scheduler/queue"
"github.com/grafana/tempo/pkg/scheduler/schedulerpb"
"github.com/grafana/tempo/pkg/tenant"
"github.com/grafana/tempo/pkg/util"
"github.com/grafana/tempo/pkg/util/httpgrpcutil"
"github.com/grafana/tempo/pkg/validation"
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/log/wrappers.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
kitlog "github.com/go-kit/log"
"github.com/weaveworks/common/tracing"

"github.com/grafana/tempo/pkg/tenant"
"github.com/grafana/dskit/tenant"
)

// WithUserID returns a Logger that has information about the current user in
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/spanlogger/spanlogger.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/opentracing/opentracing-go/ext"
otlog "github.com/opentracing/opentracing-go/log"

"github.com/grafana/tempo/pkg/tenant"
"github.com/grafana/dskit/tenant"
util_log "github.com/grafana/tempo/pkg/util/log"
)

Expand Down
2 changes: 1 addition & 1 deletion tempodb/backend/azure/azure_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const (
)

func GetContainerURL(ctx context.Context, cfg *Config, hedge bool) (blob.ContainerURL, error) {
accountName := cfg.StorageAccountName.String()
accountName := cfg.StorageAccountName
accountKey := cfg.StorageAccountKey.String()

if accountName == "" {
Expand Down
4 changes: 2 additions & 2 deletions tempodb/backend/azure/azure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ func TestHedge(t *testing.T) {
server := fakeServer(t, tc.returnIn, &count)

r, w, _, err := New(&Config{
StorageAccountName: flagext.Secret{Value: "testing"},
StorageAccountKey: flagext.Secret{Value: "YQo="},
StorageAccountName: "testing",
StorageAccountKey: flagext.SecretWithValue("YQo="),
MaxBuffers: 3,
BufferSize: 1000,
ContainerName: "blerg",
Expand Down
2 changes: 1 addition & 1 deletion tempodb/backend/azure/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

type Config struct {
StorageAccountName flagext.Secret `yaml:"storage-account-name"`
StorageAccountName string `yaml:"storage-account-name"`
StorageAccountKey flagext.Secret `yaml:"storage-account-key"`
ContainerName string `yaml:"container-name"`
Endpoint string `yaml:"endpoint-suffix"`
Expand Down
2 changes: 1 addition & 1 deletion tempodb/backend/s3/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type Config struct {
Bucket string `yaml:"bucket"`
Endpoint string `yaml:"endpoint"`
Region string `yaml:"region"`
AccessKey flagext.Secret `yaml:"access_key"`
AccessKey string `yaml:"access_key"`
SecretKey flagext.Secret `yaml:"secret_key"`
Insecure bool `yaml:"insecure"`
PartSize uint64 `yaml:"part_size"`
Expand Down
2 changes: 1 addition & 1 deletion tempodb/backend/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ func createCore(cfg *Config, hedge bool) (*minio.Core, error) {
wrapCredentialsProvider(&credentials.EnvAWS{}),
wrapCredentialsProvider(&credentials.Static{
Value: credentials.Value{
AccessKeyID: cfg.AccessKey.String(),
AccessKeyID: cfg.AccessKey,
SecretAccessKey: cfg.SecretKey.String(),
},
}),
Expand Down
4 changes: 2 additions & 2 deletions tempodb/backend/s3/s3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ func TestHedge(t *testing.T) {

r, w, _, err := New(&Config{
Region: "blerg",
AccessKey: flagext.Secret{Value: "test"},
SecretKey: flagext.Secret{Value: "test"},
AccessKey: "test",
SecretKey: flagext.SecretWithValue("test"),
Bucket: "blerg",
Insecure: true,
Endpoint: server.URL[7:], // [7:] -> strip http://
Expand Down
6 changes: 3 additions & 3 deletions vendor/github.com/grafana/dskit/backoff/backoff.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions vendor/github.com/grafana/dskit/crypto/tls/tls.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions vendor/github.com/grafana/dskit/flagext/secret.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions vendor/github.com/grafana/dskit/grpcclient/grpcclient.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 464dcbf

Please sign in to comment.