Skip to content

Commit

Permalink
Log fetched bucket index timestamps (#9896) (#9898)
Browse files Browse the repository at this point in the history
* Log fetched bucket index timestamps

Adds logging of bucket index timestamps after they're fetched, in queriers and store gateways.

(cherry picked from commit 05cd9ca)

Co-authored-by: Jonathan Halterman <[email protected]>
  • Loading branch information
grafanabot and jhalterman authored Nov 13, 2024
1 parent a4033f6 commit e189185
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pkg/querier/blocks_finder_bucket_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,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 +50,7 @@ func NewBucketIndexBlocksFinder(cfg BucketIndexBlocksFinderConfig, bkt objstore.
cfg: cfg,
loader: loader,
Service: loader,
logger: logger,
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/tsdb/bucketindex/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func (l *Loader) GetIndex(ctx context.Context, userID string) (*Index, error) {

elapsedTime := time.Since(startTime)
l.loadDuration.Observe(elapsedTime.Seconds())
level.Info(l.logger).Log("msg", "loaded bucket index", "user", userID, "duration", elapsedTime)
level.Info(l.logger).Log("msg", "loaded bucket index", "user", userID, "updatedAt", idx.UpdatedAt, "duration", elapsedTime)
return idx, nil
}

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", "loaded bucket index", "user", 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
1 change: 0 additions & 1 deletion pkg/storegateway/bucket_index_metadata_fetcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ func TestBucketIndexMetadataFetcher_Fetch(t *testing.T) {
block3.ID: block3.ThanosMeta(),
}, metas)
assert.Empty(t, partials)
assert.Empty(t, logs)

assert.NoError(t, testutil.GatherAndCompare(reg, bytes.NewBufferString(`
# HELP blocks_meta_sync_failures_total Total blocks metadata synchronization failures
Expand Down

0 comments on commit e189185

Please sign in to comment.