Skip to content

feat: logging_config-based remote logging control, SDK version gating, and rename#2551

Closed
abdulraqeeb33 wants to merge 21 commits intoar-otel-crash-reportingfrom
ar-otel-crash-reporting-with-main
Closed

feat: logging_config-based remote logging control, SDK version gating, and rename#2551
abdulraqeeb33 wants to merge 21 commits intoar-otel-crash-reportingfrom
ar-otel-crash-reporting-with-main

Conversation

@abdulraqeeb33
Copy link
Contributor

@abdulraqeeb33 abdulraqeeb33 commented Feb 24, 2026

Summary

  • logging_config-based enablement: isRemoteLoggingEnabled is now derived from the presence of a valid log_level in logging_config — empty object ({}) means disabled (not on allowlist), {"log_level": "ERROR"} means enabled. Removes the need for a separate isEnabled field from the server; the field is kept as a derived convenience on the model.
  • OtelSdkSupport: New testable utility that gates all Otel features (crash reporting, ANR detection, remote log shipping) on SDK >= 26. Tests can override isSupported without Robolectric @Config.
  • OneSignalCrashLogInit → OneSignalOtelInit: Renamed to reflect the full scope of what it initializes (not just crash logs).
  • OneSignalCrashHandlerFactory: Simplified with require() — callers must verify SDK support first; no more silent no-op handler.
  • Demo app: Added crash test button in SecondaryActivity, fixed Compose compiler plugin for AGP 8.8.2.
  • Flow chart: Added mermaid sequence diagram documenting the init flow and config caching behavior.

Key behavior

  • Remote config is fetched once on cold start via ConfigModelStoreListener.start()
  • Otel init reads from cached SharedPreferences (previous session's fetch)
  • One full session lag to enable/disable (by design — avoids blocking init on network)

Test plan

  • Verify resolveRemoteLoggingEnabled() returns true when logLevel is present and valid
  • Verify resolveRemoteLoggingEnabled() returns false when logging_config is empty
  • Verify Otel features are skipped on SDK < 26
  • Verify crash button in demo app triggers crash and crash handler captures it
  • Run existing unit tests for OtelIdResolver, OtelPlatformProvider, OtelSdkSupport, OneSignalOtelInit

Made with Cursor


This change is Reviewable

jinliu9508 and others added 21 commits January 5, 2026 11:22
Co-authored-by: AR Abdul Azeez <abdul@onesignal.com>
Co-authored-by: github-actions[bot] <noreply@onesignal.com>
Co-authored-by: AR Abdul Azeez <abdul@onesignal.com>
Co-authored-by: AR Abdul Azeez <abdul@onesignal.com>
…#2537)

Co-authored-by: AR Abdul Azeez <abdul@onesignal.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: AR Abdul Azeez <abdul@onesignal.com>
Co-authored-by: Nan <nan@onesignal.com>
Co-authored-by: Fadi George <fadii925@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/application/MainApplicationKT.kt
… gating

- Derive isRemoteLoggingEnabled from log_level presence in logging_config
  (empty object = disabled, has log_level = enabled)
- Add OtelSdkSupport utility for testable SDK version checks (API 26+)
- Gate all Otel initialization (crash, ANR, remote logging) on both
  SDK support and backend config
- Rename OneSignalCrashLogInit to OneSignalOtelInit to reflect full scope
- Simplify OneSignalCrashHandlerFactory with require() instead of no-op
- Add crash test button in demo app SecondaryActivity
- Fix Compose compiler plugin compatibility with AGP 8.8.2
- Add flow chart documentation for init sequence

Co-authored-by: Cursor <cursoragent@cursor.com>
@fadi-george
Copy link
Contributor

Theres a lot of sdk example app code that makes it hard to review, you shouldve merged to the base branch instead (ar-otel-crash-reporting)

@abdulraqeeb33
Copy link
Contributor Author

#2552

closing this PR as i have the other one thats much cleaner

@abdulraqeeb33 abdulraqeeb33 deleted the ar-otel-crash-reporting-with-main branch February 24, 2026 20:34
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.

5 participants