Skip to content

Commit

Permalink
Support TraceId and SpanId propagation when using logdrainer
Browse files Browse the repository at this point in the history
  • Loading branch information
loafoe committed Feb 9, 2023
1 parent abcc2f5 commit 92fad50
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions logdrainer/logdrainer.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ func (l *logDrainerStorer) StoreResources(messages []logging.Resource, count int
syslogMessage.SetParameter("fluent-bit-out-hsdp", "applicationName", l.applicationName)
syslogMessage.SetParameter("fluent-bit-out-hsdp", "serverName", l.serverName)
syslogMessage.SetMessage(string(decoded))
if msg.TraceID != "" || msg.SpanID != "" { // Construct a CustomLogEvent to propagate these
customLogEvent := fmt.Sprintf("%s|CustomLogEvent|%s|%s|%s|%s|%s", msg.Severity, msg.TransactionID, msg.TraceID, msg.SpanID, msg.Component, string(decoded))
syslogMessage.SetMessage(customLogEvent)
}
message, _ := syslogMessage.String()
if l.debug {
fmt.Printf("[out-hsdp] RFC5424: %s\n", message)
Expand Down

0 comments on commit 92fad50

Please sign in to comment.