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
Prev Previous commit
Next Next commit
Fix where log message and duration and triggered.
  • Loading branch information
DylanGuedes committed Apr 25, 2022
commit b4737dcaac048a813e477b7cbf58d57d133f97a6
6 changes: 3 additions & 3 deletions pkg/storage/stores/shipper/downloads/table_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,7 @@ func (tm *TableManager) cleanupCache() error {
func (tm *TableManager) ensureQueryReadiness(ctx context.Context) error {
start := time.Now()
defer func() {
duration := time.Since(start)
tm.metrics.ensureQueryReadinessDurationSeconds.Observe(duration.Seconds())
tm.metrics.ensureQueryReadinessDurationSeconds.Observe(time.Since(start).Seconds())
}()

activeTableNumber := getActiveTableNumber()
Expand Down Expand Up @@ -315,10 +314,11 @@ func (tm *TableManager) ensureQueryReadiness(ctx context.Context) error {
return err
}

level.Debug(util_log.Logger).Log("msg", "instance should be query ready for users", "users", usersToBeQueryReadyFor, "query_readiness_duration", time.Since(start))
perTableStart := time.Now()
if err := table.EnsureQueryReadiness(ctx, usersToBeQueryReadyFor); err != nil {
return err
}
level.Debug(util_log.Logger).Log("msg", "instance query ready for users", "users", usersToBeQueryReadyFor, "query_readiness_duration", time.Since(perTableStart), "table", tableName)
}

return nil
Expand Down