-
Notifications
You must be signed in to change notification settings - Fork 376
feat: tel crash reporting #2511
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: main
Are you sure you want to change the base?
Conversation
Adding disk-buffering to otel logging required bumping to Kotlin 2.2. Adding the code to implement this in a follow up commit.
When the app is started again we send any pending crash reports.
Also refactored crash handle classes into their own namespace. Refactored IOneSignalOpenTelemetry properties into suspend functions, as some values we want to add to all Otel requests were suspend.
Also made all otel types internal and a few other misc cleanup.
We need to start it sooner to catch crashes in things like other IStartableService's.
Models can throw if something goes wrong initializing them.
📊 Diff Coverage ReportDiff Coverage ReportThreshold: 80% Changed Files Coverage
Overall Coverage292/1558 lines covered (18.7%) ❌ Coverage Check FailedFiles below 80% threshold:
|
Description
One Line Summary
Logging, Crash handling using Otel
Details
Motivation
We want to be able to capture logs, crashes and ANRs - report them to our servers so that we can inspect and fix them on devices.
Scope
Major Architectural Changes and Improvements from this implementation PR
1. Platform-Agnostic Design & Dependency Reduction
OtelIdResolver- Reads OneSignal IDs directly from SharedPreferences (no service dependencies)OtelPlatformProvider- UsesOtelIdResolverinternally, removing all service dependenciescreateAndroidOtelPlatformProvider(context)- Single parameter, no services neededinitializeOtelLogging()- No longer needsIInstallIdService,ConfigModelStore,IdentityModelStore2. Initialization Consolidation
OneSignalCrashLogInitfromobjecttoclass- Manages platform provider lifecycle as instance variable3. Component Simplification
OneSignalCrashHandlerFactory- Simplified to only needContextandIOtelLoggerOtelFactory.createCrashHandler- Refactored to compose other factory methods, reducing duplicationCode Organization & Centralization
4. Constants & Utilities
AnrConstants.kt- CentralizedDEFAULT_ANR_THRESHOLD_MSandDEFAULT_CHECK_INTERVAL_MSisOneSignalAtFault()logic - Moved toOtelCrashHandler.kt(shared by crash handler and ANR detector)CONFIG_NAME_SPACE,IDENTITY_NAME_SPACEto match naming conventions (updated 77 usages across 8 files)5. Code Quality Improvements
OtelAnrDetector- Reduced complexity (LongMethod, NestedBlockDepth)@Suppressannotations where neededTest Coverage & Reliability
6. Comprehensive Test Suite
OtelIdResolverTest.kt- Comprehensive tests for all ID resolution methods with fallback scenariosOtelPlatformProviderTest.kt- Tests for platform provider properties and factory functionOneSignalCrashUploaderWrapperTest.kt- Tests for wrapper initialization and error handlingOtelIntegrationTest,CrashReportUploadTestnow use Context + SharedPreferencesOPTIONAL - Other
OPTIONAL - Feel free to add any other sections or sub-sections that can explain your PR better.
Testing
Unit testing
Lot of unit testing
Manual testing
Tested by manually crashing the app
Affected code checklist
Checklist
Overview
Testing
Final pass
This change is