Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor opt: minor optimization to the orca parser #36492

Merged

Conversation

wbpcode
Copy link
Member

@wbpcode wbpcode commented Oct 8, 2024

Commit Message: minor opt: minor optimization to the orca parser
Additional Description:

By this way, the parser needn't to scan the whole header value if the header value has invalid format. And the we needn't create a copy of the header value for json format now.

Risk Level: low.
Testing: n/a.
Docs Changes: n/a.
Release Notes: n/a.
Platform Specific Features: n/a.

@alyssawilk
Copy link
Contributor

/wait-any on CI

Copy link
Contributor

@adisuissa adisuissa left a comment

Choose a reason for hiding this comment

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

Thanks!
Overall LGTM, modulo minor comment.
Assigning Blake as the original contributor of this code.
/assign @blake-snyder

#else
IS_ENVOY_BUG("JSON formatted ORCA header support not implemented for this build");
#endif // !ENVOY_ENABLE_FULL_PROTOS || !ENVOY_ENABLE_YAML
} else {
return absl::InvalidArgumentError(
fmt::format("unsupported ORCA header format: {}", split_header.first));
return absl::InvalidArgumentError(fmt::format("unsupported ORCA header format"));
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd consider keeping some string as part of the error.
I think it makes sense to keep the minimum between the first 5 characters, and the prefix up to the first occurrence of a " " (the delimiter).
It makes it easier to debug if/when things go wrong with an external upstream server.

Copy link
Member Author

Choose a reason for hiding this comment

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

SGTM.

@adisuissa
Copy link
Contributor

/wait-any on CI

@alyssawilk
Copy link
Contributor

(yeah I just invited blake to the org but I think it hasn't gone through yet =P)

Signed-off-by: wangbaiping <[email protected]>
Signed-off-by: wangbaiping <[email protected]>
@wbpcode
Copy link
Member Author

wbpcode commented Oct 10, 2024

block by #36525

Signed-off-by: wangbaiping <[email protected]>
@wbpcode
Copy link
Member Author

wbpcode commented Oct 11, 2024

gently ping @blake-snyder cc @alyssawilk

Copy link
Contributor

@adisuissa adisuissa left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@wbpcode
Copy link
Member Author

wbpcode commented Oct 12, 2024

cc @adisuissa @blake-snyder thanks for the approvals 🌷

@wbpcode
Copy link
Member Author

wbpcode commented Oct 12, 2024

cc @alyssawilk friendly ping for an approval from senior maintainer because this change the core code. :)

Copy link
Contributor

@alyssawilk alyssawilk left a comment

Choose a reason for hiding this comment

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

LGTM but general question is why is this in core espeically if it's not being used? May be a question for @blake-snyder

@wbpcode
Copy link
Member Author

wbpcode commented Oct 14, 2024

LGTM but general question is why is this in core espeically if it's not being used? May be a question for @blake-snyder

I think this should has been used by the orca related features?

@wbpcode wbpcode merged commit 004401b into envoyproxy:main Oct 14, 2024
21 checks passed
@blake-snyder
Copy link
Contributor

LGTM but general question is why is this in core espeically if it's not being used? May be a question for @blake-snyder

This is currently used during ORCA header processing: https://github.com/envoyproxy/envoy/blob/main/source/common/router/router.cc#L2131

@wbpcode wbpcode deleted the dev-minor-optimization-to-orca-header-parsings branch October 15, 2024 02:14
grnmeira pushed a commit to grnmeira/envoy that referenced this pull request Oct 17, 2024
Commit Message: minor opt: minor optimization to the orca parser
Additional Description:

By this way, the parser needn't to scan the whole header value if the
header value has invalid format. And the we needn't create a copy of the
header value for json format now.

Risk Level: low.
Testing: n/a.
Docs Changes: n/a.
Release Notes: n/a.
Platform Specific Features: n/a.

---------

Signed-off-by: wangbaiping <[email protected]>
Signed-off-by: Gustavo <[email protected]>
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