Skip to content

Commit 0a6d574

Browse files
committed
Set default compression algos specifically
1 parent 690d62e commit 0a6d574

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

receiver/libhoneyreceiver/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The following settings are required:
2828

2929
- `http`
3030
- `endpoint` must set an endpoint. Defaults to `127.0.0.1:8080`
31-
- `compression_algorithms` (optional): List of supported compression algorithms. Defaults to `["", "gzip", "zstd", "zlib", "snappy", "deflate"]`. Set to `[]` to disable automatic decompression.
31+
- `compression_algorithms` (optional): List of supported compression algorithms. Defaults to `["", "gzip", "zstd", "zlib", "deflate"]`. Set to `[]` to disable automatic decompression.
3232
- `resources`: if the `service.name` field is different, map it here.
3333
- `scopes`: to get the `library.name` and `library.version` set in the scope section, set them here.
3434
- `attributes`: if the other trace-related data have different keys, map them here, defaults are otlp-like field names.

receiver/libhoneyreceiver/factory.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func createDefaultConfig() component.Config {
4242
HTTP: configoptional.Default(HTTPConfig{
4343
ServerConfig: confighttp.ServerConfig{
4444
Endpoint: endpointStr,
45-
CompressionAlgorithms: []string{},
45+
CompressionAlgorithms: []string{"", "zstd", "gzip", "deflate"},
4646
},
4747
TracesURLPaths: defaultTracesURLPaths,
4848
}),

receiver/libhoneyreceiver/receiver_test.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,18 @@ func TestLibhoneyReceiver_ZstdDecompressionPanic(t *testing.T) {
588588
expectErrorCode: 200,
589589
description: "JSON processing handles nil MsgPackTimestamp correctly after fix",
590590
},
591+
{
592+
name: "real_libhoney_json_format",
593+
createPayload: func() []byte {
594+
// Real JSON format as sent by libhoney clients (S3 handler, etc)
595+
// Note: time is at root level, all fields under "data"
596+
// This format bypasses custom UnmarshalJSON, leaving MsgPackTimestamp nil
597+
return []byte(`[{"data":{"message":"test event from S3","aws.s3.bucket":"test-bucket"},"samplerate":1,"time":"2025-09-24T15:03:49.883965174Z"}]`)
598+
},
599+
expectPanic: false,
600+
expectErrorCode: 200,
601+
description: "Real libhoney JSON format should be handled without panic",
602+
},
591603
{
592604
name: "valid_msgpack_data",
593605
createPayload: func() []byte {
@@ -627,7 +639,7 @@ func TestLibhoneyReceiver_ZstdDecompressionPanic(t *testing.T) {
627639
var contentType string
628640

629641
switch tt.name {
630-
case "valid_json_data_nil_pointer_bug":
642+
case "valid_json_data_nil_pointer_bug", "real_libhoney_json_format":
631643
reqBody = bytes.NewReader(payload)
632644
contentType = "application/json"
633645
case "valid_msgpack_data":
@@ -647,7 +659,7 @@ func TestLibhoneyReceiver_ZstdDecompressionPanic(t *testing.T) {
647659
req.Header.Set("Content-Type", contentType)
648660

649661
// Only set compression headers for zstd tests
650-
if tt.name != "valid_json_data_nil_pointer_bug" && tt.name != "valid_msgpack_data" {
662+
if tt.name != "valid_json_data_nil_pointer_bug" && tt.name != "valid_msgpack_data" && tt.name != "real_libhoney_json_format" {
651663
req.Header.Set("Content-Encoding", "zstd")
652664
}
653665

0 commit comments

Comments
 (0)