Skip to content

Commit

Permalink
chore: remove spanlogger (#4312)
Browse files Browse the repository at this point in the history
* chore: remove spanlogger
  • Loading branch information
javiermolinar authored Nov 12, 2024
1 parent 2ae8f27 commit 0ede155
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 133 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@
* [ENHANCEMENT] Add disk caching in ingester SearchTagValuesV2 for completed blocks [#4069](https://github.com/grafana/tempo/pull/4069) (@electron0zero)
* [ENHANCEMENT] chore: remove gofakeit dependency [#4274](https://github.com/grafana/tempo/pull/4274) (@javiermolinar)
* [ENHANCEMENT] Add a max flush attempts and metric to the metrics generator [#4254](https://github.com/grafana/tempo/pull/4254) (@joe-elliott)
* [ENHANCEMENT] Collection of query-frontend changes to reduce allocs. [#4242]https://github.com/grafana/tempo/pull/4242 (@joe-elliott)
* [ENHANCEMENT] Collection of query-frontend changes to reduce allocs. [#4242](https://github.com/grafana/tempo/pull/4242) (@joe-elliott)
* [ENHANCEMENT] Added `insecure-skip-verify` option in tempo-cli to skip SSL certificate validation when connecting to the S3 backend. [#44236](https://github.com/grafana/tempo/pull/4259) (@faridtmammadov)
* [ENHANCEMENT] Chore: delete spanlogger. [4312](https://github.com/grafana/tempo/pull/4312) (@javiermolinar)
* [ENHANCEMENT] Add `invalid_utf8` to reasons spanmetrics will discard spans. [#4293](https://github.com/grafana/tempo/pull/4293) (@zalegrala)
* [BUGFIX] Replace hedged requests roundtrips total with a counter. [#4063](https://github.com/grafana/tempo/pull/4063) [#4078](https://github.com/grafana/tempo/pull/4078) (@galalen)
* [BUGFIX] Metrics generators: Correctly drop from the ring before stopping ingestion to reduce drops during a rollout. [#4101](https://github.com/grafana/tempo/pull/4101) (@joe-elliott)
Expand Down
18 changes: 5 additions & 13 deletions pkg/cache/redis_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ import (
"github.com/prometheus/client_golang/prometheus/promauto"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace"

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

// RedisCache type caches chunks in redis
Expand All @@ -28,7 +25,6 @@ type RedisCache struct {

// NewRedisCache creates a new RedisCache
func NewRedisCache(name string, redisClient *RedisClient, reg prometheus.Registerer, logger log.Logger) *RedisCache {
util_log.WarnExperimentalUse("Redis cache")
cache := &RedisCache{
name: name,
redis: redisClient,
Expand Down Expand Up @@ -68,16 +64,14 @@ func (c *RedisCache) Fetch(ctx context.Context, keys []string) (found []string,
var items [][]byte
// Run a tracked request, using c.requestDuration to monitor requests.
err := measureRequest(ctx, method, c.requestDuration, redisStatusCode, func(ctx context.Context) error {
log := spanlogger.FromContext(ctx)
t := trace.SpanFromContext(ctx)
var err error
items, err = c.redis.MGet(ctx, keys)
if err != nil {
// nolint:errcheck
log.Error(err)
level.Error(c.logger).Log("msg", "failed to get from redis", "name", c.name, "err", err)
return err
}
log.AddEvent("cache.keys.found", trace.WithAttributes(attribute.Int("keys", len(keys))))
t.AddEvent("cache.keys.found", trace.WithAttributes(attribute.Int("keys", len(keys))))
return nil
})
if err != nil {
Expand All @@ -101,22 +95,20 @@ func (c *RedisCache) FetchKey(ctx context.Context, key string) (buf []byte, foun
const method = "RedisCache.Get"
// Run a tracked request, using c.requestDuration to monitor requests.
err := measureRequest(ctx, method, c.requestDuration, redisStatusCode, func(ctx context.Context) error {
log := spanlogger.FromContext(ctx)
t := trace.SpanFromContext(ctx)
var err error
buf, err = c.redis.Get(ctx, key)
if err != nil {
// nolint:errcheck
log.Error(err)
if errors.Is(err, redis.Nil) {
level.Debug(c.logger).Log("msg", "failed to get key from redis", "name", c.name, "err", err, "key", key)
log.AddEvent("cache.key.missed", trace.WithAttributes(attribute.String("key", key)))
t.AddEvent("cache.key.missed", trace.WithAttributes(attribute.String("key", key)))
} else {
level.Error(c.logger).Log("msg", "error requesting key from redis", "name", c.name, "err", err, "key", key)
}

return err
}
log.AddEvent("cache.key.found", trace.WithAttributes(attribute.String("key", key)))
t.AddEvent("cache.key.found", trace.WithAttributes(attribute.String("key", key)))
return nil
})
if err != nil {
Expand Down
119 changes: 0 additions & 119 deletions pkg/util/spanlogger/spanlogger.go

This file was deleted.

0 comments on commit 0ede155

Please sign in to comment.