Mobile App Insights: small slice (Mac Catalyst)#165
Draft
davidortinau wants to merge 4 commits intomainfrom
Draft
Mobile App Insights: small slice (Mac Catalyst)#165davidortinau wants to merge 4 commits intomainfrom
davidortinau wants to merge 4 commits intomainfrom
Conversation
- Merge wash-observability.md from decisions/inbox/ to decisions.md - Delete inbox file - Add orchestration log: 2026-04-19T22:36:52Z-wash.md - Add session log: 2026-04-19-azure-error-visibility.md - Append observability note to wash/history.md for cross-agent visibility Audit outcome: Container logs flow correctly; App Insights unconfigured; no global exception handler; AI endpoints silent on failures; /health unmapped. Wash proposes four-part fix (App Insights, exception middleware, AI endpoint logging, /health) awaiting Captain approval (~1 day). Immediate workaround provided: CLI tail + KQL query against law-3ovvqiybthkb6.
- Merge wash-mobile-observability.md from inbox → decisions.md - Update decisions.md with full mobile App Insights plan - Append cross-agent note to Kaylee history (Blazor JS error bridge opportunity) - Update Wash history with planning context Awaiting Captain decisions on: 1. One vs. two App Insights resources 2. Connection string embedding OK 3. App Store submission timeline (PrivacyInfo.xcprivacy) 4. Marketing site scope Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Orchestration log: 2026-04-20T02-42-17Z-wash.md * Wash answered Captain's 3 follow-up questions on mobile observability * Findings: ONE App Insights resource (shared MAUI+API), embed connection string, reject TinyInsights.Maui - Session log: 2026-04-20T02-42-17Z-mobile-appinsights-qa.md (brief summary) - Merged decision inbox → decisions.md (now 54.5KB) * wash-mobile-appinsights-answers.md merged with full QA rationale * Deleted inbox file after merge - Tasks 4-7: no-op (no cross-agent work, no archiving needed, history.md already summarized) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Wires Azure Monitor OpenTelemetry exporter into the existing MAUI OTel
pipeline and subscribes to MauiExceptions.UnhandledException so unhandled
crashes land in Application Insights.
Changes:
- MauiServiceDefaults: add Azure.Monitor.OpenTelemetry.Exporter 1.7.0,
bump OpenTelemetry.Extensions.Hosting/Exporter.OTLP/Instrumentation.Http
to 1.15.x to satisfy the transitive floor. AddAzureMonitor{Log,Metric,
Trace}Exporter is gated on #if !DEBUG + a non-empty connection string so
simulator/dev runs stay silent. Sets a stable service name
SentenceStudio.Mobile.<Platform> so App Insights cloud_RoleName
identifies the client clearly.
- SentenceStudioAppBuilder.InitializeApp: one subscriber on
MauiExceptions.UnhandledException that critical-logs the exception and
best-effort ForceFlush's LoggerProvider/TracerProvider/MeterProvider
(3s budget) before the process dies.
- appsettings.Production.json: AzureMonitor:ConnectionString for the
sstudio-mobile-ai App Insights resource in rg-sstudio-prod.
- MacCatalyst/MauiProgram.cs: #if DEBUG guard the DevFlow usings so
Release builds don't fail on the debug-only package references
(pre-existing bug, unblocks Release validation).
OUT of scope (deferred to full plan): Blazor WebView JS bridge, Android
linker preserve, iOS linker preserve, PrivacyInfo.xcprivacy, Windows,
custom processors.
Validated on Mac Catalyst Release with a forced InvalidOperationException;
record appeared in App Insights within ~5 minutes with cloud_RoleName=
SentenceStudio.Mobile.MacCatalyst. Server-side companion still pending
so client spans will be orphan until the API also emits to App Insights.
Refs: .squad/decisions.md wash-mobile-observability, wash-mobile-appinsights-answers
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Ships the first-increment (~3 hour) mobile Application Insights slice per Captain's
path 1 goapproval. WiresAzure.Monitor.OpenTelemetry.Exporterinto the existing MAUI OTel pipeline, subscribes toMauiExceptions.UnhandledException, and embeds the connection string inappsettings.Production.json(write-only ingestion key — embedding is the documented pattern; per the decisions memowash-mobile-appinsights-answers).In scope
sstudio-mobile-aiinrg-sstudio-prod, workspace-linked tolaw-3ovvqiybthkb6, daily cap 0.5 GB.Azure.Monitor.OpenTelemetry.Exporter1.7.0 added toSentenceStudio.MauiServiceDefaults. BumpedOpenTelemetry.Extensions.Hosting/Exporter.OTLP/Instrumentation.Httpto 1.15.x to satisfy Azure Monitor's transitive floor.cloud_RoleNameset explicitly viaResourceBuilder.AddService("SentenceStudio.Mobile.<DeviceInfo.Platform>").SentenceStudioAppBuilder.InitializeAppsubscribes once toMauiExceptions.UnhandledException→ILogger.LogCritical→ best-effortForceFlush(3000)on all three OTel providers before the process dies.appsettings.Production.jsonupdated withAzureMonitor:ConnectionString.MacCatalyst/MauiProgram.cshad unguardedusing Microsoft.Maui.DevFlow.*even though those packages areCondition='$(Configuration)'=='Debug'. Wrapped the usings in#if DEBUG.Out of scope (deferred to full plan)
window.onerror,unhandledrejection)preservedirectives for Release link-time trimmingPrivacyInfo.xcprivacy(Captain confirmed no App Store submission planned)Validation
Built Release Mac Catalyst, launched with
SENTENCESTUDIO_CRASH_TEST=1, temp thread threwInvalidOperationException10s after launch. Waited 4 minutes. KQL query:Result (truncated):
The forced exception (
AppInsights pipeline validation…) is there, plus bonus evidence the pipeline is already catching caught-and-logged exceptions from startup code paths (EF NativeAOT model-build, HelpKit presenter).cloud_RoleNameis correct. Temp validation code reverted before commit.operation_Idis empty because we throw from a bareThread, not inside an OTel-instrumented activity. Real crashes inside an HttpClient span will populate it and correlate to the API once the server-side companion ships.Secret management
Committed the connection string to
appsettings.Production.json(which is already a tracked file containing service-discovery endpoints). Rationale, per.squad/decisions.mdwash-mobile-appinsights-answers:If Captain prefers an env-var / non-committed override path later, that is easy to add (the config system reads env vars already).
Follow-ups before full rollout
SentenceStudio.Apiso W3Ctraceparentcorrelates mobile → API spans.Resource
/subscriptions/a25bc5f2-e641-47b9-89a8-5e5fd428d9d6/resourceGroups/rg-sstudio-prod/providers/microsoft.insights/components/sstudio-mobile-ai74e94530-d17f-404a-8726-b7266724b70fCo-authored-by: Copilot 223556219+Copilot@users.noreply.github.com