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

request_id_extension: Add noop impl by default #10687

Merged

Conversation

euroelessar
Copy link
Contributor

@euroelessar euroelessar commented Apr 7, 2020

Description: By default use noop RequestIDExtension implementation in StreamInfo. This allows avoiding nullptr checks outside of HTTP context.
Risk Level: low
Testing: added unit test, updated integration test (crashes without StreamInfoImpl changes)
Docs Changes: n/a
Release Notes: n/a
Fixes #10686

Signed-off-by: Ruslan Nigmatullin <elessar@dropbox.com>
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thanks this looks right, thanks. Can you add some tests? Both maybe in the TCP proxy case explicitly and also in stream_info_impl_test to make sure the NOP impl behaves correctly? Thank you!

/wait

@mattklein123 mattklein123 self-assigned this Apr 7, 2020
Signed-off-by: Ruslan Nigmatullin <elessar@dropbox.com>
mattklein123
mattklein123 previously approved these changes Apr 8, 2020
Copy link
Member

@mattklein123 mattklein123 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!

namespace {

// NoopRequestIDExtension is the implementation used outside of HTTP context.
class NoopRequestIDExtension : public RequestIDExtension {
Copy link
Member

Choose a reason for hiding this comment

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

nit: it would be nice to get coverage of the other methods here in the unit test you added.

@@ -20,12 +21,14 @@ struct StreamInfoImpl : public StreamInfo {
StreamInfoImpl(TimeSource& time_source)
: time_source_(time_source), start_time_(time_source.systemTime()),
start_time_monotonic_(time_source.monotonicTime()),
filter_state_(std::make_shared<FilterStateImpl>(FilterState::LifeSpan::FilterChain)) {}
filter_state_(std::make_shared<FilterStateImpl>(FilterState::LifeSpan::FilterChain)),
request_id_extension_(Http::RequestIDExtensionFactory::noopInstance()) {}
Copy link
Member

Choose a reason for hiding this comment

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

looking at this, I think these constructors can mostly be collapsed with each one invoking the previous with fewer arguments. This would be a nice follow up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, will send a follow up pr. Does it need a TODO for the time being?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created #10691, will rebase once this one is merged.

Signed-off-by: Ruslan Nigmatullin <elessar@dropbox.com>
Copy link
Member

@mattklein123 mattklein123 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!

@mattklein123 mattklein123 merged commit dd7e2aa into envoyproxy:master Apr 8, 2020
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.

core dump in AccessLog::RuntimeFilter when RequestIDExtension not set
2 participants