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

Add traceId to logging exporter #1246

Merged
merged 3 commits into from
Sep 23, 2020

Conversation

pavolloffay
Copy link
Member

Signed-off-by: Pavol Loffay ploffay@redhat.com

Resolves #1245

Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
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.

👍

@trask trask merged commit 3e00cdb into open-telemetry:master Sep 23, 2020
@@ -33,7 +33,7 @@ public LoggingExporter(String prefix) {
@Override
public CompletableResultCode export(Collection<SpanData> list) {
for (SpanData span : list) {
System.out.print(prefix + " " + span.getName() + " " + span.getSpanId() + " ");
System.out.printf("%s %s %s %s", prefix, span.getName(), span.getTraceId(), span.getSpanId());
Copy link
Contributor

Choose a reason for hiding this comment

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

printf is sloooow - can we switch back to appending?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also looks like we're missing space between span ID and attributes now probably good to have that (or maybe enclose attributes in {}

Copy link
Member

Choose a reason for hiding this comment

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

No objection to switching back to appending. Good catch on the missing space 👍

Copy link
Contributor

@iNikem iNikem Sep 24, 2020

Choose a reason for hiding this comment

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

@anuraaga Any numbers to back that claim? :) And is it important enough for us?

Copy link
Contributor

Choose a reason for hiding this comment

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

Have benchmarked similar now and again, generally 10-20x slower. The readability difference is small enough to get the free speed, and I always recommend people to just never use printf in Java, unless formatting numbers, since it's not worth the cognitive load of deciding between one or the other the performance difference is too great. So I'd consider it important for us.

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 will submit a PR to use the appending.

Would it be better to use string builder

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.

Log exporter should log traceId
4 participants