feat: Application Insights telemetry for backend and Android#280
Merged
feat: Application Insights telemetry for backend and Android#280
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds optional Azure Application Insights telemetry across the Go API server and Android client, plus documentation/privacy updates and CI/CD wiring to inject build metadata and secrets.
Changes:
- Backend: introduce
internal/telemetry+internal/version, add DNT-aware request middleware, instrument errors/warnings across handlers/services, and flush on shutdown. - Android: add OpenTelemetry-based
TelemetryManager, Do-Not-Track request header support, Settings toggles (telemetry + debug logging), and instrument key app flows/workers. - Ops/docs: wire
-ldflags/BuildConfig fields in CI/release builds and update README + Privacy Policy.
Reviewed changes
Copilot reviewed 53 out of 54 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/views/PrivacyPolicy.tsx | Updates privacy policy to describe optional telemetry + third-party services. |
| apiserver/main.go | Enables DNT CORS header, registers telemetry middleware, flushes telemetry on shutdown. |
| apiserver/internal/ws/server.go | Adds telemetry for WS auth/upgrade/read/write failures. |
| apiserver/internal/version/version.go | New build-metadata package populated via -ldflags. |
| apiserver/internal/utils/middleware/middleware.go | Adds request-level telemetry + DNT detection; instruments rate limiting. |
| apiserver/internal/utils/database/database.go | Instruments DB open failure telemetry. |
| apiserver/internal/telemetry/telemetry.go | New telemetry helper APIs (TrackEvent/Warning/Error) with shared properties. |
| apiserver/internal/telemetry/appinsights.go | App Insights client singleton initialization + connection string parsing + flush. |
| apiserver/internal/telemetry/appinsights_test.go | Unit tests for connection string parsing helpers. |
| apiserver/internal/services/users/user.go | Adds telemetry on notification-settings failures. |
| apiserver/internal/services/tasks/task.go | Adds telemetry across task CRUD + recurrence flows. |
| apiserver/internal/services/scheduler/scheduler.go | Adds telemetry when scheduled jobs fail. |
| apiserver/internal/services/notifications/notifications.go | Adds telemetry for notification cleanup/send failures. |
| apiserver/internal/services/labels/label.go | Adds telemetry for label CRUD failures + forbidden operations. |
| apiserver/internal/middleware/auth/auth.go | Adds telemetry for unauthorized/forbidden auth decisions. |
| apiserver/internal/apis/user.go | Adds telemetry for user handler failures/bind errors. |
| apiserver/internal/apis/task.go | Adds telemetry for invalid params and bind errors in task endpoints. |
| apiserver/internal/apis/log.go | Adds telemetry for client-side warn/error log endpoints. |
| apiserver/internal/apis/label.go | Adds telemetry for invalid params and bind errors in label endpoints. |
| apiserver/go.mod | Adds indirect dependencies for ApplicationInsights-Go. |
| apiserver/go.sum | Adds checksums for new telemetry dependencies. |
| android/gradle/libs.versions.toml | Adds OpenTelemetry dependency version + library entries. |
| android/app/src/main/res/values/strings.xml | Adds Settings strings for Analytics + Debug logging toggles. |
| android/app/src/main/java/com/dkhalife/tasks/ws/WebSocketManager.kt | Adds telemetry logging for WS connect/send/parse/failure scenarios. |
| android/app/src/main/java/com/dkhalife/tasks/viewmodel/TaskListViewModel.kt | Logs repository failures to telemetry. |
| android/app/src/main/java/com/dkhalife/tasks/viewmodel/TaskFormViewModel.kt | Logs load/save failures to telemetry. |
| android/app/src/main/java/com/dkhalife/tasks/viewmodel/LabelViewModel.kt | Logs label CRUD failures to telemetry. |
| android/app/src/main/java/com/dkhalife/tasks/viewmodel/AuthViewModel.kt | Logs MSAL sign-in/out failures to telemetry. |
| android/app/src/main/java/com/dkhalife/tasks/utils/SoundManager.kt | Routes sound errors through telemetry instead of Log.e. |
| android/app/src/main/java/com/dkhalife/tasks/ui/screen/SettingsScreen.kt | Adds Analytics + Debug logging toggles to Settings UI. |
| android/app/src/main/java/com/dkhalife/tasks/ui/navigation/AppNavigation.kt | Threads telemetry/debug settings through navigation to Settings screen. |
| android/app/src/main/java/com/dkhalife/tasks/telemetry/TelemetryManager.kt | New OpenTelemetry-based telemetry manager with user preference gating. |
| android/app/src/main/java/com/dkhalife/tasks/telemetry/AzureMonitorSpanExporter.kt | Custom exporter sending EventData payloads to App Insights. |
| android/app/src/main/java/com/dkhalife/tasks/repo/UserRepository.kt | Logs API failures to telemetry. |
| android/app/src/main/java/com/dkhalife/tasks/repo/TaskRepository.kt | Logs API failures to telemetry. |
| android/app/src/main/java/com/dkhalife/tasks/repo/LabelRepository.kt | Logs API failures to telemetry. |
| android/app/src/main/java/com/dkhalife/tasks/di/NetworkModule.kt | Adds DNT interceptor; injects TelemetryManager into auth interceptor. |
| android/app/src/main/java/com/dkhalife/tasks/data/widget/WidgetSyncEngine.kt | Adds telemetry warnings for widget sync/deserialize failures. |
| android/app/src/main/java/com/dkhalife/tasks/data/sync/TaskSyncWorkerFactory.kt | Injects TelemetryManager into TaskSyncWorker. |
| android/app/src/main/java/com/dkhalife/tasks/data/sync/TaskSyncWorker.kt | Logs sync engine and fetch failures to telemetry. |
| android/app/src/main/java/com/dkhalife/tasks/data/calendar/CalendarSyncEngine.kt | Logs calendar edge cases/date parse failures to telemetry. |
| android/app/src/main/java/com/dkhalife/tasks/data/calendar/CalendarRepository.kt | Logs enable/disable calendar sync failures to telemetry. |
| android/app/src/main/java/com/dkhalife/tasks/data/TelemetryRepository.kt | New SharedPreferences-backed repo for telemetry/debug toggles. |
| android/app/src/main/java/com/dkhalife/tasks/data/AppPreferences.kt | Adds preference keys for telemetry/debug/device id. |
| android/app/src/main/java/com/dkhalife/tasks/auth/AuthManager.kt | Logs token/sign-in/out issues via TelemetryManager. |
| android/app/src/main/java/com/dkhalife/tasks/api/DoNotTrackInterceptor.kt | New interceptor that adds DNT: 1 header when telemetry disabled. |
| android/app/src/main/java/com/dkhalife/tasks/api/AuthInterceptor.kt | Adds telemetry warnings when auth retry/refresh fails. |
| android/app/src/main/java/com/dkhalife/tasks/TaskWizardApplication.kt | Initializes telemetry and installs crash handler. |
| android/app/src/main/java/com/dkhalife/tasks/MainActivity.kt | Holds telemetry/debug state and wires it into Settings UI. |
| android/app/build.gradle.kts | Injects git SHA + App Insights connection string into BuildConfig; adds OpenTelemetry deps. |
| README.md | Documents telemetry configuration and env var usage. |
| .goreleaser.yaml | Injects version/build/commit into backend binaries via -ldflags. |
| .github/workflows/full-release.yml | Passes APPINSIGHTS_CONNECTION_STRING into Android release build job. |
| .github/workflows/api-build.yml | Adds -ldflags build metadata injection during CI backend build. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add Application Insights telemetry to the Go API server and Android app, following the same CustomEvent pattern used in my-journey.
Backend (Go API Server)
Android App
CI/CD
Documentation
Key Design Decisions