Skip to content

Commit

Permalink
check error on FromRaw return
Browse files Browse the repository at this point in the history
  • Loading branch information
Caleb-Hurshman authored and djaglowski committed Jun 21, 2023
1 parent 7ed6cd4 commit 48dd7d9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 0 additions & 1 deletion receiver/kafkareceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
[observiq]: https://github.com/observIQ/observiq-otel-collector
[splunk]: https://github.com/signalfx/splunk-otel-collector
[sumo]: https://github.com/SumoLogic/sumologic-otel-collector

<!-- end autogenerated section -->

Kafka receiver receives traces, metrics, and logs from Kafka. Message payload encoding is configurable.
Expand Down
5 changes: 3 additions & 2 deletions receiver/kafkareceiver/json_unmarshaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ func (r *jsonLogsUnmarshaler) Unmarshal(buf []byte) (plog.Logs, error) {
logRecords.SetObservedTimestamp(pcommon.NewTimestampFromTime(time.Now()))

// Set the unmarshaled jsonVal as the body of the log record
logRecords.Body().SetEmptyMap().FromRaw(jsonVal)

if err := logRecords.Body().SetEmptyMap().FromRaw(jsonVal); err != nil {
return p, err
}
return p, nil
}

Expand Down
2 changes: 1 addition & 1 deletion receiver/kafkareceiver/testdata/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ kafka:
backoff: 5s
kafka/logs:
topic: logs
encoding: text
encoding: direct
brokers:
- "coffee:123"
- "foobar:456"
Expand Down

0 comments on commit 48dd7d9

Please sign in to comment.