Skip to content

decompressor filter: add bytes reporting to trailers#12477

Merged
junr03 merged 14 commits intoenvoyproxy:masterfrom
junr03:decompressor-trailers
Sep 4, 2020
Merged

decompressor filter: add bytes reporting to trailers#12477
junr03 merged 14 commits intoenvoyproxy:masterfrom
junr03:decompressor-trailers

Conversation

@junr03
Copy link
Member

@junr03 junr03 commented Aug 4, 2020

Commit Message: add bytes reporting to trailers
Additional Description: it is useful for certain experiments to be aware of the compressed/uncompressed size of payloads as they go through the decompressor filter. This PR adds such details to the request/response trailers.
Risk Level: low
Testing: updated unit and integration tests
Docs Changes: updated
Release Notes: updated

Signed-off-by: Jose Nino jnino@lyft.com

Jose Nino added 9 commits August 3, 2020 16:14
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
fmt
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
@junr03 junr03 requested a review from dio as a code owner August 4, 2020 22:50
@junr03 junr03 requested a review from rojkov August 4, 2020 22:51
@junr03
Copy link
Member Author

junr03 commented Aug 4, 2020

@rojkov do you mind taking a pass at this?

@rebello95 if you want to take a pass too.

Signed-off-by: Jose Nino <jnino@lyft.com>
@rojkov
Copy link
Member

rojkov commented Aug 5, 2020

I'm on holidays till the middle of August. I'll be happy to give it a pass later if it's still open.

rebello95
rebello95 previously approved these changes Aug 6, 2020
Copy link
Contributor

@rebello95 rebello95 left a comment

Choose a reason for hiding this comment

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

LGTM overall!

Comment on lines +130 to +135
EXPECT_EQ("30",
response_trailers
.get(Http::LowerCaseString("x-envoy-decompressor-testlib-compressed-bytes"))
->value()
.getStringView());
EXPECT_EQ("60",
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be nice to use different body sizes for request/response to also differentiate

Copy link
Member Author

Choose a reason for hiding this comment

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

sure

decompressor->decompress(input_buffer, output_buffer);

// Report decompression via stats and logging before modifying the input buffer.
byte_tracker.chargeBytes(input_buffer.length(), output_buffer.length());
Copy link
Contributor

Choose a reason for hiding this comment

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

Checking desired behavior: Do we want to only increment byte counts if we actually do decompression (versus regardless of if we do decompression)?

Copy link
Member Author

Choose a reason for hiding this comment

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

you mean if decompress had an issue? Or not doing decompression at all?

Copy link
Contributor

Choose a reason for hiding this comment

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

The latter (i.e., if the response is not compressed)

Copy link
Member Author

Choose a reason for hiding this comment

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

My opinion is that the trailers should only be added if the stream was actually decompressed. So this is correct. But you did make me realize that the decode/encodeTrailers calls were not gated and that was wrong. Fixed in: 540a5ae

@junr03 junr03 assigned dio and unassigned rojkov Aug 6, 2020
@junr03
Copy link
Member Author

junr03 commented Aug 6, 2020

@dio do you mind taking a look given @rojkov is out?

Signed-off-by: Jose Nino <jnino@lyft.com>
Comment on lines +103 to +104
// TODO: replace std::vector for std::pair. For some reason the macro is failing to build with a
// multivariate templated type.
Copy link
Member

Choose a reason for hiding this comment

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

+1

dio
dio previously approved these changes Aug 11, 2020
Copy link
Member

@dio dio 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.

Copy link
Member

@rojkov rojkov left a comment

Choose a reason for hiding this comment

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

This looks great! Just one thing to clarify.

@stale
Copy link

stale bot commented Aug 24, 2020

This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot added the stale stalebot believes this issue/PR has not been touched recently label Aug 24, 2020
@stale
Copy link

stale bot commented Aug 31, 2020

This pull request has been automatically closed because it has not had activity in the last 14 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot closed this Aug 31, 2020
Signed-off-by: Jose Nino <jnino@lyft.com>
@junr03 junr03 reopened this Sep 2, 2020
@stale stale bot removed stale stalebot believes this issue/PR has not been touched recently labels Sep 2, 2020
@junr03
Copy link
Member Author

junr03 commented Sep 2, 2020

coming back to this after being completely occupied otherwise.

Jose Nino added 2 commits September 2, 2020 14:58
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
@junr03
Copy link
Member Author

junr03 commented Sep 2, 2020

@dio can I get a re-review now that I updated and de-staled the PR?

Copy link
Member

@dio dio left a comment

Choose a reason for hiding this comment

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

Thanks. Looks good!

@junr03 junr03 merged commit 02e7f64 into envoyproxy:master Sep 4, 2020
rebello95 added a commit to envoyproxy/envoy-mobile that referenced this pull request Sep 14, 2020
Bumping primarily to include the changes from envoyproxy/envoy#12477 for decompressor trailers reporting.

Contains changes to fix compilation after:
- envoyproxy/envoy@d245c02
- envoyproxy/envoy@52ec66f

Also contains new fixes required by Envoy Mobile:
- envoyproxy/envoy#13039
- envoyproxy/envoy#13040

Signed-off-by: Michael Rebello <me@michaelrebello.com>
jpsim pushed a commit that referenced this pull request Nov 28, 2022
Bumping primarily to include the changes from #12477 for decompressor trailers reporting.

Contains changes to fix compilation after:
- d245c02
- 52ec66f

Also contains new fixes required by Envoy Mobile:
- #13039
- #13040

Signed-off-by: Michael Rebello <me@michaelrebello.com>
Signed-off-by: JP Simard <jp@jpsim.com>
jpsim pushed a commit that referenced this pull request Nov 29, 2022
Bumping primarily to include the changes from #12477 for decompressor trailers reporting.

Contains changes to fix compilation after:
- d245c02
- 52ec66f

Also contains new fixes required by Envoy Mobile:
- #13039
- #13040

Signed-off-by: Michael Rebello <me@michaelrebello.com>
Signed-off-by: JP Simard <jp@jpsim.com>
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