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
RUM-3068 Add support for global attributes on logs #1900
Conversation
Creating as Draft while I work on getting the NDK to report the global attributes. |
4abc7fb
to
e007dd8
Compare
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.
nice job! I added a few comments, but overall lgtm.
features/dd-sdk-android-logs/src/main/kotlin/com/datadog/android/log/Logs.kt
Outdated
Show resolved
Hide resolved
features/dd-sdk-android-logs/src/main/kotlin/com/datadog/android/log/Logs.kt
Outdated
Show resolved
Hide resolved
features/dd-sdk-android-logs/src/main/kotlin/com/datadog/android/log/Logs.kt
Outdated
Show resolved
Hide resolved
features/dd-sdk-android-logs/src/main/kotlin/com/datadog/android/log/internal/LogsFeature.kt
Outdated
Show resolved
Hide resolved
features/dd-sdk-android-logs/src/main/kotlin/com/datadog/android/log/internal/LogsFeature.kt
Show resolved
Hide resolved
...dk-android-logs/src/main/kotlin/com/datadog/android/log/internal/logger/DatadogLogHandler.kt
Outdated
Show resolved
Hide resolved
...dk-android-logs/src/main/kotlin/com/datadog/android/log/internal/logger/DatadogLogHandler.kt
Outdated
Show resolved
Hide resolved
features/dd-sdk-android-logs/src/test/kotlin/com/datadog/android/log/LogsTest.kt
Outdated
Show resolved
Hide resolved
features/dd-sdk-android-logs/src/test/kotlin/com/datadog/android/log/LogsTest.kt
Outdated
Show resolved
Hide resolved
...ndroid-logs/src/test/kotlin/com/datadog/android/log/internal/logger/DatadogLogHandlerTest.kt
Outdated
Show resolved
Hide resolved
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 <4046447+0xnm@users.noreply.github.com>
04ecc2c
to
5fe9530
Compare
5fe9530
to
7606c1c
Compare
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.
lgtm! I added one comment. Let's wait for the iOS counterpart review before the merge to be aligned.
features/dd-sdk-android-logs/src/main/kotlin/com/datadog/android/log/internal/LogsFeature.kt
Show resolved
Hide resolved
Suppress unchecked cast warnings in tests.
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
|
*/ | ||
@JvmOverloads | ||
@JvmStatic | ||
fun addAttribute(key: String, value: Any?, sdkCore: SdkCore = Datadog.getInstance()) { |
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.
should we accept Any?
or just Any
?
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 kept it in line with Logger's interface which accepts Any?
What does this PR do?
Add a
Logs.addAttribute
andLogs.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.
Review checklist (to be filled by reviewers)