Skip to content

Compress otlp payload with zlib#87

Open
wperron wants to merge 2 commits intoyangxikun:mainfrom
wperron:otlp-zlib
Open

Compress otlp payload with zlib#87
wperron wants to merge 2 commits intoyangxikun:mainfrom
wperron:otlp-zlib

Conversation

@wperron
Copy link

@wperron wperron commented Feb 2, 2024

Adds gzip compression to the HTTP client.

Also updates the local otel-collector and docker-compose configurations, some of the configs have been renamed and OTLP support was added to Jaeger since the last update.

I've tested this locally, but I'm having trouble running the integration test suite, I'm hoping the GitHub Action will work OK.

Fixes #71

Fixes yangxikun#71

Also updates the otel-collector configuration file:

* The `logging` exporter was renamed to `debug`
* Jaeger now supports receiving OTLP traffic which makes things simpler
@wperron wperron marked this pull request as ready for review February 5, 2024 13:46
@yangxikun
Copy link
Owner

@plantfansam Could you review this PR?

@wperron wperron force-pushed the otlp-zlib branch 2 times, most recently from 01e73b6 to fa1d69a Compare February 7, 2024 14:09
@wperron wperron requested a review from plantfansam February 7, 2024 14:10
@wperron wperron force-pushed the otlp-zlib branch 2 times, most recently from 82ff258 to 1cfc5d1 Compare February 7, 2024 15:49
-- the compression should be set to Best Compression and window size
-- should be set to 15+16, see reference below:
-- https://github.com/brimworks/lua-zlib/issues/4#issuecomment-26383801
local deflate_stream = zlib.deflate(zlib.BEST_COMPRESSION, 15+16)
Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking about this a bit more ... I think we should figure out how to do the compression in the otlp exporter's call_collector method. This is because requests to the collector can retry multiple times, and we don't want to re-gzip the payload each time. That's what we do with protobuf encoding (see

res, res_error = exporter.client:do_request(pb_encoded_body)
and
return call_collector(self, pb.encode(body))
)

Copy link
Author

Choose a reason for hiding this comment

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

sounds good, shouldn't be hard 👍

Copy link
Author

Choose a reason for hiding this comment

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

I moved the compression to the otlp exporter and adjusted the tests, I think it looks good, I am a bit worried that it pushes complexity into the worker init block but I'll you be the judge of that.

return setmetatable(self, mt)
end

function _M.do_request(self, body)
Copy link
Owner

Choose a reason for hiding this comment

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

Can we consider change do_request(self, body) to do_request(self, body, additional_headers).
Then call do_request(body, ["Content-Encoding": "gzip"]) if gzip is enabled.

else
otel_global.metrics_reporter:record_value(
exporter_request_uncompressed_payload_size, string.len(pb_encoded_body))
end
Copy link
Owner

Choose a reason for hiding this comment

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

The gzip logic should move out while loop.

rdooley pushed a commit to rdooley/opentelemetry-lua that referenced this pull request Mar 14, 2024
rdooley pushed a commit to rdooley/opentelemetry-lua that referenced this pull request Mar 14, 2024
rdooley pushed a commit to rdooley/opentelemetry-lua that referenced this pull request Mar 14, 2024
rdooley pushed a commit to rdooley/opentelemetry-lua that referenced this pull request Mar 19, 2024
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.

Add option to gzip payload sent to collector

3 participants