-
Notifications
You must be signed in to change notification settings - Fork 791
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
Add traceId to logging exporter #1246
Conversation
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
...ters/logging/src/main/java/io/opentelemetry/javaagent/exporters/logging/LoggingExporter.java
Outdated
Show resolved
Hide resolved
...ters/logging/src/main/java/io/opentelemetry/javaagent/exporters/logging/LoggingExporter.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -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()); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 {}
There was a problem hiding this comment.
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 👍
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
Signed-off-by: Pavol Loffay ploffay@redhat.com
Resolves #1245