Skip to content

Inline TraceId and SpanId JSON string formatting#2215

Merged
nblumhardt merged 2 commits intoserilog:devfrom
SimonCropp:Inline-TraceId-and-SpanId-JSON-string-formatting
Jan 28, 2026
Merged

Inline TraceId and SpanId JSON string formatting#2215
nblumhardt merged 2 commits intoserilog:devfrom
SimonCropp:Inline-TraceId-and-SpanId-JSON-string-formatting

Conversation

@SimonCropp
Copy link
Copy Markdown
Contributor

Replaces usage of JsonValueFormatter.WriteQuotedJsonString for TraceId and SpanId with direct writing of quoted string values.

activitytraceid is only either numbers or lower-case hexadecimal https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.activitytraceid.createfromstring?view=net-8.0#exceptions

same for activityspanid
https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.activityspanid.createfromstring?view=net-8.0#exceptions

Replaces usage of JsonValueFormatter.WriteQuotedJsonString for TraceId and SpanId with direct writing of quoted string values.

activitytraceid is only either numbers or lower-case hexadecimal
https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.activitytraceid.createfromstring?view=net-8.0#exceptions

same for activityspanid
https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.activityspanid.createfromstring?view=net-8.0#exceptions
@nblumhardt nblumhardt merged commit dc52979 into serilog:dev Jan 28, 2026
1 check passed
@nblumhardt
Copy link
Copy Markdown
Member

Nice one 👍

@nblumhardt nblumhardt mentioned this pull request Feb 10, 2026
This was referenced Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants