RUM-3068 Add support for global attributes on logs#1900
Merged
Conversation
Member
Author
|
Creating as Draft while I work on getting the NDK to report the global attributes. |
fuzzybinary
force-pushed
the
jward/RUM-3068-global-log-attributes
branch
from
March 5, 2024 15:11
4abc7fb to
e007dd8
Compare
fuzzybinary
marked this pull request as ready for review
March 5, 2024 15:11
0xnm
reviewed
Mar 5, 2024
0xnm
left a comment
Member
There was a problem hiding this comment.
nice job! I added a few comments, but overall lgtm.
Add a `Logs.addAttribute` and `Logs.removeAttribute` function to add attributes to all logs generated by Loggers created from a specific Core. Individual loggers and log events override global attributes. These log attributes are also sent on unhandled exceptions and added to errors forwarded to RUM. Still need to add attributes to NDK crash logs.
Co-authored-by: Nikita Ogorodnikov <[email protected]>
fuzzybinary
force-pushed
the
jward/RUM-3068-global-log-attributes
branch
2 times, most recently
from
March 5, 2024 15:51
04ecc2c to
5fe9530
Compare
fuzzybinary
force-pushed
the
jward/RUM-3068-global-log-attributes
branch
from
March 5, 2024 16:16
5fe9530 to
7606c1c
Compare
0xnm
approved these changes
Mar 5, 2024
0xnm
left a comment
Member
There was a problem hiding this comment.
lgtm! I added one comment. Let's wait for the iOS counterpart review before the merge to be aligned.
Suppress unchecked cast warnings in tests.
fuzzybinary
force-pushed
the
jward/RUM-3068-global-log-attributes
branch
from
March 5, 2024 21:01
1ca5984 to
4562a27
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## develop #1900 +/- ##
===========================================
- Coverage 83.44% 83.36% -0.08%
===========================================
Files 477 477
Lines 16911 16943 +32
Branches 2512 2520 +8
===========================================
+ Hits 14110 14123 +13
- Misses 2113 2133 +20
+ Partials 688 687 -1
|
mariusc83
approved these changes
Mar 6, 2024
| */ | ||
| @JvmOverloads | ||
| @JvmStatic | ||
| fun addAttribute(key: String, value: Any?, sdkCore: SdkCore = Datadog.getInstance()) { |
Member
There was a problem hiding this comment.
should we accept Any? or just Any ?
Member
Author
There was a problem hiding this comment.
I kept it in line with Logger's interface which accepts Any?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Add a
Logs.addAttributeandLogs.removeAttributefunction to add attributes to all logs generated by Loggers created from a specific Core. Individual loggers and log events override global attributes.These log attributes are also sent on unhandled exceptions and added to errors forwarded to RUM.
Review checklist (to be filled by reviewers)