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

Document traceId/spanId injection into logs #1339

Merged
merged 2 commits into from
Oct 8, 2020

Conversation

mateuszrzeszutek
Copy link
Member

Resolves #1249

(same as `TracingContextUtils.getCurrentSpan().getContext().getSpanIdAsHexString()`);
- `sampled` - a boolean flag marking whether the current span is sampled or not
(same as `TracingContextUtils.getCurrentSpan().getContext().isSampled()`).
Only added when `sampled` is `true`.
Copy link
Contributor

Choose a reason for hiding this comment

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

If it is always true, why include it?

Copy link
Member Author

Choose a reason for hiding this comment

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

I've added an explanation to the doc. Basically if it's there the span is sampled, if not it is not - I guess the reasoning behind it is that most of spans are not sampled and keeping sampled=false in every log line would be just a waste of space.

Copy link
Contributor

Choose a reason for hiding this comment

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

Aren't most span sampled? With AlwaysOn sampler, which is default

Copy link
Member Author

Choose a reason for hiding this comment

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

🤦 That's true...

I somehow thought that it worked completely the other way 😅

Now I'm starting to wonder why it works that way... @anuraaga I think you've added it first in the logback instrumentation -- why do we only log true value?

Copy link
Member

@trask trask left a comment

Choose a reason for hiding this comment

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

Nice doc 👍

Good question about whether we want to change sampled field behavior, it seems like it would be easier for log parsers if the field is not conditional(?)

@anuraaga
Copy link
Contributor

anuraaga commented Oct 8, 2020

Yeah it's just a premature optimization, I don't think I taught too deeply when making that change. Always adding sampled seems nice to me too.

@iNikem
Copy link
Contributor

iNikem commented Oct 8, 2020

Yeah it's just a premature optimization, I don't think I taught too deeply when making that change. Always adding sampled seems nice to me too.

Does this mean we have to make some code change in our MDC handling?

@anuraaga
Copy link
Contributor

anuraaga commented Oct 8, 2020

@iNikem Yeah - so I'm good with merging this first and updating code / README in a followup. But noticed the build failure

@mateuszrzeszutek
Copy link
Member Author

Hmm, looks like random errors:

Could not GET 'https://jcenter.bintray.com/org/springframework/spring-beans/5.0.9.RELEASE/spring-beans-5.0.9.RELEASE.pom'. Received status code 502 from server: Bad Gateway
Could not GET 'https://jcenter.bintray.com/io/projectreactor/ipc/reactor-netty/0.7.8.RELEASE/reactor-netty-0.7.8.RELEASE.pom'. Received status code 502 from server: Bad Gateway
Could not GET 'https://jcenter.bintray.com/org/springframework/spring-beans/5.2.1.RELEASE/spring-beans-5.2.1.RELEASE.pom'. Received status code 502 from server: Bad Gateway

@mateuszrzeszutek
Copy link
Member Author

Rebased to force CircleCI run

@iNikem
Copy link
Contributor

iNikem commented Oct 8, 2020

@mateuszrzeszutek will you do a follow-up fix right away or will you create an issue for that?

@mateuszrzeszutek
Copy link
Member Author

I'll do it right away.

@iNikem iNikem merged commit aa3bbae into open-telemetry:master Oct 8, 2020
@mateuszrzeszutek mateuszrzeszutek deleted the document-mdc branch November 18, 2022 10:26
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.

Document traceId/spanId injection into logs
4 participants