fix: attributes incorrectly added as extra fields in gelf

This commit is contained in:
Natalia Goc 2024-09-24 16:24:19 +02:00
parent 4654238920
commit 0f866a0ded

View File

@ -79,8 +79,7 @@ func (e *Exporter) ExportSpans(ctx context.Context, spans []trace.ReadOnlySpan)
Timestamp: stub.StartTime,
// Defaults to ALERT since we consider lack of the level a serious error that should be fixed ASAP.
// Otherwise some dangerous unexpected behaviour could go unnoticed.
Level: syslog.ALERT,
ExtraFields: attributes,
Level: syslog.ALERT,
}
for _, attrKV := range event.Attributes {
if attrKV.Key == attr.LogMessageLongKey {
@ -100,6 +99,7 @@ func (e *Exporter) ExportSpans(ctx context.Context, spans []trace.ReadOnlySpan)
attributes[string(attrKV.Key)] = GetByType(attrKV.Value)
}
gelf.ExtraFields = attributes
Log(e.gelfWriter, gelf)
}