Observability Implementation
How to instrument a new service
- Add the platform OTel SDK (or App Insights SDK for legacy .NET) as a dependency.
- Configure the SDK from env: service name, env, region, App Insights connection string (from Key Vault via UAMI).
- Wire the structured logger with required fields defaulted from context. Configure deny-listing for authorization headers, tokens, cookies, secrets, complete JWT claims, request and response bodies, and message payloads.
- Add RED metrics to your HTTP handler and Service Bus consumer wrappers (usually one line each with the shared middleware).
- Add domain metrics for the service’s bounded-context invariants.
- Verify locally then in Alpha: send a request, confirm the trace and correlation ID appear in App Insights.
How to propagate a correlation ID end-to-end
- Read
X-Correlation-Idat ingress; generate a v4 UUID if missing. - Attach to the logger scope for the whole request.
- Add to outbound HTTP calls (
X-Correlation-Idheader) and Service Bus messages (message property). - For Temporal, pass as a workflow input and set as a search attribute.
- Verify: pick a correlation ID from an APIM log; run
union * | where correlationId == "..."in LA and confirm every hop appears.
How to add a symptom-based alert
- Identify the symptom (5xx spike, latency P95 breach, DLQ growth, etc.) and the SLO it protects.
- Draft the LA / Metric query — favour aggregates over single-request triggers.
- Add the alert rule in IaC (Terraform
azurerm_monitor_alert*). - Attach severity + action group + runbook URL.
- Test with a synthetic trigger in Alpha.
- Promote through Beta → Prod via Runway.
How to write a KQL query for a cross-service investigation
-
Start from the correlation ID (from a customer report, APIM log, or alert context).
-
Query:
union AppTraces, AppRequests, AppDependencies, AppExceptions | where customDimensions.correlationId == "<id>" | order by timestamp asc -
Follow the timeline — identify the first failure point.
-
Pivot to the responsible service’s dashboard and drill in.
-
Save the query as a workbook parameter for the runbook if it will recur.
How to publish a system / service dashboard
- Author the dashboard in Grafana (dev instance) and export as JSON.
- Commit the JSON to the service repo under
observability/dashboards/. - Reference from the shared
tf-modules/grafana-dashboards. - PR-validate: dashboard lints + preview screenshot.
- Merge → Runway rolls the dashboard to Grafana.
- Link the dashboard from the service README.
How to add a synthetic monitor
- Choose the endpoint (public FQDN or internal API).
- Add an Azure Availability test (URL ping or multi-step) in IaC.
- Configure locations (multi-geo for public), frequency (typically 5 min), success criteria.
- Wire the test’s failure alert into the standard action group.
- Verify the test appears green in App Insights within 15 min.
How to reduce log noise for a service
- Query LA for the top N log sources by volume (last 24 h).
- Identify chatty INFO / DEBUG lines that add no signal.
- Downgrade or remove in the service — ship a PR with the log-level changes.
- Verify LA cost/volume drops on the next Runway release.
- Consider table-level retention trimming for large low-value tables.
How to trace a Service Bus + Temporal chain
- Confirm the producer attaches
correlationId+traceparentto message properties. - Confirm the consumer reads both and reopens the trace.
- For Temporal, ensure the workflow input includes correlation ID and it’s set as a search attribute.
- Query LA joining
AppDependencies(Service Bus send/receive) withAppRequests(workflow / activity runs) on trace ID.
How to respond to a paging alert
- Open the runbook URL attached to the alert.
- Confirm the symptom in the linked dashboard.
- Follow the runbook’s mitigation steps.
- Escalate per the runbook if the issue persists past the escalation window.
- Post-incident: update the runbook if you had to improvise.
Respond to sensitive telemetry
- Stop or disable the emitting path and notify security when production data is involved.
- Remove the sensitive field or payload at the application boundary. Do not rely on an ingest regex as the primary control.
- Add a platform SDK redaction rule for the known field and an ingest transformation as defense in depth.
- Test with synthetic canary values in Alpha; never use real credentials, tokens, customer content, or production payloads as test data.
- Follow the approved purge, access review, and incident process for data that already reached the telemetry store.
How to right-size retention for a table
- Query LA for the table’s typical query lookback window
(
_TimeGeneratedhistograms). - Set retention to 1.5× the p95 lookback.
- Move audit-required signals to the audit pipeline (see Audit Logs implementation).
- Update the table’s IaC and monitor cost impact next cycle.
Related
- Architecture, Guidelines
- Capabilities: Audit Logs, DR, API management
- ADRs: 0019, 0020, 0024