You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is the parent/epic issue for reducing Tempo's supply-chain attack surface and tidying up go.mod.
A recent audit found multiple actionable items: unmaintained or deprecated packages with direct imports, multiple major versions of the same library in the graph, and small single-purpose libs that can be inlined.
Link issues and PRs that handle individual or multiple action items to the respective bullet point.
Note: this issue leave out changes related to github.com/gogo/protobuf and github.com/golang/protobuf because they are part of a bigger initiative
Action: Drop the dependency; replace errors.Wrap(err, "msg") with fmt.Errorf("msg: %w", err) and use stdlib errors.Is / errors.As.
Importance: Medium
Reason: Quietly abandoned since 2020-01-14 (>5y). Go 1.13+ stdlib covers every API we use. Direct imports in 5 files (modules/livestore/partition_reader.go, pkg/ingest/reader_client.go, tempodb/encoding/vparquet{3,4,5}/block_autocomplete.go).
Action: Remove direct usage; replace spew.ConfigState{}.Sdump(...) with fmt.Sprintf("%#v", ...). Package will remain as an indirect dep via testify; only our two direct imports need to go.
Importance: Low
Reason: Last commit 2018-02-21 (>7y); old-pseudo-version pin in our go.mod. Only 2 direct call sites (cmd/tempo-cli/cmd-query-trace-summary.go, pkg/traceql/ast_validate_test.go) and they're debug helpers.
Action: Drop the dependency; switch the 2 call sites to github.com/google/go-cmp/cmp.Diff (already a direct dep, Google-maintained).
Importance: Low
Reason: Single-author lib used only in cmd/tempo-vulture (main.go + test). google/go-cmp is strictly better-maintained and already in the build.
Action: Pure import-path migration for 5 call sites (cmd/tempo/app/app.go, cmd/tempo-cli/cmd-suggest-columns.go, pkg/docsgen/generate_manifest.go, 2 tests). Drop the gopkg.in/yaml.v3 direct require — go.yaml.in/yaml/v3 is already an indirect dep at v3.0.4.
Importance: High
Reason:gopkg.in/yaml.v3 last release was 2022-05; upstream go-yaml/yaml is unmaintained. The YAML community has taken over at go.yaml.in/yaml/v3 (same code, new canonical path, fresher tags). Currently we ship both copies for no reason. Blast radius ~175 modules.
Action: Bump cache layer to v9 (pkg/cache/redis_cache.go, pkg/cache/redis_client.go, pkg/cache/redis_cache_test.go). v9 requires context.Context on every method. alicebob/miniredis/v2 works against v9, so the test fake stays.
Importance: High
Reason: v8 last commit 2022-11; v9 is the supported branch (same vendor, new module path under github.com/redis/...). Hot path — request-path cache.
Action: Migrate 2 files (modules/distributor/forwarder/otlpgrpc/forwarder.go, modules/frontend/interceptor/interceptor.go) to v2 and drop v1 from go.mod. v2 is already in the indirect graph; chain-construction API renamed.
Importance: Medium
Reason: v1 last release 2023-03; v2 is the actively-developed line and already in the build. Two major versions of the same package shipping for two import sites.
Action: Migrate the one import in modules/overrides/userconfigurable/api/api.go to the /v5 module path.
Importance: Low
Reason: We currently depend on the unversioned v0 line via the +incompatible shim, which is essentially frozen. The /v5 module path is the one that receives fixes and follows semver properly.
Action: Migrate ~169 direct call sites to stdlib log/slog (Go 1.21+). Plan as a deliberate cross-cutting refactor; expect to touch every module.
Importance: Low
Reason: Last release 2022-04 (>3y); project in slow maintenance and most of the Go ecosystem is migrating to log/slog. No urgency, go-kit/log is stable and still works, but it should be the long-term direction.
Action: Add a small pkg/util/fnv1a package (~25 LoC, well-known algorithm) and migrate the 8 importers. Verify hash output is byte-for-byte identica to segmentio/fasthash to preserves query-frontend cache keys across the upgrade and keep distributor sharding deterministic.
Alternative action: Swap to github.com/cespare/xxhash/v2 (already a direct dep). Introduce a small pkg/util/hash helper that wraps *xxhash.Digest to mirror the current HashString64/AddString64/AddUint64 chain style (~30 LoC). Upsides: xxhash64 has better performance and full 64-bit avalanche and passes SMHasher, this eliminates a latent cache-collision risk in cache_keys.go. Downsides: changes the hash output, so every entry in the persisted memcached/redis query-frontend cache becomes a miss on deploy until the cache rewarms.
Importance: Medium-High
Reason: Last release 2020-05; Segment archived much of its OSS in 2024. Imports in distributor, frontend sharder, livestore search, and vparquet rebatcher all use the fnv1a.HashString64 / AddString64 / AddUint64 chain API. Removing the dependency closes a stale supply-chain entry; the xxhash alternative additionally upgrades hash quality on cache-key paths.
Action: Build an in-tree zapcore.Encoder that wraps github.com/go-logfmt/logfmt (already a direct dep, actively maintained). Migrate the 4 callers (cmd/tempo-query/main.go, cmd/tempo-vulture/main.go, modules/distributor/forwarder/forwarder.go, modules/distributor/receiver/shim.go). ~80 LoC.
Importance: Medium
Reason: Last commit 2022-08; single maintainer. Our usage is one function (zaplogfmt.NewEncoder); the encoder contract is small and well-defined. Removes a single-maintainer dependency from a hot logging path.
Action: Replace the 2 envsubst.EvalEnv(string) call sites (cmd/tempo/main.go:178, modules/overrides/runtime_config_overrides.go:98) with stdlib os.Expand / os.ExpandEnv. If the bash-like ${X:-default} syntax is needed, ~40 LoC suffices.
Alternative action: update to github.com/drone/envsubst/v2 (same maintainer; fresher tags) if we'd rather keep an external implementation.
Importance: Medium
Reason: Latest release 2021-06 (>4y); Drone CI itself is on life-support. Two files, one function each — the minimal surface makes inlining attractive and removes any future risk if the project goes fully unmaintained.
github.com/facette/natsort
Action: Inline a natural-order comparator into pkg/util (~30 LoC) and migrate pkg/cache/memcached_client_selector.go (+ its test).
Alternative action: swap to github.com/maruel/natural if we'd rather keep an external implementation with similar API.
Importance: Low
Reason: Last commit 2018-12 (>7y), single contributor, old-pseudo-version pin. Used in one place — sorting memcached server addresses naturally — with a tiny, well-known algorithm.
Postponed
github.com/gorilla/mux
Action: Migrate the 12 importing files (cmd/tempo/app/app.go + 11 others) to stdlib net/http pattern routing (Go 1.22+).
Alternative action:github.com/go-chi/chi/v5 if we want more middleware ergonomics than stdlib offers.
Importance: Low
Reason: Latest release 2023-10-18; project in slow-maintenance mode (not officially deprecated, but very few commits). Go 1.22's http.ServeMux pattern matching covers our usage. Defer until we have a deliberate routing refactor. Not pressing while mux is still receiving patches.
Why not now:gorilla/mux is also used by dskit. Replacing the dependency should be synchronized with dskit.
This is the parent/epic issue for reducing Tempo's supply-chain attack surface and tidying up
go.mod.A recent audit found multiple actionable items: unmaintained or deprecated packages with direct imports, multiple major versions of the same library in the graph, and small single-purpose libs that can be inlined.
Link issues and PRs that handle individual or multiple action items to the respective bullet point.
Note: this issue leave out changes related to
github.com/gogo/protobufandgithub.1485827954.workers.dev/golang/protobufbecause they are part of a bigger initiativeRemove
github.com/pkg/errors #7235
errors.Wrap(err, "msg")withfmt.Errorf("msg: %w", err)and use stdliberrors.Is/errors.As.modules/livestore/partition_reader.go,pkg/ingest/reader_client.go,tempodb/encoding/vparquet{3,4,5}/block_autocomplete.go).chore(dep) replace davecgh/go-spew debug dumps #7295
spew.ConfigState{}.Sdump(...)withfmt.Sprintf("%#v", ...). Package will remain as an indirect dep via testify; only our two direct imports need to go.cmd/tempo-cli/cmd-query-trace-summary.go,pkg/traceql/ast_validate_test.go) and they're debug helpers.chore(deps) replace go-test/deep with google/go-cmp #7296
github.com/google/go-cmp/cmp.Diff(already a direct dep, Google-maintained).cmd/tempo-vulture(main.go+ test).google/go-cmpis strictly better-maintained and already in the build.Update
chore(deps) migrate from gopkg.in/yaml.v3 to go.yaml.in/yaml/v3 #7241
cmd/tempo/app/app.go,cmd/tempo-cli/cmd-suggest-columns.go,pkg/docsgen/generate_manifest.go, 2 tests). Drop thegopkg.in/yaml.v3direct require —go.yaml.in/yaml/v3is already an indirect dep at v3.0.4.gopkg.in/yaml.v3last release was 2022-05; upstreamgo-yaml/yamlis unmaintained. The YAML community has taken over atgo.yaml.in/yaml/v3(same code, new canonical path, fresher tags). Currently we ship both copies for no reason. Blast radius ~175 modules.chore(deps) upgrade go-redis from v8 to v9 #7247
pkg/cache/redis_cache.go,pkg/cache/redis_client.go,pkg/cache/redis_cache_test.go). v9 requirescontext.Contexton every method.alicebob/miniredis/v2works against v9, so the test fake stays.github.com/redis/...). Hot path — request-path cache.chore(deps) upgrade grpc-ecosystem/go-grpc-middleware from v1 to v2 #7246
modules/distributor/forwarder/otlpgrpc/forwarder.go,modules/frontend/interceptor/interceptor.go) to v2 and drop v1 fromgo.mod. v2 is already in the indirect graph; chain-construction API renamed.chore(deps) upgrade evanphx/json-patch to v5 module path #7292
modules/overrides/userconfigurable/api/api.goto the/v5module path.+incompatibleshim, which is essentially frozen. The/v5module path is the one that receives fixes and follows semver properly.Replace
log/slog(Go 1.21+). Plan as a deliberate cross-cutting refactor; expect to touch every module.log/slog. No urgency, go-kit/log is stable and still works, but it should be the long-term direction.Replace (with internal)
chore(deps) replace github.com/segmentio/fasthash #7305
pkg/util/fnv1apackage (~25 LoC, well-known algorithm) and migrate the 8 importers. Verify hash output is byte-for-byte identica tosegmentio/fasthashto preserves query-frontend cache keys across the upgrade and keep distributor sharding deterministic.github.com/cespare/xxhash/v2(already a direct dep). Introduce a smallpkg/util/hashhelper that wraps*xxhash.Digestto mirror the currentHashString64/AddString64/AddUint64chain style (~30 LoC). Upsides: xxhash64 has better performance and full 64-bit avalanche and passes SMHasher, this eliminates a latent cache-collision risk incache_keys.go. Downsides: changes the hash output, so every entry in the persisted memcached/redis query-frontend cache becomes a miss on deploy until the cache rewarms.fnv1a.HashString64/AddString64/AddUint64chain API. Removing the dependency closes a stale supply-chain entry; the xxhash alternative additionally upgrades hash quality on cache-key paths.github.com/jsternberg/zap-logfmt #7307
zapcore.Encoderthat wrapsgithub.1485827954.workers.dev/go-logfmt/logfmt(already a direct dep, actively maintained). Migrate the 4 callers (cmd/tempo-query/main.go,cmd/tempo-vulture/main.go,modules/distributor/forwarder/forwarder.go,modules/distributor/receiver/shim.go). ~80 LoC.zaplogfmt.NewEncoder); the encoder contract is small and well-defined. Removes a single-maintainer dependency from a hot logging path.replace drone/envsubst with stdlib os.ExpandEnv #7310
envsubst.EvalEnv(string)call sites (cmd/tempo/main.go:178,modules/overrides/runtime_config_overrides.go:98) with stdlibos.Expand/os.ExpandEnv. If the bash-like${X:-default}syntax is needed, ~40 LoC suffices.github.com/drone/envsubst/v2(same maintainer; fresher tags) if we'd rather keep an external implementation.github.com/facette/natsortpkg/util(~30 LoC) and migratepkg/cache/memcached_client_selector.go(+ its test).github.1485827954.workers.dev/maruel/naturalif we'd rather keep an external implementation with similar API.Postponed
github.com/gorilla/muxcmd/tempo/app/app.go+ 11 others) to stdlibnet/httppattern routing (Go 1.22+).github.1485827954.workers.dev/go-chi/chi/v5if we want more middleware ergonomics than stdlib offers.http.ServeMuxpattern matching covers our usage. Defer until we have a deliberate routing refactor. Not pressing while mux is still receiving patches.gorilla/muxis also used by dskit. Replacing the dependency should be synchronized withdskit.