-
Notifications
You must be signed in to change notification settings - Fork 232
Conversation
@@ -389,6 +397,17 @@ public Builder withZipkinSharedRpcSpan() { | |||
return this; | |||
} | |||
|
|||
/** | |||
* If the exception is logged and 'message', 'stack' or 'error.kind' is missing. Tracer will |
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.
message
, error.kind
could be done automatically, and stack
could be optional for perf reasons.
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.
Nit: comma after "missing"
Codecov Report
@@ Coverage Diff @@
## master #168 +/- ##
============================================
+ Coverage 84.28% 84.43% +0.15%
- Complexity 575 583 +8
============================================
Files 92 92
Lines 2246 2268 +22
Branches 260 266 +6
============================================
+ Hits 1893 1915 +22
Misses 251 251
Partials 102 102
Continue to review full report at Codecov.
|
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.
Tests to come?
* @return logged fields | ||
*/ | ||
private static Map<String, Object> exceptionLogs(Map<String, ?> fields) { | ||
Object ex = fields.get("error.object"); |
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.
are "error.object", "stack", "message", and "error.kind" defined in opentracing Java? If not, should we make them public consts for jaeger-client-java?
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.
They are defined in the spec, but not in API artifact, I will open PR to ot-java.
if (!errorFields.isEmpty()) { | ||
errorFields.putAll(fields); | ||
} | ||
fields = errorFields; |
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.
it looks like if the fields don't contain "error.object", we throw out all the fields the user passed 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.
good catch, this should be inside, the if above
logs.add(new LogData(timestampMicroseconds, fields)); | ||
} | ||
return this; | ||
} | ||
} | ||
|
||
|
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.
nit: double newline uncessecary
PR updated, added some tests |
Map<String, Object> errorFields = exceptionLogs(fields); | ||
if (!errorFields.isEmpty()) { | ||
errorFields.putAll(fields); | ||
fields = errorFields; |
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'm not overly familiar with certain Java things, but given that we do errorFields.putAll(fields)
above, is it still necessary for fields = errorFields;
?
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.
It is necessary because of line 237.
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.
ohhh, putAll puts fields into errorFields and not the other way round (duhhh).
Given that, this means if the user specifically added a "error.object", "stack", "message", and "error.kind", that will overwrite the k,v in errorFields? sounds right.
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.
Tracer does not change explicitly logged items ( "error.object", "stack", "message" ..). It only derives new fields if are not logged.
LGTM, I wonder if we should wait until the tags are specified in ot-java before landing this though. |
Is this still relevant ? |
Yes I will rebase it |
be55b5a
to
08c151b
Compare
08c151b
to
0d6a303
Compare
Rebased, it can be reviewed. The last review comment was to wait for |
@@ -228,6 +231,13 @@ public Span log(long timestampMicroseconds, Map<String, ?> fields) { | |||
return this; | |||
} | |||
if (context.isSampled()) { | |||
if (tracer.isExpandExceptionLogs()) { | |||
Map<String, Object> errorFields = exceptionLogs(fields); |
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.
minor point, but couldn't we move all the logic into exceptionLogs() so that here we only have
fields = exceptionLogs(fields);
?
Internally it could do Map<String, Object> errorFields = new HashMap<String, Object>(fields);
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 have changed it to ^^. I will merge or green
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
a567ade
to
adefa74
Compare
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
5fc098b
to
c8dd269
Compare
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
No description provided.