diff --git a/app/vlinsert/opentelemetry/opentelemetry_test.go b/app/vlinsert/opentelemetry/opentelemetry_test.go index e97bb4f221..bc523303be 100644 --- a/app/vlinsert/opentelemetry/opentelemetry_test.go +++ b/app/vlinsert/opentelemetry/opentelemetry_test.go @@ -356,6 +356,12 @@ func TestPushProtobufRequest(t *testing.T) { timestampsExpected = []int64{1234} resultsExpected = `{"_msg":"[\"Zm9vIGJhcg==\"]","severity":"Unspecified"}` f(data, timestampsExpected, resultsExpected) + + // decode null in ArrayValue + data = `[{"scopeLogs":[{"logRecords":[{"timeUnixNano":1234,"body":{"arrayValue":{"values":[null,{}]}}}]}]}]` + timestampsExpected = []int64{1234} + resultsExpected = `{"_msg":"[null,null]","severity":"Unspecified"}` + f(data, timestampsExpected, resultsExpected) } var mp easyproto.MarshalerPool @@ -430,6 +436,9 @@ type anyValue struct { } func (av *anyValue) marshalProtobuf(mm *easyproto.MessageMarshaler) { + if av == nil { + return + } switch { case av.StringValue != nil: mm.AppendString(1, *av.StringValue) diff --git a/app/vlinsert/opentelemetry/pb_json.go b/app/vlinsert/opentelemetry/pb_json.go index 221196abea..0fcbedfdfd 100644 --- a/app/vlinsert/opentelemetry/pb_json.go +++ b/app/vlinsert/opentelemetry/pb_json.go @@ -125,7 +125,7 @@ func decodeAnyValueToJSON(src []byte, a *fastjson.Arena, fb *fmtBuffer) (*fastjs return a.NewString(v), nil } } - return nil, nil + return a.NewNull(), nil } func decodeKeyValueListToJSON(src []byte, a *fastjson.Arena, fb *fmtBuffer) (*fastjson.Value, error) { diff --git a/docs/victorialogs/CHANGELOG.md b/docs/victorialogs/CHANGELOG.md index 45f3e380a6..7f22d1e352 100644 --- a/docs/victorialogs/CHANGELOG.md +++ b/docs/victorialogs/CHANGELOG.md @@ -23,6 +23,8 @@ according to the follosing docs: * FEATURE: [OpenTelemetry data ingestion](https://docs.victoriametrics.com/victorialogs/data-ingestion/opentelemetry/): parse [`scope` inside ScopeLogs](https://github.com/open-telemetry/opentelemetry-proto/blob/a5f0eac5b802f7ae51dfe41e5116fe5548955e64/opentelemetry/proto/logs/v1/logs.proto#L72) and store it into [log fields](https://docs.victoriametrics.com/victorialogs/keyconcepts/#data-model) starting with `scope.` prefix. See [#826](https://github.com/VictoriaMetrics/VictoriaLogs/issues/826). +* BUGFIX: [OpenTelemetry data ingestion](https://docs.victoriametrics.com/victorialogs/data-ingestion/opentelemetry/): properly handle `null` values inside arrays. Previously, such arrays could cause a panic during ingestion. See [#869](https://github.com/VictoriaMetrics/VictoriaLogs/issues/869#issuecomment-3627177567). + ## [v1.40.0](https://github.com/VictoriaMetrics/VictoriaLogs/releases/tag/v1.40.0) Released at 2025-12-05