Skip to content

Commit

Permalink
Separate metas fetch time and blocks fetch time
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
  • Loading branch information
chaudum committed Mar 26, 2024
1 parent dbc4f74 commit 8e6e781
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
4 changes: 2 additions & 2 deletions pkg/bloomgateway/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (p *processor) processTasks(ctx context.Context, tenant string, day config.
level.Debug(p.logger).Log("msg", "fetched metas", "count", len(metas), "duration", duration, "err", err)

for _, t := range tasks {
FromContext(t.ctx).AddFetchTime(duration)
FromContext(t.ctx).AddMetasFetchTime(duration)
}

if err != nil {
Expand Down Expand Up @@ -112,7 +112,7 @@ func (p *processor) processTasks(ctx context.Context, tenant string, day config.
level.Debug(p.logger).Log("msg", "fetched blocks", "count", len(refs), "duration", duration, "err", err)

for _, t := range tasks {
FromContext(t.ctx).AddFetchTime(duration)
FromContext(t.ctx).AddBlocksFetchTime(duration)
}

if err != nil {
Expand Down
22 changes: 15 additions & 7 deletions pkg/bloomgateway/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
)

type Stats struct {
Status string
NumTasks, NumFilters int
ChunksRequested, ChunksFiltered, SeriesRequested, SeriesFiltered int
QueueTime, FetchTime, ProcessingTime, PostProcessingTime time.Duration
Status string
NumTasks, NumFilters int
ChunksRequested, ChunksFiltered, SeriesRequested, SeriesFiltered int
QueueTime, MetasFetchTime, BlocksFetchTime, ProcessingTime, PostProcessingTime time.Duration
}

type statsKey int
Expand Down Expand Up @@ -49,7 +49,8 @@ func (s *Stats) KVArgs() []any {
"chunks_requested", s.ChunksRequested,
"chunks_filtered", s.ChunksFiltered,
"queue_time", s.QueueTime,
"fetch_time", s.FetchTime,
"metas_fetch_time", s.MetasFetchTime,
"blocks_fetch_time", s.BlocksFetchTime,
"processing_time", s.ProcessingTime,
"post_processing_time", s.PostProcessingTime,
}
Expand All @@ -62,11 +63,18 @@ func (s *Stats) AddQueueTime(t time.Duration) {
atomic.AddInt64((*int64)(&s.QueueTime), int64(t))
}

func (s *Stats) AddFetchTime(t time.Duration) {
func (s *Stats) AddMetasFetchTime(t time.Duration) {
if s == nil {
return
}
atomic.AddInt64((*int64)(&s.FetchTime), int64(t))
atomic.AddInt64((*int64)(&s.MetasFetchTime), int64(t))
}

func (s *Stats) AddBlocksFetchTime(t time.Duration) {
if s == nil {
return
}
atomic.AddInt64((*int64)(&s.BlocksFetchTime), int64(t))
}

func (s *Stats) AddProcessingTime(t time.Duration) {
Expand Down

0 comments on commit 8e6e781

Please sign in to comment.