Skip to content

Commit

Permalink
Log fetched bucket index timestamps
Browse files Browse the repository at this point in the history
Adds logging of bucket index timestamps after they're fetched, in queriers and store gateways.
  • Loading branch information
jhalterman committed Nov 13, 2024
1 parent c71f9a8 commit 4c4a3ab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/querier/blocks_finder_bucket_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"time"

"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/grafana/dskit/services"
"github.com/oklog/ulid"
"github.com/pkg/errors"
Expand Down Expand Up @@ -40,6 +41,7 @@ type BucketIndexBlocksFinder struct {

cfg BucketIndexBlocksFinderConfig
loader *bucketindex.Loader
logger log.Logger
}

func NewBucketIndexBlocksFinder(cfg BucketIndexBlocksFinderConfig, bkt objstore.Bucket, cfgProvider bucket.TenantConfigProvider, logger log.Logger, reg prometheus.Registerer) *BucketIndexBlocksFinder {
Expand All @@ -49,6 +51,7 @@ func NewBucketIndexBlocksFinder(cfg BucketIndexBlocksFinderConfig, bkt objstore.
cfg: cfg,
loader: loader,
Service: loader,
logger: logger,
}
}

Expand Down Expand Up @@ -77,6 +80,8 @@ func (f *BucketIndexBlocksFinder) GetBlocks(ctx context.Context, userID string,
return nil, newBucketIndexTooOldError(idx.GetUpdatedAt(), f.cfg.MaxStalePeriod)
}

level.Info(f.logger).Log("msg", "fetched bucket index", "userID", userID, "updatedAt", idx.UpdatedAt)

matchingBlocks := map[ulid.ULID]*bucketindex.Block{}

// Filter blocks containing samples within the range.
Expand Down
2 changes: 2 additions & 0 deletions pkg/storegateway/bucket_index_metadata_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ func (f *BucketIndexMetadataFetcher) Fetch(ctx context.Context) (metas map[ulid.
return nil, nil, errors.Wrapf(err, "read bucket index")
}

level.Info(f.logger).Log("msg", "fetched bucket index", "userID", f.userID, "updatedAt", idx.UpdatedAt)

// Build block metas out of the index.
metas = make(map[ulid.ULID]*block.Meta, len(idx.Blocks))
for _, b := range idx.Blocks {
Expand Down

0 comments on commit 4c4a3ab

Please sign in to comment.