Skip to content

Commit

Permalink
Use resource attribute data_stream.*
Browse files Browse the repository at this point in the history
  • Loading branch information
carsonip committed Jan 16, 2024
1 parent 37f7909 commit 1f133b0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions input/otlp/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,8 @@ func TestConsumerConsumeOTelEventLogs(t *testing.T) {
resourceLogs := logs.ResourceLogs().AppendEmpty()
resourceAttrs := logs.ResourceLogs().At(0).Resource().Attributes()
resourceAttrs.PutStr(semconv.AttributeTelemetrySDKLanguage, "swift")
resourceAttrs.PutStr("data_stream.dataset", "dataset")
resourceAttrs.PutStr("data_stream.namespace", "namespace")
scopeLogs := resourceLogs.ScopeLogs().AppendEmpty()

record1 := newLogRecord("") // no log body
Expand Down
12 changes: 12 additions & 0 deletions input/otlp/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,18 @@ func translateResourceMetadata(resource pcommon.Resource, out *modelpb.APMEvent)
case "telemetry.sdk.elastic_export_timestamp":
// Do nothing.

// data_stream.*
case attributeDataStreamDataset:
if out.DataStream == nil {
out.DataStream = modelpb.DataStreamFromVTPool()
}
out.DataStream.Dataset = v.Str()
case attributeDataStreamNamespace:
if out.DataStream == nil {
out.DataStream = modelpb.DataStreamFromVTPool()
}
out.DataStream.Namespace = v.Str()

default:
if out.Labels == nil {
out.Labels = make(modelpb.Labels)
Expand Down

0 comments on commit 1f133b0

Please sign in to comment.