Skip to content

formatter: removed legacy router formatter support#41039

Merged
wbpcode merged 7 commits intoenvoyproxy:mainfrom
wbpcode:dev-remove-the-legacy-formatter-support
Sep 24, 2025
Merged

formatter: removed legacy router formatter support#41039
wbpcode merged 7 commits intoenvoyproxy:mainfrom
wbpcode:dev-remove-the-legacy-formatter-support

Conversation

@wbpcode
Copy link
Copy Markdown
Member

@wbpcode wbpcode commented Sep 10, 2025

Commit Message: formatter: removed legacy router formatter support
Additional Description:

Three yeas ago, at #21932, we unified all the formatters to the substitution formatter. And we add a warn log for the legacy UPSTREAM_METADATA and DYNAMIC_METADATA.

Now, I think it's time to remove it finally. This PR Removed legacy header formatter support for %DYNAMIC_METADATA(["namespace", "key", ...])% and %UPSTREAM_METADATA(["namespace", "key", ...])%. Please use %DYNAMIC_METADATA(namespace:key:...])% and %UPSTREAM_METADATA(namespace:key:...])% as alternatives.
This change can be reverted temporarily by setting the runtime guard envoy.reloadable_features.remove_legacy_route_formatter to false.

Risk Level: low.
Testing: unit.
Docs Changes: n/a.
Release Notes: added.

Signed-off-by: WangBaiping <wbphub@gmail.com>
@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/runtime-guard-changes: FYI only for changes made to (source/common/runtime/runtime_features.cc).

🐱

Caused by: #41039 was opened by wbpcode.

see: more, trace.

Signed-off-by: WangBaiping <wbphub@gmail.com>
@wbpcode
Copy link
Copy Markdown
Member Author

wbpcode commented Sep 11, 2025

/retest

Signed-off-by: WangBaiping <wbphub@gmail.com>
Signed-off-by: WangBaiping <wbphub@gmail.com>
Copy link
Copy Markdown
Member

@zuercher zuercher left a comment

Choose a reason for hiding this comment

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

Some minor things, but generally looks good.

return Envoy::Formatter::FormatterImpl::create(final_header_value, true);
}

// Let the substitution formatter parse the final_header_value.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: just header_value in the comment.

Comment on lines +1883 to +1889
{"PER_REQUEST_STATE",
{CommandSyntaxChecker::PARAMS_REQUIRED,
[](absl::string_view format, absl::optional<size_t>) {
// PER_REQUEST_STATE(KEY) == FILTER_STATE(KEY:PLAIN)
// Mainly for backward compatibility.
return std::make_unique<FilterStateFormatter>(format, absl::nullopt, true);
}}},
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since we log it was obsoleted. should this one be gated on a feature flag as well?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I am a little not sure about this, actually. As you can see, to keep the PER_REQUEST_STATE is pretty cheap. It's a little different with the DYNAMIC_METADATA because the legacy DYNAMIC_METADATA has completely different format parsing logic.

So, I inclined to keep this (as a special undocumented support) and only deprecate/remove the legacy DYNAMIC_METADATA as the change log.

WDYT?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we should eventually remove it, but I'm ok if you don't want to do it right now.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

then thing could be simpler. I will refactor the PR tomorrow

Signed-off-by: WangBaiping <wbphub@gmail.com>
Signed-off-by: WangBaiping <wbphub@gmail.com>
Signed-off-by: WangBaiping <wbphub@gmail.com>
@wbpcode
Copy link
Copy Markdown
Member Author

wbpcode commented Sep 12, 2025

/retest

@wbpcode wbpcode enabled auto-merge (squash) September 16, 2025 03:26
@wbpcode
Copy link
Copy Markdown
Member Author

wbpcode commented Sep 18, 2025

friendly ping a new review cc @zuercher

@wbpcode wbpcode merged commit d3b102f into envoyproxy:main Sep 24, 2025
25 checks passed
@wbpcode wbpcode deleted the dev-remove-the-legacy-formatter-support branch September 25, 2025 08:17
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.

2 participants