@@ -99,6 +99,40 @@ func TestLogsExporter(t *testing.T) {
99
99
},
100
100
expectedTags : [][]string {{"otel_source:datadog_agent" }},
101
101
},
102
+ {
103
+ name : "resource-attribute-source" ,
104
+ args : args {
105
+ ld : func () plog.Logs {
106
+ l := testutil .GenerateLogsOneLogRecord ()
107
+ rl := l .ResourceLogs ().At (0 )
108
+ resourceAttrs := rl .Resource ().Attributes ()
109
+ resourceAttrs .PutStr ("datadog.log.source" , "custom_source_rattr" )
110
+ return l
111
+ }(),
112
+ otelSource : otelSource ,
113
+ logSourceName : "custom_source_rattr" ,
114
+ },
115
+
116
+ want : testutil.JSONLogs {
117
+ {
118
+ "message" : "This is a log message" ,
119
+ "app" : "server" ,
120
+ "instance_num" : "1" ,
121
+ "datadog.log.source" : "custom_source_rattr" ,
122
+ "@timestamp" : testutil .TestLogTime .Format ("2006-01-02T15:04:05.000Z07:00" ),
123
+ "status" : "Info" ,
124
+ "dd.span_id" : fmt .Sprintf ("%d" , spanIDToUint64 (ld .SpanID ())),
125
+ "dd.trace_id" : fmt .Sprintf ("%d" , traceIDToUint64 (ld .TraceID ())),
126
+ "otel.severity_text" : "Info" ,
127
+ "otel.severity_number" : "9" ,
128
+ "otel.span_id" : spanIDToHexOrEmptyString (ld .SpanID ()),
129
+ "otel.trace_id" : traceIDToHexOrEmptyString (ld .TraceID ()),
130
+ "otel.timestamp" : fmt .Sprintf ("%d" , testutil .TestLogTime .UnixNano ()),
131
+ "resource-attr" : "resource-attr-val-1" ,
132
+ },
133
+ },
134
+ expectedTags : [][]string {{"otel_source:datadog_agent" }},
135
+ },
102
136
{
103
137
name : "ddtags" ,
104
138
args : args {
0 commit comments