Skip to content

[BUG] contrib/sirupsen/logrus: Span IDs changed and missing support for 128-bit Trace IDs #3324

Open
@diegommm

Description

@diegommm

Tracer Version(s)

1.72.1

Go Version(s)

1.24.1

Bug Report

Span IDs changed

The current version is saving the uint64 values of Span and Trace IDs in the injected logrus entry. With logrus configured to output JSON, they become JSON numbers, and it would appear that some intermediate agent would change those numbers. Examples of changed Span IDs:

Span ID written as JSON number by logrus Observed in DataDog Logs Explorer
289953633037034736 2899536330370347
3651777087658905286 3651777087658905
5454641429838043524 5454641429838043

To solve this, I just called strconv.FormatUint so that those values are converted to JSON string, hence cannot be changed to match any system's precision or whatever problem it would have. They now reach DataDog Logs Explorer as expected.

Support for 128-bit Trace IDs

The current code only supports 64-bit Trace IDs. I solved this by type-asserting the Span Context to ddtrace.SpanContextW3C and using TraceID128() method if the assertion is true.

Reproduction Code

No response

Error Logs

No response

Go Env Output

No response

Metadata

Metadata

Assignees

Labels

apm:ecosystemcontrib/* related feature requests or bugsbugunintended behavior that has to be fixed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions