-
Notifications
You must be signed in to change notification settings - Fork 376
fix: Otel logging misc fixes #2539
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
base: ar-otel-crash-reporting
Are you sure you want to change the base?
Conversation
This was backwards causing ERROR to send everything
Simplified logic, cleaned up logging statements, and removed code comments that added no value.
Removed "old" format support, we never shipped that. Removed int format, we never shipped nor plan to change it. Removed "logLevel" field fallback, we will always just use "log_level"
In the context of remote logging this is "info", to the app developer this is more of a warning, however this is something we will develop later.
Looks like this was broke in a large refactor in commit 76460ee
Classes Otel depends on will be missing on Android 7 and older devices, or if the app is heavily minified. Added specific handling for this as well as an outer catch on Throwable so we at least allow any existing crash handlers to run.
We don't want logging to be the root cause of an app crash.
abdulraqeeb33
left a comment
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.
a few questions
...nesignal/core/src/main/java/com/onesignal/core/internal/backend/impl/ParamsBackendService.kt
Outdated
Show resolved
Hide resolved
...ignal/core/src/main/java/com/onesignal/debug/internal/crash/OneSignalCrashUploaderWrapper.kt
Outdated
Show resolved
Hide resolved
OneSignalSDK/onesignal/core/src/main/java/com/onesignal/debug/internal/logging/Logging.kt
Outdated
Show resolved
Hide resolved
OneSignalSDK/onesignal/core/src/main/java/com/onesignal/internal/OneSignalCrashLogInit.kt
Outdated
Show resolved
Hide resolved
OneSignalSDK/onesignal/otel/src/main/java/com/onesignal/otel/crash/OtelCrashHandler.kt
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.
Pull request overview
This PR contains miscellaneous fixes and improvements to the OpenTelemetry (Otel) logging infrastructure in preparation for launch. The changes include a type change for process uptime tracking, crash handler refactoring for better reliability, log level adjustments, and code cleanup.
Changes:
- Changed
processUptimefrom Double (seconds) to Long (milliseconds) and updated the calculation method - Refactored crash handler to ensure the existing exception handler is always called, even if OneSignal's crash handling fails
- Adjusted several log levels from WARN to INFO to reduce noise for non-critical messages
- Added Android version checks and improved error handling for Otel-specific code
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| IOtelPlatformProvider.kt | Changed processUptime type from Double (seconds) to Long (milliseconds) |
| OtelPlatformProvider.kt | Updated processUptime calculation to use Process.getStartUptimeMillis() for accurate process uptime measurement |
| OtelCrashHandler.kt | Refactored crash handling flow to ensure existing handler is always called; added NoClassDefFoundError catch block; improved error messages |
| OneSignalCrashLogInit.kt | Code cleanup and removed verbose comments; changed log level comparison logic; adjusted logging levels |
| Logging.kt | Added Android Oreo version check before Otel logging; changed exception catch from Exception to Throwable |
| OneSignalCrashUploaderWrapper.kt | Added Android Oreo version check and error handling wrapper for crash upload |
| ParamsBackendService.kt | Simplified log level parsing to only support string format |
| OneSignalImp.kt | Changed log level from WARN to INFO for main thread blocking warning |
| InAppMessagesManager.kt | Changed log level from WARN to INFO for paused state message |
| CrashReportUploadTest.kt | Updated test output to reflect milliseconds unit for process uptime |
| OtelFieldsPerEventTest.kt | Updated test mocks to use integer values for uptime (milliseconds) |
| OtelFactoryTest.kt | Updated test mock to use integer value for uptime |
| OtelPlatformProviderTest.kt | Updated test assertions to use proper comparison matchers |
| OtelIntegrationTest.kt | Updated test assertion to use proper comparison matcher |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
OneSignalSDK/onesignal/core/src/main/java/com/onesignal/internal/OneSignalCrashLogInit.kt
Show resolved
Hide resolved
...core/src/main/java/com/onesignal/debug/internal/logging/otel/android/OtelPlatformProvider.kt
Show resolved
Hide resolved
OneSignalSDK/onesignal/otel/src/main/java/com/onesignal/otel/crash/OtelCrashHandler.kt
Outdated
Show resolved
Hide resolved
| override fun start() { | ||
| // Otel library requires Android Oreo (8) or newer | ||
| if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return | ||
| if (AndroidUtils.androidSDKInt < Build.VERSION_CODES.O) return |
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.
What i meant was, you could have a AndroidLoggingUtils or something similar and that class basically has something like
boolean fn isOtelLoggingSupport()
and that does this check if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return
Description
One Line Summary
Misc fixes and clean up for the otel branch.
Details
Commits are atomic, recommend reviewer look them over in time order.
Motivation
Fixes required for launch
Scope
Only affect logging logic
Testing
Unit testing
Updated unit tests
Manual testing
Tested on Android 5, 6, and 14 emulators.
Affected code checklist
Checklist
Overview
Testing
Final pass
This change is