Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add better observability to queryReadiness #5946

Merged
merged 9 commits into from
Apr 28, 2022
9 changes: 9 additions & 0 deletions pkg/storage/stores/shipper/downloads/table_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"path/filepath"
"regexp"
"strconv"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -241,6 +242,11 @@ func (tm *TableManager) cleanupCache() error {

// ensureQueryReadiness compares tables required for being query ready with the tables we already have and downloads the missing ones.
func (tm *TableManager) ensureQueryReadiness(ctx context.Context) error {
start := time.Now()
defer func() {
level.Info(util_log.Logger).Log("msg", "query readiness setup completed", "duration", time.Since(start))
}()

activeTableNumber := getActiveTableNumber()

// find the largest query readiness number
Expand Down Expand Up @@ -309,9 +315,12 @@ func (tm *TableManager) ensureQueryReadiness(ctx context.Context) error {
return err
}

perTableStart := time.Now()
if err := table.EnsureQueryReadiness(ctx, usersToBeQueryReadyFor); err != nil {
return err
}
joinedUsers := strings.Join(usersToBeQueryReadyFor, ",")
level.Info(util_log.Logger).Log("msg", "index pre-download for query readiness completed", "users", joinedUsers, "duration", time.Since(perTableStart), "table", tableName)
}

return nil
Expand Down