RUM-2558: Let AndroidTracer.logErrorMessage() send an ERROR log#2605
Conversation
4646b02 to
76b4133
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #2605 +/- ##
===========================================
+ Coverage 69.98% 70.02% +0.04%
===========================================
Files 819 819
Lines 30579 30559 -20
Branches 5121 5120 -1
===========================================
- Hits 21399 21397 -2
+ Misses 7740 7738 -2
+ Partials 1440 1424 -16
🚀 New features to boost your workflow:
|
| /** | ||
| * Helper method to attach an error message to a specific Span. | ||
| * The error message will be added to the provided Span as a standard Error Tag. | ||
| * The error message will be logged with ERROR severity and can be seen in logs attached to the span. |
There was a problem hiding this comment.
in facets it is called status
| * The error message will be logged with ERROR severity and can be seen in logs attached to the span. | |
| * The error message will be logged with ERROR status and can be seen in logs attached to the span. |
There was a problem hiding this comment.
now I use "status" everywhere
| /** | ||
| * Helper method to attach an error message to this [Span]. | ||
| * The error message will be added to this [Span] as a standard Error Tag. | ||
| * The error message will be logged with ERROR severity and can be seen in logs attached to the span. |
There was a problem hiding this comment.
| * The error message will be logged with ERROR severity and can be seen in logs attached to the span. | |
| * The error message will be logged with ERROR status and can be seen in logs attached to the span. |
There was a problem hiding this comment.
now I use "status" everywhere
| @JvmStatic | ||
| fun logErrorMessage(span: Span, message: String) { | ||
| val fieldsMap = mapOf(Fields.MESSAGE to message) | ||
| val fieldsMap = mapOf(Fields.MESSAGE to message, "severity" to Log.ERROR) |
There was a problem hiding this comment.
we need to call this either level (user in codebase) or status (facet name) and also extract it as a constant.
There was a problem hiding this comment.
now I use "status" everywhere
| timestampMicroseconds: Long? = null | ||
| ) { | ||
| val logsFeature = sdkCore.getFeature(Feature.LOGS_FEATURE_NAME) | ||
| val spanLogSeverity = fields["severity"] as? Int |
There was a problem hiding this comment.
we need to remove this from the attributes, since it is a technical property which shouldn't end in the list of the user attributes
| val spanLogSeverity = fields["severity"] as? Int | |
| val spanLogSeverity = fields.remove("severity") as? Int |
also we need to rename it from severity
There was a problem hiding this comment.
thanks for spotting this
- renamed to "status"
- now I remove it from the fields
| verify(mockSpan).log(capture()) | ||
| assertThat(firstValue) | ||
| .containsEntry(Fields.MESSAGE, anErrorMessage) | ||
| .containsOnlyKeys(Fields.MESSAGE) |
There was a problem hiding this comment.
we need to put this assertion back as well. Basically we want to assert that there are only 2 keys.
Same for the similar tests below.
There was a problem hiding this comment.
thanks for spotting it
fixed
76b4133 to
997a4c9
Compare
997a4c9 to
3af91fa
Compare
What does this PR do?
Makes
AndroidTracer.logErrorMessagecreate a log withERRORseverity that is attached to the span.demo
I discussed with Xavier that we shouldn't make the span itself have an error state, just change the log severity.
Motivation
What inspired you to submit this pull request?
Additional Notes
Anything else we should know when reviewing?
Review checklist (to be filled by reviewers)