Skip to content

tempo-cli: rewrite migrate overrides-config and add per-tenant migration command#6793

Merged
electron0zero merged 5 commits intografana:mainfrom
electron0zero:tempo_cli_migrate_lagacy_overrides
Mar 30, 2026
Merged

tempo-cli: rewrite migrate overrides-config and add per-tenant migration command#6793
electron0zero merged 5 commits intografana:mainfrom
electron0zero:tempo_cli_migrate_lagacy_overrides

Conversation

@electron0zero
Copy link
Copy Markdown
Member

@electron0zero electron0zero commented Mar 25, 2026

What this PR does:

Follow-up to #6741 (disable legacy overrides by default).

  • Rewrites migrate overrides-config to use Config.UnmarshalYAML directly instead of WriteStatusRuntimeConfig, which dumped all defaults making the output unusable. Now diffs against defaults to output only user-set values.
  • Adds new migrate overrides-per-tenant command for migrating per-tenant override files from legacy flat format to the new scoped format.
  • Exports UnmarshalPerTenantOverrides in the overrides package to reuse existing legacy conversion logic.
  • Adds omitempty to generate_native_histograms and ingestion_time_range_slack yaml tags to prevent zero values leaking into output.

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

The command was abusing WriteStatusRuntimeConfig to extract migrated
overrides, which dumped all defaults making the output unusable.
Use Config.UnmarshalYAML which already handles legacy conversion,
and diff against defaults to output only user-set values.
Add a new CLI command to migrate per-tenant override files from the
legacy flat format to the new scoped format. Export
UnmarshalPerTenantOverrides in the overrides package to avoid
duplicating the legacy conversion logic. Add omitempty to
generate_native_histograms and ingestion_time_range_slack yaml tags
to prevent zero values leaking into output.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates tempo-cli migration tooling to support the new scoped overrides format by improving how overrides are parsed and re-emitted, and by adding a new per-tenant migration command.

Changes:

  • Reworks tempo-cli migrate overrides-config to unmarshal the overrides config directly and emit only values that differ from defaults.
  • Adds tempo-cli migrate overrides-per-tenant to migrate legacy per-tenant override files into the new scoped format.
  • Exposes UnmarshalPerTenantOverrides from the overrides module and adjusts YAML tags to avoid emitting zero values for specific fields.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
modules/overrides/runtime_config_overrides.go Exports a strict per-tenant overrides unmarshaller for reuse by tempo-cli.
modules/overrides/config.go Adds omitempty to specific YAML tags to prevent zero values appearing in output.
cmd/tempo-cli/main.go Wires new/updated migrate subcommands and help text into the CLI.
cmd/tempo-cli/cmd-migrate-overrides-config.go Reimplements overrides-config migration via YAML round-trip + diff against defaults.
cmd/tempo-cli/cmd-migrate-overrides-config_test.go Adds tests validating legacy/new-format config migration output.
cmd/tempo-cli/cmd-migrate-overrides-per-tenant.go Adds per-tenant overrides migration command using exported unmarshal helper.
cmd/tempo-cli/cmd-migrate-overrides-per-tenant_test.go Adds tests validating legacy/new-format per-tenant migration output.
cmd/tempo-cli/test-data/migrate-overrides-*/*.yaml Adds fixtures for legacy/new input and expected migrated output.

Comment thread cmd/tempo-cli/cmd-migrate-overrides-config.go Outdated
Comment thread cmd/tempo-cli/cmd-migrate-overrides-per-tenant.go
Comment thread cmd/tempo-cli/cmd-migrate-overrides-config.go
Update the existing migrate overrides-config command docs to reflect
the rewritten implementation and add docs for the new migrate
overrides-per-tenant command.
- Fix struct field alignment in main.go (check-fmt)
- Regenerate manifest after omitempty tag changes (generate-manifest)
- Use separate config instance for defaults to avoid shared pointers
Copilot AI review requested due to automatic review settings March 25, 2026 19:02
@electron0zero
Copy link
Copy Markdown
Member Author

@codex review please

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 5 comments.

Comment thread cmd/tempo-cli/cmd-migrate-overrides-config.go
Comment thread modules/overrides/runtime_config_overrides.go
Comment thread docs/sources/tempo/operations/tempo_cli.md
Comment thread cmd/tempo-cli/cmd-migrate-overrides-config.go
Comment thread cmd/tempo-cli/cmd-migrate-overrides-per-tenant_test.go
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown
Contributor

@knylander-grafana knylander-grafana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for adding docs. Approving the docs.

@electron0zero electron0zero merged commit c85ddd9 into grafana:main Mar 30, 2026
48 of 50 checks passed
@electron0zero electron0zero deleted the tempo_cli_migrate_lagacy_overrides branch March 30, 2026 11:37
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.

4 participants