Skip to content

Conversation

@jkasten2
Copy link
Member

@jkasten2 jkasten2 commented Feb 2, 2026

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

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
    • If it is hard to explain how any codes changes are related to each other then it most likely needs to be more than one PR
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
    • Simplify with less code, followed by splitting up code into well named functions and variables, followed by adding comments to the code.
  • I have reviewed this PR myself, ensuring it meets each checklist item
    • WIP (Work In Progress) is ok, but explain what is still in progress and what you would like feedback on. Start the PR title with "WIP" to indicate this.

This change is Reviewable

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.
@jkasten2 jkasten2 mentioned this pull request Feb 2, 2026
18 tasks
@jkasten2 jkasten2 changed the title Otel logging misc fixes fix: Otel logging misc fixes Feb 2, 2026
Copy link
Contributor

@abdulraqeeb33 abdulraqeeb33 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few questions

Copy link

Copilot AI left a 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 processUptime from 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.

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
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants