Skip to content

tempodb/blocklist: mark poller spans errored/ok - #7996

Draft
zalegrala wants to merge 1 commit into
grafana:mainfrom
zalegrala:poller-span-error-status
Draft

zalegrala wants to merge 1 commit into
grafana:mainfrom
zalegrala:poller-span-error-status

Conversation

@zalegrala

Copy link
Copy Markdown
Contributor

Follow-up to #7951.

Checklist

  • Tests updated
  • Documentation added
  • Changelog entry added under .chloggen/

…giene)

Every span in the Poller.Do call chain (Poller.Do, Poller.Do.func,
Poller.pollTenantAndCreateIndex, Poller.pollTenantBlocks, pollBlock)
could return a non-nil error but never called SetStatus/RecordError,
so the span stayed Unset regardless of outcome - indistinguishable
from "nobody checked." pollUnknown was the one exception, but even
it never set Ok explicitly on its success path.

Add pkg/util/tracing.RecordErr and use it from a defer right after
each span is created, closing over each function's named (mostly
blank-named, `_`) return values so the existing return statements
don't need to change. Considered but did not collapse pollUnknown's
per-block span-in-a-loop (Poller.pollBlock): every storage backend's
Read/ListBlocks/etc. starts its own nested span from that per-block
ctx, so collapsing it would reparent those spans onto pollUnknown
instead, which is a real trace-structure change, not "just tracing."

Also switches the blocklist package's span tests off the swap-the-
global-TracerProvider-per-test pattern: OTel's global tracer only
delegates reliably to the *first* concrete provider installed via
otel.SetTracerProvider in a process, so a second span test doing the
same swap silently stopped capturing spans. Tests now share one
provider (installed once) and Reset() its exporter per test instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant