-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[APR-258] Add option to compress logs with zstd #27148
Conversation
Signed-off-by: Stephen Wakely <[email protected]>
Signed-off-by: Stephen Wakely <[email protected]>
Signed-off-by: Stephen Wakely <[email protected]>
Test changes on VMUse this command from test-infra-definitions to manually test this PR changes on a VM: inv aws.create-vm --pipeline-id=53201356 --os-family=ubuntu Note: This applies to commit fdc16ca |
Signed-off-by: Stephen Wakely <[email protected]>
Signed-off-by: Stephen Wakely <[email protected]>
Go Package Import DifferencesBaseline: 9e36fae
|
Signed-off-by: Stephen Wakely <[email protected]>
Signed-off-by: Stephen Wakely <[email protected]>
Signed-off-by: Stephen Wakely <[email protected]>
Signed-off-by: Stephen Wakely <[email protected]>
Signed-off-by: Stephen Wakely <[email protected]>
Signed-off-by: Stephen Wakely <[email protected]>
Signed-off-by: Stephen Wakely <[email protected]>
Signed-off-by: Stephen Wakely <[email protected]>
Signed-off-by: Stephen Wakely <[email protected]>
Signed-off-by: Stephen Wakely <[email protected]>
Signed-off-by: Stephen Wakely <[email protected]>
Signed-off-by: Stephen Wakely <[email protected]>
Signed-off-by: Stephen Wakely <[email protected]>
Signed-off-by: Stephen Wakely <[email protected]>
Signed-off-by: Stephen Wakely <[email protected]>
Signed-off-by: Stephen Wakely <[email protected]>
Signed-off-by: Stephen Wakely <[email protected]>
Signed-off-by: Stephen Wakely <[email protected]>
Signed-off-by: Stephen Wakely <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice PR with well written code!
Note: I have use Request changes
because there is a TODO
in the code
CompressionLevel int `mapstructure:"compression_level" json:"compression_level"` | ||
UseCompression bool `mapstructure:"use_compression" json:"use_compression"` | ||
CompressionKind string `mapstructure:"compression_kind" json:"compression_kind"` | ||
CompressionLevel int `mapstructure:"compression_level" json:"compression_level"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also have zstd_compression_level
here? (and in the endpoint constructor below)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CompressionLevel
gets set to either compression_level
or zstd_compression_level
earlier on in the process since there's not a need to have two separate fields at this stage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. I forget that additional_endpoints
inherit the compression strategy from the main endpoint.
However this opens up a followup question, is there a use case where an additional endpoint would use a different compression strategy than the main endpoint? (ex if an on-prem log collector/proxy doesn't support zstd, and we enable zstd by default for the main endpoint).
We can probably track this as a followup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a good question. I think we have been looking towards only supporting one compression strategy throughout the agent (both metrics and logs). It just makes things simpler. So if there is a case where we should allow multiple at the same time, we should find out about these now.
Signed-off-by: Stephen Wakely <[email protected]>
Signed-off-by: Stephen Wakely <[email protected]>
@@ -474,6 +473,7 @@ func getSharedFxOption() fx.Option { | |||
networkpath.Bundle(), | |||
remoteagentregistryfx.Module(), | |||
haagentfx.Module(), | |||
metricscompressorfx.Module(), | |||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason we don't need the logscompression.Module()
here? (while for instance we need it in the JMX command. FWIW it seems we need it in all other commands)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is being provided by process.Bundle()
. It needs to be in this bundle, because that also includes the eventplatformimpl
component which needs the logscompression
component.
@@ -125,7 +129,7 @@ func runAgent(tagger tagger.Component) { | |||
|
|||
go startTraceAgent(&wg, lambdaSpanChan, coldStartSpanId, serverlessDaemon, tagger, rcService) | |||
go startOtlpAgent(&wg, metricAgent, serverlessDaemon, tagger) | |||
go startTelemetryCollection(&wg, serverlessID, logChannel, serverlessDaemon, tagger) | |||
go startTelemetryCollection(&wg, serverlessID, logChannel, serverlessDaemon, tagger, compression) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know how's serverless sending this telemetry? Through logs? Otherwise why are we providing a logs compression module here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so. It sets it up here.
Signed-off-by: Stephen Wakely <[email protected]>
Signed-off-by: Stephen Wakely <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ for Windows Agent files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll let the review of the components part to our specialists, but from an APR perspective, LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok for devx files
Signed-off-by: Stephen Wakely <[email protected]>
Serverless Benchmark Results
tl;drUse these benchmarks as an insight tool during development.
What is this benchmarking?The The benchmark is run using a large variety of lambda request payloads. In the charts below, there is one row for each event payload type. How do I interpret these charts?The charts below comes from The benchstat docs explain how to interpret these charts.
I need more helpFirst off, do not worry if the benchmarks are failing. They are not tests. The intention is for them to be a tool for you to use during development. If you would like a hand interpreting the results come chat with us in Benchmark stats
|
/merge |
Devflow running:
|
What does this PR do?
This adds a config option to compress log payloads with
zstd
. We have a new option:compression_kind
defaults togzip
if not specified. This was the only compression used previously.Motivation
Additional Notes
To make this change, in the interests of reusing code, I have moved the previous
gzip
code used for logs into thecomp/serializer/compression
component. This component is currently used by metrics. I have had to add extra functionality to limit the available compression algorithms since metrics only allowszlib
andzstd
and logs only allowszstd
andgzip
.I'm not totally convinced that I have done this in a idiomatic way, so would appreciate feedback.
Note: We've discussed the compenitization with @DataDog/agent-shared-components , who wants some refactoring, but we'll do this after this is merged so that we can have zstd for logs available for testing.
Possible Drawbacks / Trade-offs
Describe how to test/QA your changes
Configure the agent with:
Configure the agent to tail a file:
Add some text to
/tmp/zorkdork.log
, ensure the logs are sent to Datadog and are decompressed correctly.QA for the open telemetry team
Can you make sure the otel collector can process logs correctly. Hopefully the
fx
components are wired up as you need them.