-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Description
Component(s)
extension/encoding/awslogsencoding
Describe the issue you're reporting
Overview
In the current implementation of the CloudTrail unmarshaling logic, there's double buffering of the input data.
This is inefficient and can create unwanted memory pressure.
Solution
I am proposing the following,
- Detect CloudWatch log type by peaking into the input stream
- Detect unmarshaling type based on the JSON key
- Unmarshal using the input stream
I have tested above in a local setup and have observed ~45% memory usage reduction with current benchmark test (using 1000 log)
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.
Footnotes
-
https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/6719e7af8de36f2b5e07ce602eb13996d2933017/extension/encoding/awslogsencodingextension/internal/unmarshaler/cloudtraillog/unmarshaler.go#L144 ↩
-
https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/6719e7af8de36f2b5e07ce602eb13996d2933017/extension/encoding/awslogsencodingextension/internal/unmarshaler/cloudtraillog/unmarshaler.go#L149-L151 ↩
-
https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/6719e7af8de36f2b5e07ce602eb13996d2933017/extension/encoding/awslogsencodingextension/internal/unmarshaler/cloudtraillog/unmarshaler.go#L159-L161 ↩