Skip to content

feat(tempo-cli): add benchmark profile command - #7889

Draft
zhxiaogg wants to merge 1 commit into
grafana:mainfrom
zhxiaogg:feat/benchmark-plan
Draft

zhxiaogg wants to merge 1 commit into
grafana:mainfrom
zhxiaogg:feat/benchmark-plan

Conversation

@zhxiaogg

@zhxiaogg zhxiaogg commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

What this PR does:

Adds tempo-cli benchmark profile: inspects a local block and writes a JSON profile of it — block metadata, row-group count, and present and absent trace IDs.

  • It records only what must be measured, so a later benchmark run works from fixed inputs instead of re-inspecting the block, and every variant of an experiment gets identical ones.
  • Derivable things — query windows, steps, shard layouts — depend on options that vary between variants, so they are left to the runner.
$ tempo-cli benchmark profile /data/traces/3/000528f4-00ec-48b6-a42e-cd903877fc80 --trace-ids=10000
{
  "schemaVersion": 1,
  "generatedAt": "2026-09-14T21:34:37.021988Z",
  "generatedBy": {
    "gitSHA": "f227ccdf89c1ef2b059520b678c1f639aef7cc09"
  },
  "block": {
    "format": "vParquet5",
    "blockID": "000528f4-00ec-48b6-a42e-cd903877fc80",
    "tenantID": "3",
    "totalObjects": 2286113,
    "size": 2394245888,
    "compactionLevel": 2,
    "totalRecords": 24,
    "bloomShards": 28,
    "footerSize": 457732,
    "dedicatedColumns": "... 42 entries ...",
    "replicationFactor": 1
  },
  "rowGroups": 24,
  "traceIDs": {
    "mode": "sample",
    "present": [
      "... 10000 ids ..."
    ],
    "absent": [
      "... 10000 ids ..."
    ]
  }
}

Flags are documented in docs/sources/tempo/operations/tempo_cli.md.

Which issue(s) this PR fixes:

None.

Checklist

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

Profile a local block for read-path benchmarking: record the block metadata,
the row-group count, and present and absent trace IDs. A profile holds only
what has to be read from the block, so a benchmark run does not inspect it and
every variant of an experiment works from the same measurements.

The row-group count comes from the parquet footer rather than
meta.TotalRecords, which can over-count: streamingBlock.Complete increments it
and then flushes, so a block whose rows divide evenly into row groups records
one more than it has.

Present IDs are taken at an even stride over every row, so a trace-by-ID
benchmark is not confined to the opening pages of each row group. Each absent ID
is the midpoint between a present ID and the ID that follows it in the block:
row groups hold contiguous ranges of the sort key and the scan reads every row,
so the pair is adjacent and the midpoint is absent by construction. That needs
no lookup, so a block whose bloom filters are absent can still be profiled.
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