Skip to content

Add extension mechanism for per-tenant Overrides#6758

Merged
stoewer merged 30 commits intografana:mainfrom
stoewer:extend-tempo-config
Mar 31, 2026
Merged

Add extension mechanism for per-tenant Overrides#6758
stoewer merged 30 commits intografana:mainfrom
stoewer:extend-tempo-config

Conversation

@stoewer
Copy link
Copy Markdown
Contributor

@stoewer stoewer commented Mar 20, 2026

What this PR does:
Add extension mechanism for Temp's per-tenant Overrides. This enables applications who vendor tempo to add their own Overrides.

Which issue(s) this PR fixes:
Contributes to grafana/cloud-traces#270

Checklist

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

Copilot AI review requested due to automatic review settings March 20, 2026 18:20
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

Adds an extension mechanism to Tempo’s per-tenant overrides so downstream projects that vendor Tempo can register and decode their own override blocks/keys alongside built-in limits.

Changes:

  • Introduces an extension registry (RegisterExtension) and processing logic for YAML/JSON (new-format nested keys and legacy flat keys).
  • Refactors Overrides/LegacyOverrides to embed “base” structs and implement custom marshal/unmarshal to support extensions while preserving legacy conversions.
  • Updates runtime-config and user-configurable override tests to account for the new embedded-struct layout and extension handling.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
modules/overrides/extension.go Adds extension interface, registry, and processing helpers.
modules/overrides/extension_test.go Adds test coverage for extension registration and JSON/YAML + legacy/new round trips.
modules/overrides/config.go Refactors Overrides and config unmarshalling to support extensions.
modules/overrides/config_legacy.go Refactors LegacyOverrides and legacy conversion/marshal/unmarshal to support extensions.
modules/overrides/runtime_config_overrides.go Updates per-tenant runtime overrides YAML decoding and legacy conversion flow.
modules/overrides/config_test.go Updates config/tag tests and adds tests asserting unknown legacy keys are rejected.
modules/overrides/runtime_config_overrides_test.go Adjusts tests for embedded baseOverrides initialization.
modules/overrides/interface_test.go Adjusts tests for embedded baseOverrides initialization.
modules/overrides/user_configurable_overrides_test.go Adjusts tests for embedded baseOverrides initialization.
modules/overrides/userconfigurable/api/api_test.go Adjusts defaults setup for the refactored Overrides struct.
modules/overrides/userconfigurable/api/limits_test.go Adjusts defaults setup for the refactored Overrides struct.

Comment thread modules/overrides/config.go
Comment thread modules/overrides/extension_test.go Outdated
Comment thread modules/overrides/extension.go Outdated
Comment thread modules/overrides/config.go
Comment thread modules/overrides/config_legacy.go
Comment thread modules/overrides/config_test.go
Comment thread modules/overrides/runtime_config_overrides.go Outdated
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 6 out of 6 changed files in this pull request and generated 3 comments.

Comment thread modules/overrides/extension.go
Comment thread modules/overrides/extension.go Outdated
Comment thread modules/overrides/config_legacy.go Outdated
Copilot AI review requested due to automatic review settings March 24, 2026 12:33
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 6 out of 6 changed files in this pull request and generated 4 comments.

Comment thread modules/overrides/extension.go
Comment thread modules/overrides/runtime_config_overrides.go
Comment thread modules/overrides/config.go
Comment thread modules/overrides/config_legacy.go Outdated
Copilot AI review requested due to automatic review settings March 24, 2026 13:35
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 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread modules/overrides/config_legacy.go Outdated
Copilot AI review requested due to automatic review settings March 25, 2026 13:43
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 6 out of 6 changed files in this pull request and generated 2 comments.

Comment thread modules/overrides/extension.go
Comment thread modules/overrides/extension.go
@stoewer stoewer changed the title [WIP] Add extension mechanism for Temp's per-tenant Overrides Add extension mechanism for Temp's per-tenant Overrides Mar 25, 2026
@stoewer stoewer requested a review from Copilot March 25, 2026 14:01
@stoewer stoewer changed the title Add extension mechanism for Temp's per-tenant Overrides Add extension mechanism for per-tenant Overrides Mar 25, 2026
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 6 out of 6 changed files in this pull request and generated 2 comments.

Comment thread modules/overrides/extension.go
Comment on lines +141 to +146
// Already a typed Extension (set programmatically or after legacy conversion)
if ext, alreadyTyped := raw.(Extension); alreadyTyped {
if err := ext.Validate(); err != nil {
return &extensionError{fmt.Errorf("extension %q: %w", key, err)}
}
continue
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

In processExtensions, the "already typed" fast-path validates the Extension but does not verify that the map key matches the extension's declared Key(). If a caller programmatically stores a typed instance under the wrong key, it will validate successfully but later marshal/unmarshal behavior will be inconsistent and hard to debug.

Consider rejecting this case by checking ext.Key() == key and returning an error (wrapped as extensionError) when it doesn't match.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is negligible in my opinion

@stoewer stoewer marked this pull request as ready for review March 25, 2026 14:31
@stoewer stoewer requested a review from mdisibio as a code owner March 25, 2026 14:31
Copilot AI review requested due to automatic review settings March 25, 2026 14:31
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 7 out of 7 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 36bde18a28

ℹ️ 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".

Comment thread modules/overrides/extension.go
Copy link
Copy Markdown
Contributor

@ie-pham ie-pham left a comment

Choose a reason for hiding this comment

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

LGTM. nice addition!

@stoewer stoewer merged commit a0b6a3e into grafana:main Mar 31, 2026
27 checks passed
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.

3 participants