newrelic-ruby-agent icon indicating copy to clipboard operation
newrelic-ruby-agent copied to clipboard

Modernize the approach the agent takes to gzip outbound payloads before sending them to the collector

Open fallwith opened this issue 3 years ago • 1 comments

We appear to be using what I hypothesize is a fork of an older version of the Zlib gem's gzip compression logic to gzip our outbound payloads.

We should see if we can modernize our approach while retaining compatibility with all supported Ruby versions.

To gzip some data, we should need only to do this:

require 'zlib'
Zlib.gzip(text)

We may be able to replace the module NewRelic::Agent::Encoders::Compressed::Gzip with the code above. It is used in NewRelic::Agent::Service#compress_request_if_needed

Acceptance Criteria

  • Make sure the included Zlib library works on all agent-supported Ruby versions
  • Run some performance benchmarks between Encoders::Compressed::Gzip.encode(data) and Zlib.gzip to make sure the Zlib.gzip option is more performant

fallwith avatar Oct 28 '22 00:10 fallwith

https://issues.newrelic.com/browse/NEWRELIC-4900