Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collect trace and span id when present #74

Merged
merged 19 commits into from
Apr 4, 2024

Conversation

nblumhardt
Copy link
Member

@nblumhardt nblumhardt commented Jan 10, 2024

Seq 2023+ includes special handling of trace and span ids. This is a spike showing how the sink could collect them - still needs some tests and cleanup, but otherwise appears to be straightforward.

image

sample/Example/Program.cs Outdated Show resolved Hide resolved
_messageAttribute = new("@m", new FormattedMessageLayout()),
_messageTemplateAttribute = new("@mt", new SimpleLayout("${onhasproperties:${message:raw=true}}")),
_traceIdAttribute = new("@tr", new TraceIdLayout()),
_spanIdAttribute = new("@sp", new SpanIdLayout());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Equivalents of these are available in NLog.DiagnosticSource, but it seems better to avoid the dependency.

@nblumhardt nblumhardt mentioned this pull request Apr 2, 2024
@nblumhardt nblumhardt marked this pull request as ready for review April 3, 2024 02:01
@nblumhardt
Copy link
Member Author

This will need a squash :-)


namespace NLog.Targets.Seq.Layouts
{
class TraceIdLayout: Layout

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems rather similar to SpanIdLayout

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, could definitely factor this out; I'll take a quick look tomorrow :)

@nblumhardt nblumhardt merged commit bfcc2d9 into datalust:dev Apr 4, 2024
1 check passed
nblumhardt added a commit that referenced this pull request Apr 4, 2024
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