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

Enable grpc compression for infinite tracing #1383

Merged
merged 5 commits into from
Feb 9, 2023

Conversation

nrcventura
Copy link
Member

@nrcventura nrcventura commented Feb 8, 2023

Thank you for submitting a pull request. Please review our contributing guidelines and code of conduct.

Description

Enables gzip compression by default to reduce the amount of bytes in transit, and adds a configuration setting to turn off the compression.

Author Checklist

  • Unit tests, Integration tests, and Unbounded tests completed
  • [ ] Performance testing completed with satisfactory results (if required) There is a separate issue covering performance testing
  • Agent Changelog or Lambda Agent changelog updated

Reviewer Checklist

  • Perform code review
  • Pull request was adequately tested (new/existing tests, performance tests)
  • Review Changelog

Copy link
Contributor

@JcolemanNR JcolemanNR left a comment

Choose a reason for hiding this comment

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

Nice! I think this still needs the supportability metric for compression enabled/disabled, and possibly some integration test coverage for Infinite tracing when compression is disabled. I'm not sure how to do it, but it would be nice if the integration tests verified that the grpc streams were actually compressed/uncompressed when the grpc-internal-encoding-request header is set. My thinking is that our current tests would not catch it if we upgraded to a version of Grpc.Net that did not support the grpc-internal-encoding-request header. Not sure if that's something we are concerned about.

@nrcventura
Copy link
Member Author

Nice! I think this still needs the supportability metric for compression enabled/disabled, and possibly some integration test coverage for Infinite tracing when compression is disabled. I'm not sure how to do it, but it would be nice if the integration tests verified that the grpc streams were actually compressed/uncompressed when the grpc-internal-encoding-request header is set. My thinking is that our current tests would not catch it if we upgraded to a version of Grpc.Net that did not support the grpc-internal-encoding-request header. Not sure if that's something we are concerned about.

  • I plan on submitting a follow up PR that adds the supportability metric.
  • I did not see any added value in having an integration test that covers the compression logic, because I did not find a reasonable method to detect whether or not compression was used. On the client side, compression is meant to be transparent. In theory you can enable and sniff the grpc logs, but those logs are very verbose and difficult to enable and capture within the agent. If we stood up a mock trace observer, we can either look at raw http headers (which are only visible in the aspnetcore grpc dotnet implementation) or via the grpc logs. I was unable to get grpc core to connect to a mock trace observer that leverages aspnetcore and grpc dotnet. The grpc logs were also very verbose. So given those complexities, I think that it is better to just acknowledge the potential risk (that compression may not work) than to significantly increase the complexity of the infinite tracing tests.

These metadata headers that begin with grpc are treated as special headers by grpc libraries. They are meant to control grpc behavior on a per-call basis. As such, some of those headers are not included in the raw http communication. The few that are included in the raw http communication are meant to control grpc library behavior on the server, and are actually removed from the header collection on the server. The header that we're leveraging is one of the special headers that does not get sent with the http communication. grpc-encoding is the header that is ultimately sent with the http communication, so that the grpc library on the server knows that it needs to decode the bytes using the appropriate decoder before deserializing the protobuf payload. grpc-encoding is not visible in the header collection by the time the data is sent to the code we have control over.

@nrcventura nrcventura marked this pull request as ready for review February 8, 2023 22:27
@nrcventura nrcventura requested a review from a team February 8, 2023 22:27
@angelatan2 angelatan2 requested a review from chynesNR February 8, 2023 23:01
@nrcventura nrcventura merged commit 75fac69 into feature/grpc-hybrid-solution Feb 9, 2023
@nrcventura nrcventura deleted the grpc-enable-compression branch February 9, 2023 00:47
chynesNR added a commit that referenced this pull request Feb 14, 2023
* Remove grpc-dotnet binaries from Linux build
* Remove gRPC binaries from core agent, upgrade gRPC packages (#1368)
* Remove Grpc native dlls from .NET Core agent (on windows)
* ILRepack Microsoft.Extensions.Logging.Abstractions for grpc-dotnet (#1375)
* Update grpc stream cancelled due to in-activity log message (#1378)
* Update changelog
* Add missing error metrics and stabilize Infinite Tracing integration tests  (#1379)
* Enable grpc compression for infinite tracing (#1383)
* Add Infinite Tracing compression supportability metric (#1385)
* Add warning when grpc_proxy is detected (#1387)
* Delay retries when 'internal' gRPC errors are encountered (#1388)

---------

Co-authored-by: chynesNR <chynes@newrelic.com>
Co-authored-by: Marty Tippin <120425148+tippmar-nr@users.noreply.github.com>
Co-authored-by: Jacob Affinito <jaffinito@newrelic.com>
Co-authored-by: Chris Ventura <45495992+nrcventura@users.noreply.github.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.

3 participants