Skip to content

Commit 5abe3af

Browse files
authored
feat(profiler): switch to zstd compression by default (#3970)
1 parent a42a2ba commit 5abe3af

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

profiler/compression.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func legacyCompressionStrategy(pt ProfileType, isDelta bool) (compression, compr
4545
}
4646

4747
func compressionStrategy(pt ProfileType, isDelta bool, config string) (compression, compression) {
48-
if config == "" {
48+
if config == "" || config == "legacy" {
4949
return legacyCompressionStrategy(pt, isDelta)
5050
}
5151
algorithm, levelStr, _ := strings.Cut(config, "-")

profiler/options.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package profiler
77

88
import (
9+
"cmp"
910
"context"
1011
"encoding/json"
1112
"fmt"
@@ -187,7 +188,7 @@ func defaultConfig() (*config, error) {
187188
deltaProfiles: internal.BoolEnv("DD_PROFILING_DELTA", true),
188189
logStartup: internal.BoolEnv("DD_TRACE_STARTUP_LOGS", true),
189190
endpointCountEnabled: internal.BoolEnv(traceprof.EndpointCountEnvVar, false),
190-
compressionConfig: env.Get("DD_PROFILING_DEBUG_COMPRESSION_SETTINGS"),
191+
compressionConfig: cmp.Or(env.Get("DD_PROFILING_DEBUG_COMPRESSION_SETTINGS"), "zstd"),
191192
traceConfig: executionTraceConfig{
192193
Enabled: internal.BoolEnv("DD_PROFILING_EXECUTION_TRACE_ENABLED", executionTraceEnabledDefault),
193194
Period: internal.DurationEnv("DD_PROFILING_EXECUTION_TRACE_PERIOD", 15*time.Minute),

profiler/profile_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ main;bar 0 0 8 16
109109
},
110110
}
111111

112+
t.Setenv("DD_PROFILING_DEBUG_COMPRESSION_SETTINGS", "legacy")
112113
for _, test := range tests {
113114
for _, profType := range test.Types {
114115
// deltaProfiler returns an unstarted profiler that is fed prof1
@@ -171,6 +172,7 @@ main;bar 0 0 8 16
171172
}
172173

173174
func TestRunProfile(t *testing.T) {
175+
t.Setenv("DD_PROFILING_DEBUG_COMPRESSION_SETTINGS", "legacy")
174176
// TODO(felixge): These tests are directly calling the internal runProfile()
175177
// function which is brittle. We should refactor them to use the public API.
176178
t.Run("delta", func(t *testing.T) {

profiler/profiler_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,7 @@ func TestExecutionTraceCPUProfileRate(t *testing.T) {
556556
// fatal error: runtime: netpoll failed
557557
cpuProfileRate := int(9999 + rand.Int63n(9999))
558558

559+
t.Setenv("DD_PROFILING_DEBUG_COMPRESSION_SETTINGS", "legacy")
559560
t.Setenv("DD_PROFILING_EXECUTION_TRACE_ENABLED", "true")
560561
t.Setenv("DD_PROFILING_EXECUTION_TRACE_PERIOD", "10ms")
561562
profile := <-startTestProfiler(t, 1,
@@ -912,6 +913,7 @@ func gzipDecompress(data []byte) ([]byte, error) {
912913
}
913914

914915
func TestHeapProfileCompression(t *testing.T) {
916+
t.Setenv("DD_PROFILING_DEBUG_COMPRESSION_SETTINGS", "legacy")
915917
t.Run("delta", func(t *testing.T) { testHeapProfileCompression(t, true) })
916918
t.Run("non-delta", func(t *testing.T) { testHeapProfileCompression(t, false) })
917919
}

0 commit comments

Comments
 (0)