What the telemetry is for
OpenTelemetry is the vendor-neutral standard for traces, metrics and logs. The platform's software emits one trace per work item, such as a report draft or a severity proposal, and links the steps of an incident by an incident identifier, so an operator can answer three questions: is it fast and available, is it correct and safe, and what does it cost. Safety-path events are recorded alongside: exposures, alerts, muster updates and closures. Telemetry carries identifiers, outcomes and measurements. It never carries traveler names, exact locations or report text (ADR-010). The safety path keeps its own audit logs.
Traces
Spans for each step of an item, parent and child, from intake to the record. One trace identifier follows the item across services and the gateway.
Metrics
Counters and histograms for item latency, event-to-alert time, delivery, tokens, cost and guardrail blocks. Cheap to store and good for alerts.
Events
Business events with a name and properties: exposure matched, alert sent, message delivered, muster updated, incident closed, feed stale, retention reconciled.
Correlation
The W3C trace context header travels from intake through the AI (artificial intelligence) gateway and the travel gateway, so their logs join the same trace.
The shape of a trace
| Span | Kind | Key attributes |
|---|---|---|
| report.item | Server (root) | incident.id (hashed), stage, outcome |
| airs.scan.input, airs.scan.output, airs.scan.tool_args | Client | airs.profile, airs.action, airs.detections (names only) |
| gateway.llm_call | Client | gen_ai.request.model (alias), gen_ai.usage.input_tokens, gen_ai.usage.output_tokens, gateway.cost_usd, gateway.fallback_used |
| retrieval.search | Client | knowledge.index, filter.country, results.count, top.score |
| policy.check | Internal | policy.rule, policy.decision |
| tool.call | Client | tool.name, tool.outcome, tool.signed |
What must never be in telemetry
| Data | Rule | How |
|---|---|---|
| Exact locations and itineraries | Never | Not an attribute. Telemetry uses country and region only |
| Traveler names and contacts | Never in clear | Dropped or hashed by the collector before export |
| Health details shared in an incident | Never | Not an attribute; kept only in the incident record |
| Incident identifiers | Hashed | Keyed hash, so queries can group by incident without exposing it |
| Blocked content | Never | Record the detection names and the verdict only |
| Counts, timings, versions and outcomes | Allowed | Needed for safety, accountability and performance analysis |
Instrumenting the service
A sketch in Python with the OpenTelemetry SDK (Software Development Kit) and the Azure Monitor distribution, which sends to Application Insights. The root span is a server span so it appears as a request; child spans appear as dependencies; business events are logged with a custom event name. Check the current package and attribute names before you build.
import logging, os
from opentelemetry import trace, metrics
from opentelemetry.trace import SpanKind
from azure.monitor.opentelemetry import configure_azure_monitor
configure_azure_monitor(connection_string=os.environ["APPLICATIONINSIGHTS_CONNECTION_STRING"])
tracer = trace.get_tracer("duty.platform")
meter = metrics.get_meter("duty.platform")
item_ms = meter.create_histogram("td.item.duration", unit="ms")
blocks = meter.create_counter("td.guardrail.blocks")
log = logging.getLogger("td.events")
def draft_report_item(facts, incident):
with tracer.start_as_current_span("report.item", kind=SpanKind.SERVER) as item:
item.set_attributes({"incident.id": hash_id(incident), "stage": "documentation"})
with tracer.start_as_current_span("airs.scan.input") as sp:
verdict = scan(prompt=json.dumps(facts), incident=incident, model="td-fast")
sp.set_attributes({"airs.profile": "duty-docs-prod", "airs.action": verdict["action"]})
if verdict["action"] != "allow":
blocks.add(1, {"detection": detection_name(verdict), "stage": "input"})
log.warning("guardrail block", extra={"microsoft.custom_event.name": "guardrail.block",
"incident.id": hash_id(incident), "airs.detection": detection_name(verdict)})
return document_manually(facts, reason="blocked")
with tracer.start_as_current_span("gateway.llm_call") as llm:
draft, usage = draft_incident_report(facts)
llm.set_attributes({"gen_ai.request.model": "td-fast", "gen_ai.usage.input_tokens": usage.input,
"gen_ai.usage.output_tokens": usage.output, "gateway.cost_usd": usage.cost})
...
log.info("report signed", extra={"microsoft.custom_event.name": "report.signed", "incident.id": hash_id(incident),
"edits": edit_count, "minutes_to_sign": minutes})
item_ms.record(elapsed_ms(item), {"stage": "documentation"})A collector in the middle
An OpenTelemetry Collector receives telemetry from the service and the gateway, removes or hashes sensitive attributes, keeps every error, block and safety event, samples the rest, and sends it to Azure Monitor for operations and to the lakehouse for long-term analysis.
receivers:
otlp:
protocols: { grpc: {}, http: {} }
processors:
attributes/privacy:
actions:
- { key: report.text, action: delete }
- { key: traveler.name, action: delete }
- { key: traveler.ref, action: hash }
- { key: location.exact, action: delete }
- { key: incident.key, action: hash }
tail_sampling:
decision_wait: 10s
policies:
- { name: keep-errors, type: status_code, status_code: { status_codes: [ERROR] } }
- { name: keep-blocks, type: string_attribute, string_attribute: { key: airs.action, values: [block] } }
- { name: keep-safety, type: string_attribute, string_attribute: { key: safety.event, values: ["true"] } }
- { name: sample-rest, type: probabilistic, probabilistic: { sampling_percentage: 10 } }
batch: {}
exporters:
azuremonitor:
connection_string: ${env:APPLICATIONINSIGHTS_CONNECTION_STRING}
otlphttp/lakehouse:
endpoint: ${env:LAKEHOUSE_OTLP_ENDPOINT}
service:
pipelines:
traces: { receivers: [otlp], processors: [attributes/privacy, tail_sampling, batch], exporters: [azuremonitor, otlphttp/lakehouse] }
metrics: { receivers: [otlp], processors: [batch], exporters: [azuremonitor] }
logs: { receivers: [otlp], processors: [attributes/privacy, batch], exporters: [azuremonitor, otlphttp/lakehouse] }KQL queries operators use
These queries use the workspace-based Application Insights tables in Log Analytics: AppRequests for the root span, AppDependencies for child spans, AppEvents for business events and AppMetrics for metrics. Custom attributes appear in the Properties column. Table and column names can differ with your setup, so adjust them to your workspace. The same Kusto Query Language also runs in Azure Data Explorer if you export telemetry there.
Time from event to message
Median and 95th percentile time from a risk event to the first message, by region, for the last week.
AppEvents
| where TimeGenerated > ago(7d) and Name == "alert.first_sent"
| extend region = tostring(Properties["region"]), secs = todouble(Properties["event_to_alert_s"])
| summarize alerts = count(), p50 = percentile(secs, 50), p95 = percentile(secs, 95), over_target = countif(secs > 300) by region
| order by over_target desc, alerts descIncidents closed with an unresolved traveler (must be zero)
Finds any incident closed while a traveler was unresolved without a signed reason. Any row is an incident.
AppEvents
| where Name == "incident.closed"
| extend open_count = toint(Properties["open_count"]), signed = tostring(Properties["signed_reason"])
| where open_count > 0 and isempty(signed)
| project TimeGenerated, incident = tostring(Properties["incident.id"]), open_count, OperationIdUnresolved travelers by age
How long exposed travelers have been unresolved in open incidents, to prioritise the officer's calls.
AppEvents
| where TimeGenerated > ago(2d) and Name in ("exposure.opened", "muster.resolved")
| extend incident = tostring(Properties["incident.id"]), traveler = tostring(Properties["traveler.ref"])
| summarize opened = minif(TimeGenerated, Name == "exposure.opened"), resolved = maxif(TimeGenerated, Name == "muster.resolved") by incident, traveler
| where isnull(resolved) or resolved < opened
| extend age_min = datetime_diff('minute', now(), opened)
| order by age_min descStale risk feeds
Feeds whose last event or heartbeat is older than allowed, an early sign of silent failure.
AppEvents
| where TimeGenerated > ago(1d) and Name == "feed.heartbeat"
| extend feed = tostring(Properties["feed"])
| summarize last_seen = max(TimeGenerated) by feed
| where last_seen < ago(10m)
| project feed, last_seen, minutes_silent = datetime_diff('minute', now(), last_seen)Delivery failures by channel
Share of messages not delivered, by channel and language, so a failing channel is found early.
AppEvents
| where TimeGenerated > ago(7d) and Name in ("message.sent", "message.delivered")
| extend channel = tostring(Properties["channel"]), lang = tostring(Properties["language"])
| summarize sent = countif(Name == "message.sent"), delivered = countif(Name == "message.delivered") by channel, lang
| extend failed_pct = round(100.0 * (sent - delivered) / sent, 1)
| order by failed_pct descLocation data older than the limit (must be zero)
Register rows still held more than 30 days after the trip ended.
AppEvents
| where TimeGenerated > ago(2d) and Name == "retention.reconciled"
| extend overdue = toint(Properties["rows_past_limit"])
| summarize overdue = max(overdue), runs = count() by day = bin(TimeGenerated, 1d)
| order by day descGuardrail blocks by detection
How often each Prisma AIRS detection fired, by hour, to spot an attack or a noisy rule.
AppEvents
| where TimeGenerated > ago(7d) and Name == "guardrail.block"
| extend detection = tostring(Properties["airs.detection"])
| summarize blocks = count(), incidents = dcount(tostring(Properties["incident.id"]))
by detection, bin(TimeGenerated, 1h)
| order by TimeGenerated desc, blocks descTokens and cost by model alias
Spend and token use per alias and per day, from gateway metadata.
AppDependencies
| where TimeGenerated > ago(14d) and Name == "gateway.llm_call"
| extend model = tostring(Properties["gen_ai.request.model"]),
tin = toint(Properties["gen_ai.usage.input_tokens"]),
tout = toint(Properties["gen_ai.usage.output_tokens"]),
cost = todouble(Properties["gateway.cost_usd"])
| summarize calls = count(), input_tokens = sum(tin), output_tokens = sum(tout), cost_usd = round(sum(cost), 2)
by model, day = bin(TimeGenerated, 1d)
| order by day desc, cost_usd descHow often officers change the advice
Advice shown versus changed or dismissed, by uncertainty band, a measure of usefulness and trust.
AppEvents
| where TimeGenerated > ago(30d) and Name in ("advice.shown", "advice.changed", "advice.dismissed")
| extend band = tostring(Properties["uncertainty_band"])
| summarize shown = countif(Name == "advice.shown"), changed = countif(Name == "advice.changed"), dismissed = countif(Name == "advice.dismissed") by band
| extend changed_pct = round(100.0 * changed / shown, 1), dismissed_pct = round(100.0 * dismissed / shown, 1)
| order by band ascAlert: block rate spike
Compares the hourly block rate with its normal pattern and returns hours that are anomalously high. Use it as an alert query.
let items = AppRequests | where Name == "report.item"
| make-series items = count() default = 0 on TimeGenerated from ago(14d) to now() step 1h;
let blocked = AppEvents | where Name == "guardrail.block"
| make-series blocked = count() default = 0 on TimeGenerated from ago(14d) to now() step 1h;
items
| join kind=inner (blocked) on $left.TimeGenerated == $right.TimeGenerated
| project TimeGenerated, rate = series_divide(blocked, items)
| extend (flag, score, baseline) = series_decompose_anomalies(rate, 2.5)
| mv-expand TimeGenerated to typeof(datetime), rate to typeof(double), flag to typeof(int), score to typeof(double)
| where flag == 1 and TimeGenerated > ago(3h)Service-level objectives and alerts
| Objective | Signal | Target | Alert |
|---|---|---|---|
| Fast alerts | Event to first message p95 | Under 5 minutes | p95 over target for any region |
| Accountability | Incidents closed with an unresolved traveler | Zero | Any occurrence, page the on-call and the security director |
| Feeds alive | Risk feeds silent beyond 10 minutes | Zero | Any feed, page the duty officer |
| Messages delivered | Share of messages delivered by channel | At least 98% | Below target for 10 minutes |
| Fast drafts | report.item p95 | Under 30 seconds | p95 over target for 15 minutes |
| Privacy | Location rows past the retention limit | Zero | Any occurrence, page the privacy officer |
| Scans on all traffic | Model calls with a scan span | 100% | Any unscanned model call |
| Attacks visible | Block rate versus baseline | Within normal range | Anomaly flagged for 1 hour |
| Cost under control | Cost per trip, daily | Within budget | Over 120% of the 7-day average |
Dashboards
Operations
Item latency and errors by stage, step breakdown, tool health and gateway fallbacks.
Safety and assurance
Event-to-alert time, muster ageing, closures, feed freshness and delivery by channel and region.
Security
Blocks by detection, anomalies, scan coverage and unsigned filings.
Cost
Tokens and cost by model and stage, cost per trip and budget burn.
Build this for your business
This example is speculative, but the same pattern, minimal and consented data, deterministic rules for every safety duty, a governed gateway, runtime security, advisory-only AI and accountable people, fits any service that looks after people. We can scope a pilot on your own systems.
Book a discovery call