Skip to content

Add block-size observability at flush and compaction - #7773

Draft
zalegrala wants to merge 2 commits into
grafana:mainfrom
zalegrala:block-size-observability
Draft

Add block-size observability at flush and compaction#7773
zalegrala wants to merge 2 commits into
grafana:mainfrom
zalegrala:block-size-observability

Conversation

@zalegrala

Copy link
Copy Markdown
Contributor

What this PR does:

Adds two native-histogram metrics closing an observability gap around the size of backend blocks:

  • tempo_block_builder_flush_size_bytes — size of blocks written by the block-builder flush path. The live-store flush path already has this (tempo_live_store_local_flush_size_bytes); the block-builder path had no equivalent, only a flushed-blocks counter.
  • tempodb_compaction_output_block_size_bytes — size of blocks produced by compaction. No existing metric captures this; tempodb_compaction_bytes_written_total is a cumulative counter fed per row-group flush during compaction, not a per-finished-block size.

Both reuse BlockMeta.Size_, which is already populated at both call sites, so no new size computation is introduced. Both follow the existing native-histogram convention in this codebase (NativeHistogramBucketFactor: 1.1, NativeHistogramMaxBucketNumber: 100, NativeHistogramMinResetDuration: 1h, classic exponential buckets starting at 1MiB), matching metricFlushSize in modules/livestore/complete_block_lifecycle.go. Neither carries a tenant label — block size is a storage/config characteristic here, and this keeps cardinality low.

Motivation: this data is a prerequisite for reasoning about tuning max_input_blocks on scheduled compactions (in tempodb/compactor.go, tempodb/blockselector/compaction_block_selector.go, modules/backendscheduler/provider/compaction.go) for TCO, and separately for understanding how block size affects query performance. This PR is scoped to just the observability gap — no dashboard/mixin changes, no compaction behavior changes.

Out of scope: tenant-ring sharding tuning, max_input_blocks changes, and dashboard additions are left as follow-ups once data is available. This is unrelated to the in-flight redaction work.

Which issue(s) this PR fixes:
N/A — no tracking issue yet.

Checklist

  • Tests updated
  • Documentation added
  • Changelog entry added under .chloggen/ (run make chlog-new, or make chlog-new FILENAME=<name> to override the default branch-name file; see .chloggen/README.md)

…paction

Adds tempo_block_builder_flush_size_bytes (block-builder flush path) and
tempodb_compaction_output_block_size_bytes (compaction output), mirroring the
existing live-store tempo_live_store_local_flush_size_bytes metric. Closes the
observability gap needed to inform max_input_blocks tuning and TCO analysis.
metricBlockBuilderFlushSize was declared but never observed, tripping the
unused-var lint check.
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