Architecture Decision Record
ADR-041: Observability and Telemetry Strategy
Status
Accepted (2026-07-10). Amended (2026-07-23) to document the Telemetry:DisableHttpClientMetrics and
Telemetry:DisableRuntimeMetrics cost knobs and to correct the meter/activity-source literal
citations. Amended (2026-07-25) to describe how the CQRS logging decorators actually record duration
(a per-path RecordDuration helper, not a finally) and to rebase the decorator outcome-tag, outbox
poll-span, and OutboxProcess parent-context citations onto their current lines. Amended
(2026-07-28) to rebase the Aspire service-defaults citations (the sampling and cost-knob helpers, the
two exporter reads) and the outbox dead-letter increment onto their current lines. Amended
(2026-08-01) to rebase the ASP.NET Core/HttpClient tracing citation, the CQRS duration-literal
citations, the outbox poll-span-filter clear statement, the outbox meter/counter/activity-source
declarations, the dead-letter increment call site, the poll-span open site, the OutboxProcess
span-start site, and the correlation-id response-header citation onto their current lines. Amended
(2026-08-07) to record that the outbox meter and dead-letter counter now live in a dedicated
OutboxMetrics type rather than in OutboxProcessor, to document the second dead-letter increment
on the retries-exhausted path and the reason tag that separates the two, and to rebase the Aspire
service-defaults, CQRS metric-literal, and outbox span citations onto their current lines. Amended
(2026-08-18) to record two new meter families (MMCA.Common.OutputCache, MMCA.Common.BestEffort), to
correct the meter inventory this record has been under-reporting, and to note that the correlation id
now starts one hop earlier, at the Gateway; see the Revision (2026-08-18) at the end. Amended
(2026-08-31) to record the application logging pipeline (Serilog as one additional provider beside the
OpenTelemetry one, never a replacement ILoggerFactory), its level and file-sink policy, the pre-DI
bootstrap logger, and which hosts adopt it; see the Amended (2026-08-31) section at the end. Amended
(2026-09-03): MMCA.Store.UI.Web now calls AddCommonSerilog instead of hand-rolling the same
configuration inline, so the "defaults exist in two shapes" cost that amendment recorded is gone and
eight hosts share one helper; its Program.cs citations and the per-host AddCommonSerilog /
bootstrap-factory line anchors are rebased onto their current lines. Amended again (2026-09-03) to
record the probe-telemetry cost knob (Telemetry:FilterProbeTelemetry, the one knob that is on by
default) and the metric-drop views that make the two metrics knobs authoritative over the Azure
Monitor distro, and to rebase the Aspire service-defaults, CQRS decorator and outbox citations (the
outbox processor and its metrics now live under Persistence/Outbox/Processing/) onto their current
lines; see the "Amended (2026-09-03): probe telemetry" section at the end.
Revised 2026-09-07 (the Log Analytics daily cap gained a cap-reached alert in both apps, SQL
auditing and resource diagnostics are deployed in ADC and Store, Store alerts on a security signal,
and Store scrubbed email addresses out of stored reviewer names).
Revised 2026-09-11 (the meter subscription block carries eight meters now, the eighth being
MMCA.Common.InternalCommands, which also adds a second trace source and a second poll span the
poll filter drops; the MMCA.Common.AI meter is defined but not subscribed there; and every
Extensions.cs and CQRS-decorator citation is rebased onto its current line. See the Revision
(2026-09-11) at the end).
Amended again (2026-09-11) to record a ninth subscribed meter, Polly, with the
Telemetry:EnablePollyDurationMetrics cost knob that keeps its two duration histograms off by
default, and to record that the CQRS logging decorators now log a thrown exception at Warning without
the exception object while their duration histograms and outcome tags stay exactly as this record
describes them. The eight-meter count in the entry above is superseded, and the metrics configuration
moved into its own ConfigureMetrics method, so the subscription block no longer sits at the lines
the earlier entries cite. See the "Amended (2026-09-11): the Polly meter" section at the end.
Revised 2026-09-19 (MMCA.Common.AI is now subscribed in the meter chain and added as a trace
source, so the block carries ten subscribed meters: nine MMCA.Common.* plus Polly. Both
2026-09-11 entries above are superseded on those two points, the one that records the AI meter as
defined but not subscribed and the one that counts nine. See the Revision (2026-09-19) at the end).
Revised 2026-09-25 (MMCA.ADC.UI.Web now calls AddCommonSerilog as well, so nine hosts share the
helper and the two Gateways are the only hosts without Serilog; the per-host AddCommonSerilog,
bootstrap-factory and call-order citations in the Amended (2026-08-31) section are rebased onto their
current lines. The "eight hosts" count in the first 2026-09-03 entry above is superseded).
Revised 2026-10-01 (ASP.NET Core metrics are now behind a third cost knob,
Telemetry:DisableAspNetCoreMetrics, which both production deployments turn on; see Revision below).
Revised 2026-10-06: the correlation middleware also discards a non-printable-ASCII id, Store's auth alert counts 401 and 429, the bootstrap logger factory lives until the host exits, and GlobalExceptionHandler writes its Error row only on its 500 path (cross-tenant and bad-request rejections log Warning).
Revised 2026-10-07: Context and the rejected-alternative now separate unsampled tracing (the largest line item) from sampled traces (metrics measured larger in every recorded window), an outbox message with no stored trace context gets no OutboxProcess span, and the outbox, ADC bicep, ADC Conference Program.cs and GlobalExceptionHandler anchors are rebased after the v1.232.1 and v1.233.0 releases.
Revised 2026-10-21: StartOutboxActivity runs once per dispatched message (a message a lease renewal found re-claimed (lost) is skipped before it), and the Extensions.Telemetry.cs, outbox, Store bicep and host Program.cs anchors are refreshed.
Revised 2026-10-24: OTLP is the only built-in exporter; Azure Monitor moved to the AddAzureMonitorExporter() call in MMCA.Common.Azure (ADR-134), and the Decision's exporter bullet is corrected in place. See Revision (2026-10-24) at the end.
Revised 2026-10-25: a second vendor exporter, AddGoogleCloudTelemetryExporter() in MMCA.Common.Gcp, sends traces and logs to the Google Cloud Telemetry API; metrics go through the Google-built Collector, and the collector-free metrics path is recorded as a rejected alternative. See Revision (2026-10-25) at the end.
Revised 2026-10-26: the meter chain carries eleven subscriptions (ten MMCA.Common.* plus Polly) now that MMCA.Common.Persistence and its persistence.concurrency.conflict counter are subscribed, superseding the ten-meter count of the 2026-09-19 entry, and the Extensions.Telemetry.cs, OutboxProcessor.cs and bicep anchors in the live sections are refreshed. See Revision (2026-10-26) at the end.
Revised 2026-10-28: records alerting the earlier re-verifications omitted (ADC has carried the same 401/429 auth-failure alert as Store since 2026-10-19, and both apps carry a 403 forbidden-burst alert at severity 3, Store since 2026-09-07 and ADC since 2026-10-19), and the bicep, host Program.cs and DbUpdateExceptionHandler anchors the dated sections keep are given their current locations. See Revision (2026-10-28) at the end.
Revised 2026-11-12: AddAzureMonitorExporter() lives in the new MMCA.Common.Azure.Startup package (call name unchanged), a third vendor exporter, AddAwsTelemetryExporter() in MMCA.Common.Aws, sends traces and logs (never metrics) to AWS, and the MMCA.Common.InternalCommands meter carries five internal_commands.lane.* instruments for the webhook delivery lane (ADR-142); the Decision's exporter bullet is corrected in place. See Revision (2026-11-12) at the end.
Revised 2026-11-23: the meter chain carries twelve subscriptions (eleven MMCA.Common.* plus Polly) now that MMCA.Common.Auth and its mmca.auth.signin counter are subscribed, the service and Blazor hosts reach AddCommonSerilog through the composed AddMmcaServiceHost and AddMmcaBlazorWebHost calls rather than from their own Program.cs, ADC's auth-failure alert no longer matches Store's (it adds the sign-in counter, threshold 25), and the live-section anchors are refreshed. See Revision (2026-11-23) at the end.
Revised 2026-12-02 (MMCA.Common v1.329.0, MMCA.Common/CHANGELOG.md:13): MMCA.Common.Azure no longer type-forwards AzureMonitorExporterExtensions; the class lives only in MMCA.Common.Azure.Startup, which MMCA.Common.Azure references (MMCA.Common/Source/Hosting/MMCA.Common.Azure/MMCA.Common.Azure.csproj:39), so the call a host writes is unchanged and only a binary compiled against an older MMCA.Common.Azure is rebuilt (MMCA.Common/UPGRADING.md:39). The Decision's exporter bullet is corrected in place; the Revision (2026-11-12) item citing TypeForwards.cs stays as recorded.
Revised 2026-12-03 (MMCA.Common v1.331.0): AddAzureMonitorExporter() hands Telemetry:TracesSampleRatio to the Azure Monitor distro, whose own sampler otherwise replaces the host's, and the framework trace sources are one exported list, Extensions.FrameworkActivitySourceNames, held equal to the sources Common creates by a fitness test. The Decision's sampling and exporter bullets are corrected in place and a trace-sources bullet is added. See Revision (2026-12-03) at the end.
Context
The framework is a modular monolith whose modules extract into standalone services (ADR-008), so
the same telemetry has to make sense whether a request stays in one process or crosses a gateway and
several service hosts. OpenTelemetry auto-instrumentation (ASP.NET Core, HttpClient, the .NET
runtime) gives generic HTTP and runtime signals for free, but it is blind to the two paths that carry
almost all of the framework's own work: the CQRS use-case pipeline (ADR-014) and the outbox
(ADR-003). "How long is this command taking and how often does it fail" and "is the outbox
dead-lettering" are not questions auto-instrumentation can answer.
Two cost forces pull the other way. A deployed fleet polls every relational outbox around the clock,
so idle poll spans would dominate Application Insights ingestion if exported, and full-fidelity
tracing is the largest observability line item (MMCA.ADC/infra/main.bicep:305-:308,
MMCA.Store/infra/main.bicep:250-:253), which is why both deployments sample traces at 25%
(MMCA.ADC/infra/main.bicep:310-:311). With sampling on, metrics are the line every recorded
measurement puts on top: the http.client.* gauges plus the runtime instruments were about 65% of
AppMetrics over 2026-08-03..09 (MMCA.ADC/infra/main.bicep:335-:341, behind the HttpClient and
runtime knobs), AppMetrics stayed about 63% of workspace ingestion in ADC (67% in Store) over
2026-08-01..22 after those two groups were dropped (MMCA.ADC/infra/main.bicep:370-:373,
MMCA.Store/infra/main.bicep:315-:318, behind the 300s export interval), and the ASP.NET Core meter
family alone was 73% over 2026-09-22..28 (MMCA.ADC/infra/main.bicep:351-:354, behind the
ASP.NET Core knob). The framework needs custom instrumentation
where auto-instrumentation is blind, plus knobs that cut telemetry cost without going dark. This
cross-cutting observability decision was implemented but named by no existing ADR; this record
captures it.
Decision
Standardize telemetry in the shared Aspire service defaults, add framework-specific instrumentation for the CQRS and outbox paths, and expose cost knobs with fail-safe defaults.
One shared telemetry baseline on every host.
ConfigureOpenTelemetry(Source/Hosting/MMCA.Common.Aspire/Extensions.Telemetry.cs:70) wires OpenTelemetry logging with formatted messages and scopes (Extensions.Telemetry.cs:72, the two flags at:74-:75), metrics from ASP.NET Core,HttpClientand the runtime (each gated behind a cost knob, see below), and tracing from ASP.NET Core andHttpClient, added either with the probe-telemetry filters attached (Extensions.Telemetry.cs:105-:108) or plain (Extensions.Telemetry.cs:112-:113) depending on the knob the Amended (2026-09-03) section records. It is called fromAddServiceDefaults(Source/Hosting/MMCA.Common.Aspire/Extensions.cs:37, declared at:35), so a host opts in once and every project in the Aspire model inherits the same pipeline.Custom RED metrics from the CQRS pipeline. A single meter
MMCA.Common.Cqrs(Source/Core/MMCA.Common.Application/UseCases/Decorators/CqrsMetrics.cs:24) publishes two duration histograms:cqrs.command.duration(CqrsMetrics.cs:30) andcqrs.query.duration(CqrsMetrics.cs:36), both in milliseconds. Every path is measured without afinally: each logging decorator routes all three of its exits through a privateRecordDurationhelper, so the measurement cannot be skipped. The command helper callsCqrsMetrics.CommandDuration.Record(...)tagged bycommandandoutcome(Source/Core/MMCA.Common.Application/UseCases/Decorators/LoggingCommandDecorator.cs:99, in theRecordDurationhelper declared at:98) and the query helper does the same forQueryDuration(Source/Core/MMCA.Common.Application/UseCases/Decorators/LoggingQueryDecorator.cs:92, helper at:91). Theoutcometag takescompleted,failed(aResultfailure), orexception, one call site per path (LoggingCommandDecorator.cs:55,:50,:77; the query equivalents atLoggingQueryDecorator.cs:51,:46,:69), so count gives rate, the tag gives errors, and the histogram gives duration. The Aspire host subscribes the meter by literal name (Extensions.Telemetry.cs:308).An outbox dead-letter counter. The outbox instruments live in their own static type (
Source/Core/MMCA.Common.Infrastructure/Persistence/Outbox/Processing/OutboxMetrics.cs:16), which owns the meterMMCA.Common.Outbox(OutboxMetrics.cs:19) and the counteroutbox.dead_letter.count(OutboxMetrics.cs:41-OutboxMetrics.cs:42).OutboxProcessor(Source/Core/MMCA.Common.Infrastructure/Persistence/Outbox/Processing/OutboxProcessor.cs) increments it on both dead-letter paths, tagged byevent_typeand by areasonthat tells them apart:type_unresolvablewhen a message's event type cannot be resolved and the row has been attempted before (OutboxProcessor.cs:1094-OutboxProcessor.cs:1097, inHandleUnresolvableTypeat:1074; on the row's first attempt,RetryCount0, it is retried once as transient atOutboxProcessor.cs:1080-OutboxProcessor.cs:1087, unlessMaxRetriesis 1 or less), andretries_exhaustedwhen a failing message reachesMaxRetriesand drops out of the poll (guard atOutboxProcessor.cs:681, increment atOutboxProcessor.cs:686-OutboxProcessor.cs:689). The processor's activity source publishes outbox spans under the same name (OutboxProcessor.cs:104); both the meter and the trace source are registered by literal name in the Aspire defaults (Extensions.Telemetry.cs:307,Extensions.Telemetry.cs:83).Correlation-ID middleware ties the request together.
CorrelationIdMiddleware(Source/Presentation/MMCA.Common.API/Middleware/CorrelationIdMiddleware.cs:20) uses theX-Correlation-IDheader (CorrelationIdMiddleware.cs:23), reading it from the request (CorrelationIdMiddleware.cs:40; a blank header counts as absent, a supplied id is cut to 64 characters,CorrelationIdMiddleware.cs:26,:63, and a cut id holding any character outside printable ASCII is discarded,:64, because Kestrel refuses to echo it in a response header) or falling back to the current W3C trace id and then toHttpContext.TraceIdentifier(CorrelationIdMiddleware.cs:41-:43), sets it on the scopedICorrelationContext(CorrelationIdMiddleware.cs:45), and echoes it on the response (CorrelationIdMiddleware.cs:48, inside theOnStartingcallback registered atCorrelationIdMiddleware.cs:46). The CQRS logging decorators stamp that same id into every log scope (read atLoggingCommandDecorator.cs:27, stamped byBeginCommandScopeat:33), so logs, the correlation id, and the trace id line up for one request.Three high-volume metric families gated behind cost knobs, on by default. ASP.NET Core metrics (
http.server.*,kestrel.*,aspnetcore.*,signalr.server.*) are added only whenTelemetry:DisableAspNetCoreMetricsis unset or false (ConfigureAspNetCoreMetrics,Extensions.Telemetry.cs:354, knob read at:356, adding instrumentation at:368),HttpClientconnection and request metrics only whenTelemetry:DisableHttpClientMetricsis unset or false (Extensions.Telemetry.cs:250, adding instrumentation at:271), and .NET runtime metrics (dotnet.gc.*,jit.*,thread_pool.*) only whenTelemetry:DisableRuntimeMetricsis unset or false (Extensions.Telemetry.cs:278, adding at:290). Skipping the instrumentation is not enough on its own, so each disabled branch also drops the whole meter family with aView(Extensions.Telemetry.cs:361-:364for every meter under theMicrosoft.AspNetCore.prefix,:263-:267forSystem.Net.HttpplusSystem.Net.NameResolution,:283-:286forSystem.Runtime): the Azure Monitor distro adds those meters itself, and aViewapplies to the wholeMeterProviderregardless of which component added them, which is what makes each knob authoritative rather than advisory. All three keys are read byIsInstrumentationDisabled(Extensions.Telemetry.cs:204-:205), which drops the family only when the value parses as booleantrue; absent, blank, or unparseable falls back to keeping the instrumentation, so a typo cannot silently blind a whole metric family. A deployed host sets any of them totrueto cut ingestion cost; outbound dependency latency is still captured as traces whenHttpClientmetrics are dropped, and request latency and failures still come from the request traces when ASP.NET Core metrics are dropped. Both production deployments setTelemetry__DisableAspNetCoreMetricstotrue(MMCA.ADC/infra/main.bicep:356-:357,MMCA.Store/infra/main.bicep:301-:302), so neither exports the ASP.NET Core meter family.Head-based sampling as a cost knob, off by default.
Telemetry:TracesSampleRatio(Extensions.Telemetry.cs:187, parsed byTryGetTraceSampleRatioatExtensions.Telemetry.cs:229, which reads the key atExtensions.Telemetry.cs:232) is unset by default, so a host samples everything and behavior does not change. A deployed host sets a ratio in the open interval (0,1) to keep that fraction of traces; the value wraps aTraceIdRatioBasedSamplerin aParentBasedSampler(Extensions.Telemetry.cs:188) so a sampled-in request keeps its whole trace across service boundaries. A key that is absent, unparseable, or outside (0,1) falls back to sample-all (Extensions.Telemetry.cs:233-:239), so a typo can never silently drop all telemetry. Under Azure Monitor the same ratio governs: the distro installs its own trace sampler, which replaces the host's, soAddAzureMonitorExporter()passes the parsed ratio to the distro asAzureMonitorOptions.SamplingRatiowithTracesPerSecondcleared, a fixed-percentage sampler in place of the distro's rate-limited default; with no ratio configured the distro's default stands (MMCA.Common/Source/Hosting/MMCA.Common.Azure.Startup/AzureMonitorExporterExtensions.cs:71-:86, documented at:36-:39, pinned byMMCA.Common/Tests/Hosting/MMCA.Common.Azure.Startup.Tests/Telemetry/AzureMonitorSamplerPrecedenceTests.cs).Framework trace sources are one exported list.
Extensions.FrameworkActivitySourceNames(Source/Hosting/MMCA.Common.Aspire/Extensions.Telemetry.cs:87-:93) names every trace source the Common packages publish (MMCA.Common.Outbox,MMCA.Common.Messaging,MMCA.Common.InternalCommandsand the AI package's source), andConfigureOpenTelemetrysubscribes it beside the host's application-name source (Extensions.Telemetry.cs:132-:133). The names are literals because the Aspire package references none of the defining assemblies, soFrameworkActivitySourceExportTests(MMCA.Common/Tests/Architecture/MMCA.Common.Architecture.Tests/Governance/Telemetry/FrameworkActivitySourceExportTests.cs:28,:39,:52) holds the list equal to the activity sources Common actually creates, and holdsOutboxPollFilterProcessor's source and operation names to it, so a new source cannot ship unexported.Outbox poll spans are filtered out of export.
OutboxPollFilterProcessor(Source/Hosting/MMCA.Common.Aspire/Telemetry/OutboxPollFilterProcessor.cs:17), registered before the exporters (Extensions.Telemetry.cs:123), clears theRecordedflag on the recurringOutboxPollspan and its children (OutboxPollFilterProcessor.cs:49), and on the internal-command queue'sInternalCommandPollspan the same way (OutboxPollFilterProcessor.cs:60-:64). The poll query runs inside that span, opened at the top ofFetchCandidatesAsync(OutboxProcessor.cs:305, span started atOutboxProcessor.cs:311, named atOutboxProcessor.cs:78), and the backlog count inCountPendingAsyncruns inside a second span of the same name (OutboxProcessor.cs:273, started atOutboxProcessor.cs:285), so steady-state polling does not flood Application Insights. Real outbox work is untouched: each per-messageOutboxProcessspan is started byStartOutboxActivity(called once per dispatched message atOutboxProcessor.cs:553, declared atOutboxProcessor.cs:1136; a message a lease renewal found re-claimed (lost) is skipped before that call,OutboxProcessor.cs:547-:551) under an explicit parent context restored from the message's stored trace and span ids (OutboxProcessor.cs:1143-OutboxProcessor.cs:1146), span started atOutboxProcessor.cs:1148-OutboxProcessor.cs:1151, so it is never a child of the poll span. A message that stored no trace or span id gets noOutboxProcessspan at all (OutboxProcessor.cs:1138-:1141).OTLP built in, vendor exporters by adapter.
AddOpenTelemetryExporters(Extensions.Telemetry.cs:163) enables OTLP whenOTEL_EXPORTER_OTLP_ENDPOINTis present (read at:165-:166, the Aspire dashboard sets it, exporter wired at:170), and OTLP is the only exporter the framework wires. A vendor backend is one adapter call made afterAddServiceDefaults(), and each adapter refuses to run before it, because the poll-span and probe filter processors must sit ahead of the vendor exporter (the core leaves itsServiceDefaultsTelemetrymarker atExtensions.Telemetry.cs:147). Three adapters exist. Azure Monitor isAddAzureMonitorExporter()(MMCA.Common/Source/Hosting/MMCA.Common.Azure.Startup/AzureMonitorExporterExtensions.cs:48,UseAzureMonitorat:77with a configured sample ratio and:85without), in theMMCA.Common.Azure.Startuppackage thatMMCA.Common.Azurereferences (MMCA.Common/Source/Hosting/MMCA.Common.Azure/MMCA.Common.Azure.csproj:39), for a host whose cloud deployment setsAPPLICATIONINSIGHTS_CONNECTION_STRING. AWS isAddAwsTelemetryExporter()(MMCA.Common/Source/Hosting/MMCA.Common.Aws/AwsTelemetryExporterExtensions.cs:89, order check at:91-:99), gated onAwsTelemetry:Region(:47, a no-op when blank at:105-:108), which sends traces to X-Ray and, only when a log group and stream are both set, logs to CloudWatch Logs (:148-:161), and no metrics (:66-:69); the Revision (2026-11-12) at the end records it. Google Cloud isAddGoogleCloudTelemetryExporter()(MMCA.Common/Source/Hosting/MMCA.Common.Gcp/GoogleCloudTelemetryExporterExtensions.cs:101, order check at:103-:111), gated onGoogleCloudTelemetry:ProjectId(:23, read at:113, a no-op when blank at:117-:120) with an optionalGoogleCloudTelemetry:Endpoint(:26) that defaults tohttps://telemetry.googleapis.com/(:29, validated byResolveEndpointat:157-:168). It exports traces and logs only, each through its own batch processor over OTLP http/protobuf tov1/tracesandv1/logs(:139-:144, protocol at:199). Each request carries an Application Default Credentials bearer token and thex-goog-user-projectquota-project header (MMCA.Common/Source/Hosting/MMCA.Common.Gcp/Telemetry/GoogleCloudTelemetryAuthHandler.cs:18, stamped at:54-:56). The token is held by a hosted service that fetches the first one while the host starts and refreshes it every minute, retrying a failure after 30 seconds (MMCA.Common/Source/Hosting/MMCA.Common.Gcp/Telemetry/GoogleCloudTelemetryAccessToken.cs:33,:36,:46-:50; registered atGoogleCloudTelemetryExporterExtensions.cs:129-:131), because the OTLP HTTP exporter sends through the synchronousHttpClient.Sendwhile Google credentials hand out tokens asynchronously only (GoogleCloudTelemetryAccessToken.cs:12-:15). Until a token arrives the handler refuses each export locally rather than send it unauthenticated (GoogleCloudTelemetryAuthHandler.cs:46-:51). The exporter options clear their headers, so anOTEL_EXPORTER_OTLP_HEADERSvalue meant for the vendor-neutral exporter never reaches Google (GoogleCloudTelemetryExporterExtensions.cs:200, reason at:188-:191). The call stampsgcp.project_idon the shared OpenTelemetry resource (:38,:138), which every exporter on the host then also carries (:74-:75). Metrics are not exported by this call: the Telemetry API takes at most 200 data points per metric request and OpenTelemetry .NET has no supported way to split oneMetricacross requests, so a Google host ships metrics by pointingOTEL_EXPORTER_OTLP_ENDPOINTat the Google-built OpenTelemetry Collector, its batch processor configured to cap each request at 200 points (:78-:86). Any of these can be active at once, so local development ships to the Aspire dashboard and a deployed host ships to its cloud backend with one adapter call (corrected in place 2026-10-24 and extended 2026-10-25; see the Revisions (2026-10-24) and (2026-10-25) at the end).
Rationale
- Instrument only where auto-instrumentation is blind. The CQRS RED histograms and the outbox dead-letter counter cover the two framework-owned hot paths; everything else (HTTP, runtime) rides the free auto-instrumentation, so the custom surface stays small.
- RED at the decorator, not in every handler. The CQRS pipeline already wraps every handler in a logging decorator (ADR-014), so recording duration and outcome there makes metrics a byproduct of a pipeline layer that exists, with no per-handler discipline (the invariant-over-discipline posture, ADR-015).
- A single correlation id with a W3C fallback. Whether or not a client supplies
X-Correlation-ID, one id stitches the logs of a request together and matches the trace, which is what an operator needs first when a distributed call goes wrong. - Cost knobs default to safe. Sampling, poll-span filtering, and the ASP.NET Core,
HttpClientand runtime metric toggles are the levers a FinOps owner reaches for (COST.md), and all fail toward keeping data: sampling is off unless configured, an out-of-range ratio is ignored, only idle poll spans are dropped, and a metric family drops only on an explicit booleantrue(a typo keeps it on). ParentBasedkeeps distributed traces coherent. An extracted-service deployment (ADR-008) needs a sampled-in request to stay sampled end to end; a per-hop random sampler would shred cross-service traces.
Trade-offs
- Custom instrumentation carries a maintenance cost. The Aspire package has no reference to
Application or Infrastructure by design, so the meter and activity-source names are duplicated as
literals (the twelve meter subscriptions, eleven
MMCA.Common.*atExtensions.Telemetry.cs:307-:317plus Polly atExtensions.Telemetry.cs:324, the trace sources atExtensions.Telemetry.cs:83-:85, and the sync notes atCqrsMetrics.cs:9,OutboxMetrics.cs:9,ConcurrencyConflictMetrics.cs:9-:10,AuthenticationServiceBase.cs:1092-:1093andOutboxPollFilterProcessor.cs:19-:25). A rename on one side silently stops export until the literal is updated. That is the price of the decoupled package graph. - Sampling trades trace completeness for cost. A sampled-out trace is simply gone; deep debugging of a specific request can miss it. Metrics and logs are unaffected (sampling is trace-only), so RED rates and error counts stay whole even at a low ratio.
- Poll-span filtering hides steady-state outbox activity. The dead-letter counter and per-message
OutboxProcessspans remain, but "is the poller alive and looping" cannot be answered from traces alone, by design (that signal is metrics and the dead-letter counter, not spans). - Cross-service trace continuity depends on stored ids and the parent decision. A linked
OutboxProcesstrace only reconnects when the producer captured the trace and span ids on the message;ParentBasedsampling that dropped the originating trace also drops the linked span. - Exporters and sampling are opt-in per host. A host that sets neither exporter variable emits to nothing, and a misconfigured ratio fails toward sample-all (higher cost) rather than toward silence: the intended bias, but it means a cost surprise is possible where a data gap is not.
Revision (2026-08-18)
Two meters and one hop.
Two new failure counters, each on its own meter. cache.eviction.failed, tagged cache_tag, on
MMCA.Common.OutputCache
(MMCA.Common/Source/Presentation/MMCA.Common.API/Caching/OutputCacheMetrics.cs:19, instrument at
:29-37) counts a cross-service output-cache eviction that failed for one tag
(ADR-026's Revision (2026-08-18)); and besteffort.dispatch.failed, tagged
operation, on MMCA.Common.BestEffort
(MMCA.Common/Source/Core/MMCA.Common.Application/Services/BestEffort.cs:102, instrument at :107-115)
counts a swallowed fire-and-forget side effect, the helper's whole purpose being that the caller does
not see the failure. Both are subscribed in the Aspire defaults
(MMCA.Common/Source/Hosting/MMCA.Common.Aspire/Extensions.cs:206-207).
The meter inventory in the Decision above is wrong and has been for a while. This record names two
meters, and ADR-087 called MMCA.Common.Broker "a third",
which was already an undercount. The authoritative list is the subscription block itself
(Extensions.cs:201-Extensions.cs:208), which carried seven at that point:
MMCA.Common.Outbox, MMCA.Common.Cqrs, MMCA.Common.Idempotency, MMCA.Common.Scheduler,
MMCA.Common.Broker, MMCA.Common.OutputCache, MMCA.Common.BestEffort. Two of them
(Idempotency, Scheduler) were never recorded here at all. Read that block, not this prose, when
the question is what the framework exports (it carries ten today; see the Revision (2026-09-19)).
Correlation now starts at the edge. ADR-088 adds a
context-free GatewayCorrelationMiddleware that ensures X-Correlation-ID on the way in and echoes it
on the way out, writing it onto the forwarded request so the service-tier CorrelationIdMiddleware
adopts it rather than minting its own. The Decision's claim that one id stitches a request together
becomes true across the gateway hop, where it previously began at the first service and left the
Gateway's own logs unlinked. No meter, no span, one header, one hop earlier.
Two costs come with it. Both new counters are failure-only, so a healthy system emits nothing on them and a zero is indistinguishable from a host that never wired the feature, which is exactly the shape of signal that goes unnoticed until an incident. And neither is wired to an alert or a runbook section, joining ADR-087's two counters in the gap ADR-062 describes. The duplicated-literal cost this record already records in Trade-offs applied to seven names rather than two from that point on.
Amended (2026-08-31)
The log side of this record. Until now it named only the OpenTelemetry logging call inside
ConfigureOpenTelemetry (Extensions.cs:132); what a host actually WRITES its application log lines
through was undocumented.
Serilog is registered as ONE additional provider, never through UseSerilog(). AddCommonSerilog
(MMCA.Common/Source/Hosting/MMCA.Common.Aspire/Logging/SerilogHostExtensions.cs:48) builds the
framework's logger configuration, publishes it as the global Log.Logger
(SerilogHostExtensions.cs:54), and adds it to the host's existing factory with
builder.Logging.AddSerilog(Log.Logger, dispose: true) (:55). The alternative is a silent-failure
trap no code reading surfaces, which is why the rationale lives on the type itself (:16-:20):
UseSerilog() replaces the whole ILoggerFactory and with it every other provider, including the
OpenTelemetry to Azure Monitor provider AddServiceDefaults wires (Extensions.cs:48,
Extensions.cs:130). A host that calls it publishes no application log line to Application Insights at
all, while its metrics, traces and health endpoints stay green, so the gap reads as a quiet service
rather than as a misconfiguration. Ordering carries the same weight in the other direction: the helper
runs BEFORE AddServiceDefaults() in every host that uses it (for example
MMCA.ADC/Source/Services/MMCA.ADC.Conference.Service/Program.cs:104-:105), so the OpenTelemetry
provider joins the factory Serilog is already in. One fitness test pins the invariant: the built
container must contain exactly one SerilogLoggerProvider
(MMCA.Common/Tests/Hosting/MMCA.Common.Aspire.Tests/Logging/SerilogHostExtensionsTests.cs:156-:158).
Level policy and sinks. The minimum level is Debug in Development and Information everywhere
else (ResolveMinimumLevel, SerilogHostExtensions.cs:76-:77, applied at :107), with
Microsoft.EntityFrameworkCore and Microsoft.AspNetCore held at Warning (:108-:109) and a
console sink always (:110). The rolling daily file sink is environment-conditional: added everywhere
except Production (ShouldWriteFileSink, :87-:88, applied at :112-:118), because a production
container writes it to ephemeral disk nothing reads while stdout and the OpenTelemetry provider already
carry the same events, whereas outside Production (local runs and the CI E2E stack) that file is what a
failure gets diagnosed from. A host needing one extra sink or enricher passes the optional configure
hook (:50, invoked at :120) instead of forking the helper.
A bootstrap logger for the pre-DI window. Module discovery runs before the DI container exists, so
there is no ILogger<T> to resolve yet. CreateBootstrapLoggerFactory() (:67-:68) returns a
factory writing to the same global Log.Logger, which each host disposes once startup wiring is done
(MMCA.Store/Source/Services/MMCA.Store.Catalog.Service/Program.cs:126).
Adoption is asymmetric, but there is only one shape of it. Nine hosts call AddCommonSerilog,
each in its own Program.cs and each ahead of its AddServiceDefaults() call: the seven ADC/Store
service hosts, ADC Conference (:104), Engagement (:83), Identity (:98), Notification (:89), and
Store Catalog (:71), Identity (:75), Sales (:86), plus both Blazor UI hosts,
MMCA.ADC.UI.Web (MMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI.Web/Program.cs:49, AddServiceDefaults at
:51) and MMCA.Store.UI.Web (MMCA.Store/Source/Hosts/UI/MMCA.Store.UI.Web/Program.cs:60,
AddServiceDefaults at :62). Each of the seven service hosts pairs it with
CreateBootstrapLoggerFactory() in the same file (ADC :366, :209, :254, :190; Store :126,
:120, :133); the two UI hosts do not, because they discover no modules and so have no pre-DI
window to cover. The asymmetry that remains is the two Gateways, the only hosts with no Serilog at all:
neither references it in its Program.cs, and both take the plain OpenTelemetry logging
AddServiceDefaults gives them (MMCA.ADC/Source/Hosts/MMCA.ADC.Gateway/Program.cs:58,
MMCA.Store/Source/Hosts/MMCA.Store.Gateway/Program.cs:65).
Two costs come with it. The invariant is guarded in the framework, not at the consumer: the one
test above runs in MMCA.Common, and nothing in a host's own build stops a new service from reaching for
UseSerilog(), whose failure mode is silence in a place nobody watches for absence. And
Information is not the level that reaches
the queryable store: ADR-098 records the
production thinning that floors the OpenTelemetry logging provider at Warning while Serilog keeps
Information on container stdout, so the two providers this record puts side by side deliberately
carry different volumes.
Amended (2026-09-03): probe telemetry
Health probes were the trace bill. Container Apps liveness and readiness probes, the gateway's
downstream aggregate probes, YARP active health checks and the availability web test accounted for
every AppRequests row in both production workspaces, and their children (the health check's SQL
SELECT 1, the Redis PING, the gateway's HttpClient calls to each backend's /alive) for most of
the AppDependencies rows. None of it carries end-user signal, and none of it is touched by
Telemetry:TracesSampleRatio, because probe spans are exactly what a ratio sampler is asked to keep
proportionally.
A third cost knob, and the only one that defaults to on. Telemetry:FilterProbeTelemetry
(Extensions.cs:37) is read by IsProbeTelemetryFilterEnabled
(Extensions.cs:540-Extensions.cs:541) at Extensions.cs:228. It inverts the fail-safe direction
of the other knobs on purpose: absent, blank or unparseable all mean "filter", and only an explicit
boolean false turns filtering off, for a host debugging its own probes. What a probe path is comes
from one place, HealthEndpointPaths.IsProbePath
(Source/Hosting/MMCA.Common.Aspire/HealthEndpointPaths.cs:29-:33): /alive, /health, and
anything below /health/, case-insensitively.
Two instrumentation predicates plus one processor, because probe spans arrive by three routes.
With the knob on, the tracing setup attaches both filters to the default-named instrumentation
options (Extensions.cs:234-Extensions.cs:237; the unfiltered branch at
Extensions.cs:241-Extensions.cs:242 is plain AddAspNetCoreInstrumentation and
AddHttpClientInstrumentation). ProbeTelemetryFilter.ShouldCollectRequest
(Source/Hosting/MMCA.Common.Aspire/Telemetry/ProbeTelemetryFilter.cs:40) refuses the inbound probe
request span and stamps an mmca.probe marker tag on it (ProbeTelemetryFilter.cs:33, set at
:51), because a refused request never gets its url.path written and its descendants would
otherwise have no way to recognize their own ancestor.
ProbeTelemetryFilter.ShouldCollectOutgoing (:62-:63) refuses outbound probe calls that are not
descendants of any inbound request, the gateway's DownstreamServiceHealthCheck calls and YARP's
active checks, both driven by background timers. The descendants are handled by
ProbeTelemetryFilterProcessor
(Source/Hosting/MMCA.Common.Aspire/Telemetry/ProbeTelemetryFilterProcessor.cs:20), registered only
when the knob is on and, like the outbox poll filter, before the exporters
(Extensions.cs:257): it walks the in-process parent chain (ProbeTelemetryFilterProcessor.cs:52),
matches the marker or a server span whose path, route or display name is a probe (:66-:79), and
clears Recorded plus IsAllDataRequested (:59-:60) at both OnStart (:29) and OnEnd
(:40), since a client span carries no identifying tag yet when it starts. Unlike the two metrics
knobs, these filters need no view: configuring the default-named options also covers the
instrumentation the Azure Monitor distro adds.
Metrics are deliberately untouched (Extensions.cs:226-Extensions.cs:227):
http.server.request.duration, Kestrel and routing instruments keep flowing, so probe traffic stays
on dashboards.
Two costs come with it. "Did the probe pass" is no longer answerable from traces, the same
blindness poll-span filtering already accepts for the outbox, so that question belongs to metrics
and the health endpoints (ADR-025) instead. And this knob fails
toward dropping data while sampling and the two metrics toggles fail toward keeping it: a host that
adds a real route below /health/ has its traces filtered by IsProbePath's prefix match with no
error and no log line.
Revision (2026-09-07)
Telemetry gained the properties that make it usable as evidence, from the 2026-09-07 security review.
- The daily ingestion cap is alerted on (SEC-ADC-47 / SEC-Store-55). A workspace daily cap
(
MMCA.ADC/infra/foundation.bicep:15, applied at:54;MMCA.Store/infra/foundation.bicep:57) stops ingestion for every table until the next UTC midnight when it is hit, which silently blinds every log-based alert rule in the deployment. Both templates now carry a scheduled query rule that fires on the ingestion status event: ADC atMMCA.ADC/infra/main.bicep:500(query at:510), Store atMMCA.Store/infra/main.bicep:571(query at:587, matching bothApproachingQuotaandOverQuotaso the warning arrives before the outage). This is a detection outage, not a cost event, which is why it is alerted rather than left to the cost report. - Control-plane and data-plane access is logged (SEC-ADC-46 / SEC-Store-21). ADC deploys SQL
auditing to the workspace (
MMCA.ADC/infra/main.bicep:790, with the master-database diagnostic setting that carries the audit category at:815) and diagnostic settings on Service Bus (:1034), the avatar and key-ring storage account (:1141) and Key Vault (:1330). Store deploys the same pair (MMCA.Store/infra/main.bicep:833and:819, rationale at:798-802) plus diagnostics on the key-ring blob account (:1173) and Key Vault (:1317), and Defender for SQL threat protection behind a parameter (:863). - Store alerts on an authentication signal (SEC-Store-54 / SEC-ADC-51). The failed-request and
failed-dependency SLO rules deliberately exclude 401 and 499
(
MMCA.Store/infra/main.bicep:276,:294), which meant a credential-stuffing run produced nothing but filtered-out rows. A dedicated rule now watches sustained 401s on the/Authroute (:491, query at:501), with the reasoning for keeping the two separate written above it (:460-475). - Reviewer names no longer carry email addresses. Store shipped a data migration that scrubs
them out of the stored review rows
(
MMCA.Store/Source/Hosting/MMCA.Store.Migrations.SqlServer.Catalog/Migrations/20260907112935_ScrubEmailAddressesFromProductReviewerNames.cs), because the reviewer name is rendered on an anonymous surface and the access token had been putting the address into the name claim it was captured from.
Revision (2026-09-11)
An eighth meter, a second trace source, a second poll loop kept off the bill, and one meter this pipeline does not carry.
The durable internal-command queue exports through this record's pipeline.
InternalCommandMetrics
(MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/InternalCommands/Processing/InternalCommandMetrics.cs:20)
owns the meter MMCA.Common.InternalCommands and five instruments: processed, failed and
dead-letter counters (:38, :48, :57) plus a duration and a schedule-lag histogram (:66,
:75), the same RED-plus-dead-letter shape the outbox and CQRS paths already publish
(ADR-114). The Aspire defaults subscribe it as the
eighth entry in the meter chain (Extensions.cs:208) and add its activity source beside the outbox
one (Extensions.cs:214). The authoritative list stays the block itself
(Extensions.cs:201-Extensions.cs:208), which now carries eight: the seven the Revision
(2026-08-18) names plus MMCA.Common.InternalCommands.
The queue's poll loop is filtered like the outbox one. OutboxPollFilterProcessor clears
Recorded on an InternalCommandPoll span from the internal-command activity source with the same
pass it applies to OutboxPoll (OutboxPollFilterProcessor.cs:60-:64), so a second always-on
poller does not restore the ingestion cost the outbox filter removes. The cost is the same one the
Trade-offs already accept: whether that poller is alive and looping is a metrics question, not a
trace one.
One meter is defined and not subscribed here. MMCA.Common.AI
(MMCA.Common/Source/Core/MMCA.Common.AI/Observability/AiUsageMeter.cs:26) carries the token-usage
instruments of the governed chat-client boundary
(ADR-120) and is absent from the AddMeter chain, so a host
that takes the AI package exports nothing from it through AddServiceDefaults until it subscribes
the name itself. That is the duplicated-literal cost of the decoupled package graph in its other
direction, where the miss reads as an absence rather than as a rename.
Alternatives rejected
- An
ActivitySourcespan per command and query in the CQRS pipeline, tagged by module. Evaluated 2026-09-16 against a modular-monolith template that ships one, and declined. The pitch assumes production runs as a single process, and it does not: ADC and Store deploy one module per container app, so cross-module calls are already gRPC or HTTP spans and the module is implied by the cloud role name. The ASP.NET Core request span already names the route, which maps to one command or query;LoggingCommandDecoratoralready carries a CommandName plus ModuleName log scope, a query tag on the SQL, and aCqrsMetricsduration histogram tagged by command. Traces sample at 25% and trace ingestion is a real cost line (with sampling on, metrics measured larger in every recorded window, see Context), so an extra dependency row per command or query buys duplication at a measurable price. Revisit only on a concrete diagnostic gap (orphan SQL spans from scheduled jobs would be one), and scope any fix to that path rather than to the pipeline. - A collector-free metrics path:
AddGoogleCloudTelemetryExporter()exporting metrics straight to the Telemetry API beside traces and logs. Weighed 2026-10-25 and declined. The API takes at most 200 data points per metric request, and OpenTelemetry .NET offers no supported way to split one metric's points across requests (aMetriccannot be constructed outside the SDK), so a host whose instruments carry more than 200 time series would have whole batches rejected (MMCA.Common/Source/Hosting/MMCA.Common.Gcp/GoogleCloudTelemetryExporterExtensions.cs:78-:81), and the rejection lands at export time, after the host has started. The Google-built Collector can be configured to cap each request at 200 points (send_batch_max_size: 200,:82-:86), so metrics take that path and the adapter ships traces and logs only. Revisit when OpenTelemetry .NET exposes a supported way to split one metric's points across export requests, or when the Telemetry API lifts the 200-point cap.
Related
ADR-003 (the outbox whose dead-letter counter and poll-span filtering this defines), ADR-014 (the
CQRS decorator pipeline that emits the RED histograms as a byproduct of its logging decorators),
ADR-009 (resilience and recovery objectives, configured alongside telemetry in the same
AddServiceDefaults; observability is the diagnostic layer under that posture), ADR-025 (startup
warm-up and readiness gating, whose health-check endpoints are the operational-signal sibling of these
telemetry signals in the same Aspire defaults), ADR-114 (the durable internal-command queue whose
meter, activity source and poll-span filtering this pipeline carries), ADR-120 (the governed chat
client whose MMCA.Common.AI meter these defaults now subscribe), and COST.md (the FinOps companion that records
span-filtering and sampling as cost levers).
Amended (2026-09-11): the Polly meter
A ninth meter, one cost knob, and one log level.
Polly's meter is subscribed. AddServiceDefaults puts the standard resilience handler on every
HttpClient and every gRPC typed client
(MMCA.Common/Source/Hosting/MMCA.Common.Aspire/Extensions.cs:83, :93-:98,
ADR-009), so Polly is the component that decides whether
an inter-service call is retried, timed out, or refused by an open circuit. None of that left the
process: the subscription block carried the eight MMCA.Common.* meters and never the one named
Polly, so a backend brownout looked, from a dashboard, exactly like latency.
metrics.AddMeter(PollyMeterName) (Extensions.cs:596, the literal at :49) makes it the ninth.
resilience.polly.strategy.events is always exported (Extensions.cs:57). It is a counter tagged
with the pipeline name, the strategy name, the event name (OnRetry, OnCircuitOpened,
OnCircuitClosed, OnTimeout), the event severity and the exception type, and it is the only
production signal that a client is retrying or that a circuit opened. It is low volume and low
cardinality, so it sits behind no knob.
The two duration histograms are dropped unless a host asks for them.
resilience.polly.strategy.attempt.duration (Extensions.cs:60) and
resilience.polly.pipeline.duration (:63) are removed by a metrics View unless
Telemetry:EnablePollyDurationMetrics parses as boolean true (:598-:610, the key at :43, read
through IsInstrumentationEnabled at :490). They are per-bucket streams on a pipeline that runs on
every outbound call and they re-measure what http.client.request.duration already reports, so they
stay off until someone is actually debugging a retry storm (rubric section 31). This knob is the
mirror image of Telemetry:DisableHttpClientMetrics: it is off by default and must be turned on, and
anything other than a parseable true leaves the histograms dropped.
Where the block lives now. The metrics configuration moved out of the WithMetrics lambda into a
dedicated ConfigureMetrics method (Extensions.cs:534, called at :179). The MMCA.Common.* meter
chain is at Extensions.cs:598-:606, the Polly subscription at :613, and the trace sources at
:182-:185. The earlier entries in this record cite the pre-move lines; the Trade-offs bullet above
is corrected to the current ones. The authoritative list is still the block itself, and it now carries
nine.
The CQRS decorators log a thrown exception once. LoggingCommandDecorator and
LoggingQueryDecorator still record the duration of a failed execution and still tag it
outcome=exception
(MMCA.Common/Source/Core/MMCA.Common.Application/UseCases/Decorators/LoggingCommandDecorator.cs:97-:101,
MMCA.Common/Source/Core/MMCA.Common.Application/UseCases/Decorators/LoggingQueryDecorator.cs:91-:95),
so the RED signal this record defines is unchanged in shape and in volume. What changed is the level
and the payload of the decorator's own log line: Warning, without the exception object
(LoggingCommandDecorator.cs:117-:118, LoggingQueryDecorator.cs:106), because the single Error row
with the full stack belongs to the boundary that handles the exception
(MMCA.Common/Source/Presentation/MMCA.Common.API/Middleware/GlobalExceptionHandler.cs:67,
MMCA.Common/Source/Presentation/MMCA.Common.API/Middleware/DbUpdateExceptionHandler.cs:31). Both
lines carry the same correlation id, so they still join; an alert built on the decorator's Error level
moves to the boundary's (ADR-014).
Revision (2026-09-19): the AI meter is subscribed
A tenth meter, and a fourth trace source.
MMCA.Common.AI is in the chain now. The subscription block ends with
.AddMeter(AiTelemetryName)
(MMCA.Common/Source/Hosting/MMCA.Common.Aspire/Extensions.cs:606, the literal at :62), and the
same name is added as a trace source beside the application name, the outbox one and the
internal-command one (Extensions.cs:185). The meter carries the token-usage instruments of the
governed chat-client boundary (ADR-120): two token counters
and a call-duration histogram, created by AiUsageMeter from an IMeterFactory
(MMCA.Common/Source/Core/MMCA.Common.AI/Observability/AiUsageMeter.cs:77, :81, :85) on the
meter name it declares at AiUsageMeter.cs:26. A host that takes the AI package therefore exports
token spend and call duration through AddServiceDefaults with no per-host subscription, which is
what the Revision (2026-09-11) said it had to do for itself. That entry and the Related line that
restated it are superseded.
The count is ten. Reading the block itself, which stays the authoritative list: nine
MMCA.Common.* meters (Outbox, Cqrs, Idempotency, Scheduler, Broker, OutputCache,
BestEffort, InternalCommands, AI, at Extensions.cs:598-:606) plus Polly
(Extensions.cs:613). The nine in the Amended (2026-09-11) section counted eight
MMCA.Common.* names plus Polly and is superseded by this one.
Subscribing a package this assembly cannot reference is still deliberate, and still free. The
Aspire package has no project reference to MMCA.Common.AI, which is what keeps the optional
language-model dependency out of every host that never adopts it, so the name is a literal here and
the subscription is inert in a host that never takes the package (Extensions.cs:55-:62). The
cost is the one this record's Trade-offs already name, now spread over ten meter literals rather
than nine: a rename on the publishing side stops export silently until the literal follows.
Revision (2026-10-01)
A third metrics cost knob, and the citations follow the telemetry code into its own file.
ASP.NET Core metrics are no longer unconditional. ConfigureMetrics now starts by calling
ConfigureAspNetCoreMetrics
(MMCA.Common/Source/Hosting/MMCA.Common.Aspire/Extensions.Telemetry.cs:245, declared at :352),
which reads Telemetry:DisableAspNetCoreMetrics through the same IsInstrumentationDisabled helper
as the other two metrics knobs (:354). When it parses as true, a View drops every meter named
under the Microsoft.AspNetCore. prefix (:359-:362); otherwise AddAspNetCoreInstrumentation
runs (:366). The reason is recorded on the method (:343-:349): that family was 73% of both
production workspaces' ingestion over 2026-09-22..28, mostly gauges re-emitted on idle replicas, and
no alert reads it, because request latency and failure alerts run off the request traces. Both
deployments turn it on (MMCA.ADC/infra/main.bicep:298-:299, MMCA.Store/infra/main.bicep:253-:254).
The Decision's cost-knob bullet now names three families, and two statements in the Amended
(2026-09-03) section are superseded on that point: the probe knob itself still leaves metrics alone
(Extensions.Telemetry.cs:98-:99), but with this knob on, http.server.request.duration and the
Kestrel and routing instruments are dropped in production, so probe traffic is not on production
dashboards; and there are three metrics toggles, not two, all failing toward keeping data.
Two smaller behavior details the Decision now records. The outbox dead-letters an unresolvable
event type at once only when the row has been attempted before: on the row's first attempt
(RetryCount 0) it is retried as transient
(MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/Outbox/Processing/OutboxProcessor.cs:667-:674)
unless MaxRetries is 1 or less, and a second OutboxPoll span wraps the backlog count in
CountPendingAsync (OutboxProcessor.cs:276, :288). CorrelationIdMiddleware treats a blank header
as absent and cuts a supplied id to 64 characters
(MMCA.Common/Source/Presentation/MMCA.Common.API/Middleware/CorrelationIdMiddleware.cs:24, :39-:41,
:56).
Citations refreshed. The OpenTelemetry configuration, exporters, knob helpers and meter chain now
live in Extensions.Telemetry.cs, so every Decision and Trade-offs citation into it is rebased, as are
the CQRS decorator, outbox processor and correlation middleware citations. The dated amendment and
revision sections keep the anchors they were written against.
Revision (2026-10-06)
Four statements in earlier sections no longer match the code, and the anchors moved again.
- The correlation id has a printable-ASCII filter. After the 64-character cut,
Sanitizediscards any supplied id holding a character outside' '..'~', so the middleware falls back to the trace id and thenTraceIdentifier(MMCA.Common/Source/Presentation/MMCA.Common.API/Middleware/CorrelationIdMiddleware.cs:61-:65, the filter at:64), because Kestrel refuses to echo such a value in a response header. The Gateway'sGatewayCorrelationMiddlewareapplies the same cut and filter (MMCA.Common/Source/Hosting/MMCA.Common.Aspire/Gateway/GatewayCorrelationMiddleware.cs:89-:90). The Decision bullet now says so. - Store's auth alert counts 401 or 429, not only 401. The Revision (2026-09-07) item 3 describes a
rule on sustained 401s;
authFailureSpikeAlert(MMCA.Store/infra/main.bicep:537) queriesResultCode in ("401", "429")on the/Authpath (:553), because ADR-029 account lockout and the gateway's auth-tight limiter answer 429, so the rule also sees lockout storms (reasoning at:525-:529). - The bootstrap logger factory is not disposed once startup wiring is done. Every service host
declares it as a top-level
using var(for exampleMMCA.Store/Source/Services/MMCA.Store.Catalog.Service/Program.cs:124), so it is disposed only when the program ends, afterawait app.RunAsync()(:366). The Amended (2026-08-31) wording is superseded on that point. GlobalExceptionHandlerwrites its Error row only on its 500 path. The Amended (2026-09-11) section says the single Error row with the stack belongs to the handling boundary;GlobalExceptionHandlerlogs it atMMCA.Common/Source/Presentation/MMCA.Common.API/Middleware/GlobalExceptionHandler.cs:97before answering 500 (:99), while a cross-tenant write (:56) and aBadHttpRequestException(:77) are logged at Warning.DbUpdateExceptionHandlerstill writes an Error row with the stack (MMCA.Common/Source/Presentation/MMCA.Common.API/Middleware/DbUpdateExceptionHandler.cs:31) and answers 409 Conflict (:33).- Current locations for facts the dated sections still carry. Serilog adoption (nine hosts, each
calling
AddCommonSerilogbeforeAddServiceDefaults, the Gateways without Serilog) is unchanged; the calls are now ADC ConferenceProgram.cs:102, Engagement:84, Identity:99, Notification:87,MMCA.ADC.UI.Web:50, Store Catalog:72, Identity:76, Sales:87,MMCA.Store.UI.Web:61; bootstrap factories at ADC:368,:212,:264,:194and Store:124,:118,:131; the ADC Gateway'sAddServiceDefaultsatMMCA.ADC/Source/Hosts/MMCA.ADC.Gateway/Program.cs:69. The telemetry code the Amended (2026-09-03) and (2026-09-11) sections cite inExtensions.csnow lives inExtensions.Telemetry.cs:FilterProbeTelemetryConfigKey:19,IsProbeTelemetryFilterEnabled:233,ProbeTelemetryFilterProcessorregistered at:129,ConfigureMetrics:243(called at:80), theMMCA.Common.*meter chain:307-:315, the Polly subscription:322, the trace sources:83-:86. The Revision (2026-09-07) resources: ADClogIngestionCapAlertMMCA.ADC/infra/main.bicep:638(query:654),sqlServerAuditing:872,sqlAuditDiagnostics:897,serviceBusDiagnostics:1166,avatarBlobDiagnostics:1270,keyVaultDiagnostics:1505; StorelogIngestionQuotaAlertMMCA.Store/infra/main.bicep:623(query:639),sqlAuditDiagnostics:871,sqlAuditingSettings:885,sqlThreatProtection:915,dataProtectionBlobDiagnostics:1203,keyVaultDiagnostics:1376, the SLO 401/499 exclusions:316,:334. - Every anchor in the Status, Decision, Rationale, Trade-offs and Related sections was re-verified against current source; the outbox, correlation-middleware and ADC bicep anchors in the Decision were rebased.
Revision (2026-10-07)
Re-verified against current source. The telemetry baseline, the CQRS and outbox instruments, the
correlation middleware, the metrics knobs, sampling, poll-span filtering and the exporters
behave as the Decision describes, and every Extensions.Telemetry.cs line anchor still holds. What
moved is one cost statement, one outbox detail, and the outbox, ADC bicep, ADC Conference
Program.cs and GlobalExceptionHandler line anchors (the outbox processor's lines moved in the
v1.233.0 release, the GlobalExceptionHandler lines in v1.232.1).
- Sampled traces are not the largest measured ingestion line. The Context said full-fidelity
tracing is the single largest observability line item, which still matches the deployments'
own comments on unsampled export (
MMCA.ADC/infra/main.bicep:275-:277,MMCA.Store/infra/main.bicep:202-:204); the rejected per-command span alternative went further and called sampled trace ingestion the largest cost line. Both deployments have sampled at 25% since before any recorded measurement (MMCA.ADC/infra/main.bicep:280-:281), and every recorded window puts metrics on top:http.client.*plus runtime about 65% of AppMetrics over 2026-08-03..09 (MMCA.ADC/infra/main.bicep:305-:307), AppMetrics about 63% of workspace ingestion in ADC and 67% in Store over 2026-08-01..22 after those two groups were dropped (MMCA.ADC/infra/main.bicep:341-:342,MMCA.Store/infra/main.bicep:268), and the ASP.NET Core meter family alone 73% over 2026-09-22..28 (MMCA.ADC/infra/main.bicep:321-:322,MMCA.Store/infra/main.bicep:249), the figure the Revision (2026-10-01) records. The Context now separates the two claims and the alternative names sampled traces. The framework comment atMMCA.Common/Source/Hosting/MMCA.Common.Aspire/Extensions.Telemetry.cs:134-:135still calls trace ingestion the largest observability line item without qualifying it as unsampled. No more recent ingestion breakdown is recorded in source, so which line is largest after the ASP.NET Core family was dropped is not stated here. - Not every outbox message gets an
OutboxProcessspan.StartOutboxActivityreturns null when the message stored no trace or span id (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/Outbox/Processing/OutboxProcessor.cs:888-:891), so such a message is processed with no span. The Decision bullet now says so. - Anchors re-verified against current source: in
OutboxProcessor.cs, thetype_unresolvableincrement:845-:848insideHandleUnresolvableType:828, the first-attempt retry guard:834-:841, theretries_exhaustedguard:568and increment:573-:576, the activity source:91,PollActivityName:73,FetchCandidatesAsync:287(span:293),CountPendingAsync:255(span:267),StartOutboxActivitycalled:490and declared:886, its parent context:893-:896and span start:898-:901; the ADCTelemetry__DisableAspNetCoreMetricssettingMMCA.ADC/infra/main.bicep:326-:327(StoreMMCA.Store/infra/main.bicep:253-:254unchanged). Current locations for anchors the dated sections keep as written: the ADC Conference bootstrap factoryMMCA.ADC/Source/Services/MMCA.ADC.Conference.Service/Program.cs:370(RunAsync:475; the other six service hosts unchanged);GlobalExceptionHandlerError rowMMCA.Common/Source/Presentation/MMCA.Common.API/Middleware/GlobalExceptionHandler.cs:100and its 500 at:102, the cross-tenant Warning:58(400 at:60) and the bad-request Warning:80(DbUpdateExceptionHandler.cs:31and:33unchanged); the ADC Revision (2026-09-07) resourceslogIngestionCapAlertMMCA.ADC/infra/main.bicep:654(query:670),sqlServerAuditing:888,sqlAuditDiagnostics:913,serviceBusDiagnostics:1186,avatarBlobDiagnostics:1290,keyVaultDiagnostics:1529(the Store resources the Revision (2026-10-06) lists are unchanged). The Revision (2026-10-06) closing statement that every live anchor was re-verified held for that date; this item supersedes it for the outbox and ADC bicep anchors.
Revision (2026-10-21)
Re-verified against current source. The telemetry baseline, the CQRS and outbox instruments, the
three metrics knobs, sampling, poll-span filtering, the exporters, the ten meter subscriptions and
the nine AddCommonSerilog hosts behave as the Decision and the dated sections describe. What
moved is every Extensions.Telemetry.cs anchor from the sampling comment onward (the comment grew
one line), every OutboxProcessor.cs anchor, the Store bicep anchors and most host Program.cs
anchors; one outbox detail is narrowed.
StartOutboxActivityruns once per dispatched message, not once per fetched message. The dispatch loop renews the lease when due and skips a message a renewal found re-claimed (lost) before it reachesStartOutboxActivity(MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/Outbox/Processing/OutboxProcessor.cs:542-:546, the call at:548), so such a message gets noOutboxProcessspan in that pass. The Decision bullet now says so.- The framework sampling comment now agrees with the Context.
MMCA.Common/Source/Hosting/MMCA.Common.Aspire/Extensions.Telemetry.cs:134-:136calls trace ingestion the largest observability line item "when unsampled" and notes that once sampled, metrics can outweigh traces, so the residual the Revision (2026-10-07) item 1 flags is closed. - Anchors re-verified against current source: in
Extensions.Telemetry.cs, the sampling call:138, theParentBasedSampler:139,TryGetTraceSampleRatio:186(key:189, fallback:190-:195),AddOpenTelemetryExporters:160(summary:158, OTLP:162-:163and:167, connection string:170-:171, check:173,UseAzureMonitor:175),IsInstrumentationDisabled:209-:210,ConfigureAspNetCoreMetrics:353(called at:246, reason:344-:350, knob:355,View:360-:363, add:367), theHttpClientknob:255(View:267-:271, add:275), the runtime knob:282(View:287-:290, add:294), theMMCA.Common.*meter chain:308-:316(Outbox:308, Cqrs:309) and Polly:323; inOutboxProcessor.cs, the activity source:99,PollActivityName:75,CountPendingAsync:268(span:280),FetchCandidatesAsync:300(span:306), theretries_exhaustedguard:627and increment:632-:635,HandleUnresolvableType:1032(first-attempt retry:1038-:1045, increment:1049-:1052),StartOutboxActivitydeclared:1090(null return:1092-:1095, parent context:1097-:1100, span start:1102-:1105); inMMCA.Store/infra/main.bicep, the sampling comment:206-:209, theTelemetry__DisableAspNetCoreMetricssetting:257-:258(its 73% comment:252-:253) and the 67% export-interval comment:271-:273. The ADC bicep anchors in the Context and Decision hold. Current locations for anchors the dated sections keep as written:IsProbeTelemetryFilterEnabledExtensions.Telemetry.cs:234andConfigureMetrics:244(FilterProbeTelemetryConfigKey:19,ProbeTelemetryFilterProcessor:129, the call at:80and the trace sources:83-:86unchanged);AddCommonSerilogin ADC ConferenceProgram.cs:102, Engagement:84, Identity:100, Notification:87,MMCA.ADC.UI.Web:50, Store Catalog:72, Identity:77, Sales:88,MMCA.Store.UI.Web:61, each before itsAddServiceDefaults(); bootstrap factories at ADC:372,:213,:265,:195and Store:124,:119,:132;RunAsyncin ADC ConferenceMMCA.ADC/Source/Services/MMCA.ADC.Conference.Service/Program.cs:478and Store CatalogMMCA.Store/Source/Services/MMCA.Store.Catalog.Service/Program.cs:365; the Gateways'AddServiceDefaultsatMMCA.ADC/Source/Hosts/MMCA.ADC.Gateway/Program.cs:69andMMCA.Store/Source/Hosts/MMCA.Store.Gateway/Program.cs:65, with no Serilog call in either. The Revision (2026-10-07) statements that everyExtensions.Telemetry.csanchor held and that the other six service hosts' bootstrap anchors were unchanged held for that date; this item supersedes them.
Revision (2026-10-24)
ADR-134 moves every Azure dependency out of the core
packages. For this record that changes one thing, the exporter: AddServiceDefaults() no longer wires
Azure Monitor when APPLICATIONINSIGHTS_CONNECTION_STRING is set (MMCA.Common/CHANGELOG.md:27).
Instrumentation, meters, sampling and the cost knobs are unchanged.
- OTLP is the only built-in exporter.
AddOpenTelemetryExporters(MMCA.Common/Source/Hosting/MMCA.Common.Aspire/Extensions.Telemetry.cs:163) readsOTEL_EXPORTER_OTLP_ENDPOINT(:165-:166) and callsUseOtlpExporter()(:170), nothing else. - Azure Monitor is an adapter call.
AddAzureMonitorExporter()(MMCA.Common/Source/Hosting/MMCA.Common.Azure/AzureMonitorExporterExtensions.cs:12,:42) callsUseAzureMonitor()(:63). It throws when called beforeAddServiceDefaults()(:45-:50), because the outbox and probe filter processors must be registered ahead of the exporter (Extensions.Telemetry.cs:146). - A missing call fails startup. A host that receives
APPLICATIONINSIGHTS_CONNECTION_STRINGwithout the call failsValidateOnStart, naming it (MMCA.Common/Source/Hosting/MMCA.Common.Aspire/Integrations/HostIntegrationTripwire.cs:20,:31; the call's marker atAzureMonitorExporterExtensions.cs:56). - Corrected in place: the Decision bullet "Dual exporters, either or both", which placed
UseAzureMonitorinsideAddServiceDefaultsatExtensions.Telemetry.cs:175with the connection-string read at:170-:171. Anchors inside the earlier revisions are left as recorded.
Revision (2026-10-25)
MMCA.Common v1.257.0 adds the Google Cloud adapter, and with it a second vendor exporter
(MMCA.Common/CHANGELOG.md:7, :22). Instrumentation, meters, sampling, the cost knobs and the
built-in OTLP exporter are unchanged.
AddGoogleCloudTelemetryExporter()ships traces and logs to Google Cloud. It is gated onGoogleCloudTelemetry:ProjectIdwith an optionalEndpoint(MMCA.Common/Source/Hosting/MMCA.Common.Gcp/GoogleCloudTelemetryExporterExtensions.cs:23,:26,:101), sends OTLP http/protobuf totelemetry.googleapis.com(:29,:199) with an Application Default Credentials bearer token and thex-goog-user-projectheader (MMCA.Common/Source/Hosting/MMCA.Common.Gcp/Telemetry/GoogleCloudTelemetryAuthHandler.cs:18,:54-:56; the credential atMMCA.Common/Source/Hosting/MMCA.Common.Gcp/Telemetry/ApplicationDefaultTelemetryTokenSource.cs:31-:32), and holds the token in a hosted service that refreshes it every minute (MMCA.Common/Source/Hosting/MMCA.Common.Gcp/Telemetry/GoogleCloudTelemetryAccessToken.cs:33). It must followAddServiceDefaults()and throws otherwise (GoogleCloudTelemetryExporterExtensions.cs:103-:111), the same rule as the Azure Monitor adapter, and it clears the exporter headers so the vendor-neutral exporter'sOTEL_EXPORTER_OTLP_HEADERSnever reach Google (:200). The Decision's exporter bullet now records both adapters.- Metrics go through the Google-built Collector. The Telemetry API caps a metric request at 200
data points and OpenTelemetry .NET has no supported way to split one
Metric, so the adapter exports no metrics (GoogleCloudTelemetryExporterExtensions.cs:78-:86). The direct path is recorded under Alternatives rejected with its revisit condition. gcp.project_idis set on the shared resource (:38,:138), so every exporter on a Google host, the vendor-neutral one included, carries the project id Google maps the data to (:32-:38,:74-:75).- A lost call fails startup.
GoogleCloudTelemetry:ProjectIdset without the call failsValidateOnStart, naming it (MMCA.Common/Source/Hosting/MMCA.Common.Aspire/Integrations/HostIntegrationTripwire.cs:46,:98-:102; the call's marker atGoogleCloudTelemetryExporterExtensions.cs:127).
Two costs come with it. A Google host has two export paths to keep healthy: the adapter for traces
and logs, and a Collector sidecar for metrics, configured outside this framework. And a host without
credentials still starts and exports nothing until a token refresh succeeds; the failure is a Warning
log line (GoogleCloudTelemetryAccessToken.cs:108-:109) and refused exports
(GoogleCloudTelemetryAuthHandler.cs:46-:51), not a startup failure.
Revision (2026-10-26)
Re-verified against current source. The telemetry baseline, the CQRS and outbox instruments, the
three metrics knobs and their drop views, sampling, poll-span filtering and the exporters behave as
the Decision describes. What moved is the meter count (one new framework meter), most
Extensions.Telemetry.cs and OutboxProcessor.cs anchors in the live sections, and the ADC and Store
bicep anchors after the 2026-10-24 bicep edits. The exporter anchors (Extensions.Telemetry.cs:147,
:163, :165-:166, :170) and PollActivityName (OutboxProcessor.cs:75) held.
- The meter chain carries eleven subscriptions: ten
MMCA.Common.*plusPolly. The new one isMMCA.Common.Persistence(MMCA.Common/Source/Hosting/MMCA.Common.Aspire/Extensions.Telemetry.cs:313, the chain at:305-:314, Polly at:321), owned byConcurrencyConflictMetrics(MMCA.Common/Source/Presentation/MMCA.Common.API/Concurrency/ConcurrencyConflictMetrics.cs:27) with one counter,persistence.concurrency.conflict(:37-:38), tagged by entity type. It counts a save rejected by an optimistic-concurrency check and answered as a conflict, recorded once per conflict at the 409 path inDbUpdateExceptionHandler(MMCA.Common/Source/Presentation/MMCA.Common.API/Middleware/DbUpdateExceptionHandler.cs:38) or at the 412 path under an explicitIf-Match. Like the other framework meters its name is duplicated as a literal in the Aspire package, so the Trade-offs maintenance cost now spans eleven literals. The Trade-offs bullet is corrected in place, and its sync-note list now includes the new meter's note (ConcurrencyConflictMetrics.cs:9-:10). The meter shipped on 2026-10-24 (in MMCA.Common v1.254.0), so the "meters ... are unchanged" lines of the Revisions (2026-10-24) and (2026-10-25) were already inaccurate on their own dates; they, and the "ten" in the Status entry of 2026-09-19, are left as written and superseded by this item. - Anchors re-verified against current source: in
Extensions.Telemetry.cs,ConfigureOpenTelemetry:70(OTel logging:72, flags:74-:75), filtered tracing:105-:108, plain tracing:112-:113, trace sources:83-:85(:82is the application name, not a literal),OutboxPollFilterProcessorregistration:123, the sampling call:139,ParentBasedSampler:140,TryGetTraceSampleRatio:181(key:184, fallback:185-:190),IsInstrumentationDisabled:204-:205,ConfigureAspNetCoreMetrics:351(knob:353,View:358-:361, add:365), theHttpClientknob:250(View:263-:267, add:271), the runtime knob:278(View:283-:286, add:290), Outbox meter:305, Cqrs meter:306;AddServiceDefaultsatMMCA.Common/Source/Hosting/MMCA.Common.Aspire/Extensions.cs:33, callingConfigureOpenTelemetryat:35; inOutboxProcessor.cs, the activity source:101,PollActivityName:75(unchanged),CountPendingAsync:270(span:282),FetchCandidatesAsync:302(span:308), the lease-lost skip:544-:548, theStartOutboxActivitycall:550, theretries_exhaustedguard:629and increment:634-:637,HandleUnresolvableType:1034(first-attempt retry:1040-:1047, increment:1054-:1057),StartOutboxActivitydeclared:1095(null return:1097-:1100, parent context:1102-:1105, span start:1107-:1110); inMMCA.ADC/infra/main.bicep, the sampling comment:276-:279, the 0.25 setting:280-:282, the 65% comment:306-:308, the 73% comment:322-:323(the:326-:327setting and the 63% comment:341-:342hold); inMMCA.Store/infra/main.bicep, the sampling comment:207-:210and the 67% comment:272-:273(the:257-:258setting holds). Current locations for anchors the dated sections keep as written: the probe comment that leaves metrics untouchedExtensions.Telemetry.cs:97-:98,IsProbeTelemetryFilterEnabled:229-:230,ConfigureMetrics:239(called at:79),FilterProbeTelemetryConfigKey:18,ProbeTelemetryFilterProcessor:130; theDbUpdateExceptionHandlerLogError:32and its 409:41; the Application Insights tripwire checkMMCA.Common/Source/Hosting/MMCA.Common.Aspire/Integrations/HostIntegrationTripwire.cs:63-:67(its key constant:20holds).
Revision (2026-10-28)
Re-verified against current source. The telemetry baseline, the CQRS and outbox instruments, the three metrics knobs, sampling, poll-span filtering, the exporters and the eleven meter subscriptions behave as the Decision and the Revision (2026-10-26) describe, and the bicep anchors in the Context and Decision hold. Nothing in the security alerting changed since those re-verifications: this revision records rules they omitted (Store's 403 rule, shipped 2026-09-07 with Store #133, and ADC's auth-failure and 403 rules, shipped 2026-10-19 with ADC #281), and gives current locations for the anchors the dated sections keep as written.
- Both apps alert on authentication and authorization signals. ADC carries the same
auth-failure rule as Store:
authFailureSpikeAlert(MMCA.ADC/infra/main.bicep:797, query:813, threshold 50 per 15 minutes:807-:816, severity 2:804) counts 401 or 429 on the/Authroute, matching Store's rule (MMCA.Store/infra/main.bicep:616, query:632). Both apps also carry aforbiddenBurstAlert(MMCA.ADC/infra/main.bicep:836, query:852;MMCA.Store/infra/main.bicep:656, query:672) that counts 403 responses with no route predicate, threshold 20 per 15 minutes (ADC:855, Store:675) at severity 3 (ADC:843, Store:663): an investigate signal for a replayed token or a permission regression, not a page. The Revision (2026-09-07) statement that Store alerts on a security signal stays as written; this item adds the ADC rules and the 403 rule it did not record. - Anchors re-verified against current source. Current locations for anchors the dated sections
keep as written: in
MMCA.ADC/infra/main.bicep,logIngestionCapAlert:729(query:745),sqlServerAuditing:1070,sqlAuditDiagnostics:1095,serviceBusDiagnostics:1370,avatarBlobDiagnostics:1474,keyVaultDiagnostics:1712, and theDisableAspNetCoreMetricssetting:326-:327(the Revision (2026-10-01):298-:299is now another comment); inMMCA.Store/infra/main.bicep,logIngestionQuotaAlert:702(query:718),authFailureSpikeAlert:616(query:632), the SLO 401/499 exclusions:335(failed requests) and:362(failed dependencies),sqlAuditDiagnostics:954,sqlAuditingSettings:968,sqlThreatProtection:999,dataProtectionBlobDiagnostics:1287,keyVaultDiagnostics:1469, the 73% ASP.NET Core comment:253-:256(the Revision (2026-10-07):249is now theTelemetry__DisableRuntimeMetricssetting), theDisableAspNetCoreMetricssetting:257-:258(the Revision (2026-10-01):253-:254is now that comment), the security-signal rationale block:583-:615(the Revision (2026-09-07):460-:475), within it the 401-or-429 reasoning:604-:608(the Revision (2026-10-06):525-:529), and the SQL auditing rationale block from:918(the Revision (2026-09-07):798-:802);AddCommonSerilogin ADC ConferenceProgram.cs:103, Engagement:85, Identity:101, Notification:88,MMCA.ADC.UI.Web:52, Store Catalog:73, Identity:78, Sales:89,MMCA.Store.UI.Web:63, each still before itsAddServiceDefaults(); bootstrap factories at ADC:378,:219,:272,:201and Store:130,:125,:138;RunAsyncin ADC ConferenceProgram.cs:489and Store Catalog:376; the Gateways'AddServiceDefaultsat ADC:70and Store:69, still with no Serilog call;DbUpdateExceptionHandlerLogError:32,RecordConflict:38, 409:41; the framework sampling commentExtensions.Telemetry.cs:133-:138(the "when unsampled" text:136-:137), theParentBasedSampler:140,ConfigureAspNetCoreMetrics:351(called at:241).
Revision (2026-11-12)
One exporter moves package, one exporter is new, and one meter gains a family of instruments. The instrumentation, sampling, cost knobs, poll-span filtering and built-in OTLP exporter the Decision describes are unchanged.
The Azure Monitor exporter moved package, not name.
AddAzureMonitorExporter()now lives inMMCA.Common.Azure.Startup(MMCA.Common/Source/Hosting/MMCA.Common.Azure.Startup/AzureMonitorExporterExtensions.cs:12,:42; the order check at:44-:52, the tripwire marker at:56,UseAzureMonitorat:63), a package whose only project reference is MMCA.Common.Aspire (MMCA.Common/Source/Hosting/MMCA.Common.Azure.Startup/MMCA.Common.Azure.Startup.csproj:36).MMCA.Common.Azurereferences it (MMCA.Common/Source/Hosting/MMCA.Common.Azure/MMCA.Common.Azure.csproj:44) and forwards the type (MMCA.Common/Source/Hosting/MMCA.Common.Azure/TypeForwards.cs:7), and the namespace staysMMCA.Common.Azure(AzureMonitorExporterExtensions.cs:6), so the call a host writes is unchanged. ADR-134 records the package split. The Decision's exporter bullet is corrected in place; theMMCA.Common.Azure/AzureMonitorExporterExtensions.csanchors in the Revision (2026-10-24) are left as recorded.A third vendor exporter,
AddAwsTelemetryExporter(). It is the AWS twin of the Azure and Google calls (MMCA.Common/Source/Hosting/MMCA.Common.Aws/AwsTelemetryExporterExtensions.cs:17-:20) and follows the same rule: it runs afterAddServiceDefaults()and throws otherwise (:77-:81, check at:91-:99). Gated onAwsTelemetry:Region(:47, a no-op when blank at:105-:108), it exports traces to X-Ray through its own batch processor (:148-:150) and logs to CloudWatch Logs only whenAwsTelemetry:LogGroupandAwsTelemetry:LogStreamare both set (:50-:51,:152-:161), over OTLP http/protobuf with every request signed byAwsSigV4ExportHandler(:244-:258). The exporter options clear their headers, so anOTEL_EXPORTER_OTLP_HEADERSvalue meant for the vendor-neutral exporter never reaches AWS (:248, reason at:230-:232). The call stampscloud.providerandcloud.regionon the shared resource (:143-:147). Without static keys the default credential chain is resolved by a hosted service while the host starts, and a failure there is one Warning, not a failed start (:57-:62,:128-:136). It exports traces and logs only, never metrics: one request is capped at 1,000 data points and the OpenTelemetry .NET SDK has no supported way to split one metric's points across requests, so metrics reach AWS through an ADOT collector named byOTEL_EXPORTER_OTLP_ENDPOINT(:66-:69), the same shape the Google adapter takes. Its tests run against the SDK signer and a loopback receiver; it has not been exercised against live X-Ray or CloudWatch Logs endpoints (:72-:74).AwsTelemetry:Regionset without the call fails startup, as for the other two adapters (:120-:122; ADR-134).The internal-command meter carries the webhook delivery lane. Five instruments on the same
MMCA.Common.InternalCommandsmeter (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/InternalCommands/Processing/InternalCommandMetrics.cs:20,:22) report the dedicated lane ADR-142 runs:Instrument Kind Unit Tags Declared internal_commands.lane.short_circuited.countcounter commands lane:128-:131internal_commands.lane.released.countcounter commands lane:137-:140internal_commands.lane.receiver_cooldowns.countcounter receivers lane:143-:146internal_commands.lane.pending.depthobservable gauge commands lane:152-:156(tag:191)internal_commands.lane.oldest_due.ageobservable gauge s lane,data_source:159-:163(tags:201-:202)A short-circuited row is a due row charged a failed attempt without being sent because its receiver was cooling down (
:123-:127), and a released row is a claimed row returned uncharged because it never started before the batch start budget elapsed (:133-:136). Both gauges report what one lane instance last observed. Because the meter name is the one the Aspire defaults already subscribe (InternalCommandMetrics.cs:9-:11), no new literal is needed to export them. The same type also declares two non-lane gauges the Revision (2026-09-11) did not list,internal_commands.pending.depth(:92-:96) andinternal_commands.oldest_due.age, taggeddata_source(:104-:108).
Revision (2026-11-23)
Re-verified against current source. The telemetry baseline, the CQRS and outbox instruments, the
three metrics knobs and their drop views, sampling, poll-span filtering and the exporters behave as
the Decision describes. What moved is the meter count (one new framework meter), where the hosts
make their Serilog call, ADC's auth-failure alert rule, and most Extensions.Telemetry.cs,
Extensions.cs, CQRS decorator, OutboxProcessor.cs and bicep anchors in the live sections.
- The meter chain carries twelve subscriptions: eleven
MMCA.Common.*plusPolly. The new one isMMCA.Common.Auth(MMCA.Common/Source/Hosting/MMCA.Common.Aspire/Extensions.Telemetry.cs:316, the chain at:307-:317, Polly at:324, its const at:30), owned byAuthSignInMetrics(MMCA.Common/Source/Core/MMCA.Common.Application/Auth/AuthenticationServiceBase.cs:1096, meter name:1099, meter:1122) with one counter,mmca.auth.signin(:1125-:1128), counted once per password sign-in attempt and tagged only by a low-cardinalityoutcome(:1090-:1094,:157). Its name is duplicated as a literal in the Aspire package like the other framework meters (sync note:1092-:1093), so the Trade-offs maintenance cost now spans twelve literals; the Trade-offs bullet is corrected in place and its sync-note list now includes this one. The eleven-subscription count of the Status entry and Revision of 2026-10-26 is left as written and superseded by this item. - Hosts reach the Serilog pipeline through a composed host call. No
Program.csin MMCA.ADC or MMCA.Store callsAddCommonSerilogorCreateBootstrapLoggerFactoryitself any more. The seven service hosts (ADC Conference, Engagement, Identity and Notification; Store Catalog, Identity and Sales) callAddMmcaServiceHost(MMCA.Common/Source/Hosting/MMCA.Common.ServiceHost/ServiceHostBuilderExtensions.cs:63; for exampleMMCA.Store/Source/Services/MMCA.Store.Catalog.Service/Program.cs:32,MMCA.ADC/Source/Services/MMCA.ADC.Conference.Service/Program.cs:82), which callsAddCommonSerilogat:82ahead ofAddServiceDefaultsat:83and creates the bootstrap logger factory at:99. The factory rides on the returned host and is disposed onApplicationStoppedbyUseMmcaServiceHostAsync(MMCA.Common/Source/Hosting/MMCA.Common.ServiceHost/ServiceHostApplicationExtensions.cs:43,:68; called at Store CatalogProgram.cs:118and ADC ConferenceProgram.cs:375). The two Blazor hosts callAddMmcaBlazorWebHost(MMCA.Common/Source/Presentation/MMCA.Common.UI.Web/Hosting/BlazorWebHostExtensions.cs:75;MMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI.Web/Program.cs:26,MMCA.Store/Source/Hosts/UI/MMCA.Store.UI.Web/Program.cs:30), which makes the same two calls in the same order (:84-:85). The nine hosts, the call order and the policy the Amended (2026-08-31) section records are unchanged; its per-hostProgram.csanchors, and those the Revision (2026-10-28) lists, are left as written and superseded by this item. So are the Revision (2026-10-06) statement that every service host declares the factory as a top-levelusing vardisposed only afterawait app.RunAsync(), and that revision's per-host Serilog and bootstrap-factory anchors. The two Gateways still make no Serilog call (AddServiceDefaultsatMMCA.ADC/Source/Hosts/MMCA.ADC.Gateway/Program.cs:77andMMCA.Store/Source/Hosts/MMCA.Store.Gateway/Program.cs:69). - ADC's auth-failure alert no longer matches Store's. ADC's
authFailureSpikeAlert(MMCA.ADC/infra/main.bicep:868, severity 2:875) adds the failed password sign-ins from themmca.auth.signincounter (outcomeinvalid_credentialsorlocked_out) to half theItemCount-weighted sum of the other 401 or 429 responses on the/Authroutes, with/Auth/loginexcluded (query:884, rationale:841-:867), and fires above 25 per 15 minutes (:888). Store's rule still counts 401 or 429 rows on/Authabove 50 (MMCA.Store/infra/main.bicep:666, query:682-:685). ADC'sforbiddenBurstAlertnow sumsItemCountso it is sampling-aware (MMCA.ADC/infra/main.bicep:909, query:925, reasoning:906-:908), while Store's still counts rows (MMCA.Store/infra/main.bicep:706, query:722-:723); both keep threshold 20 (ADC:929, Store:725) at severity 3 (ADC:916, Store:713). The "same auth-failure rule as Store" statement in the Revision (2026-10-28) is left as written and superseded by this item. - Anchors re-verified against current source:
AddServiceDefaultsdeclared atMMCA.Common/Source/Hosting/MMCA.Common.Aspire/Extensions.cs:35, callingConfigureOpenTelemetryat:37; inExtensions.Telemetry.cs, the Outbox meter:307, the Cqrs meter:308, Polly:324,ConfigureAspNetCoreMetrics:354(knob:356,View:361-:364, add:368); inLoggingCommandDecorator.cs,Record:99in theRecordDurationhelper:98, outcomescompleted:55,failed:50,exception:77, the correlation id read:27and theBeginCommandScopescope:33; inOutboxProcessor.cs,PollActivityName:78, the activity source:104,CountPendingAsync:273(span:285),FetchCandidatesAsync:305(span:311), the lease-lost skip:547-:551, theStartOutboxActivitycall:553, theretries_exhaustedguard:681and increment:686-:689,HandleUnresolvableType:1074(first-attempt retry:1080-:1087, increment:1094-:1097),StartOutboxActivitydeclared:1136(null return:1138-:1141, parent context:1143-:1146, span start:1148-:1151);UseAzureMonitoratMMCA.Common/Source/Hosting/MMCA.Common.Azure.Startup/AzureMonitorExporterExtensions.cs:65; inMMCA.ADC/infra/main.bicep, the sampling comment:305-:308, the 0.25 setting:310-:311, the 65% comment:335-:341, the 73% comment:351-:354, theDisableAspNetCoreMetricssetting:356-:357and the 63% comment:370-:373; inMMCA.Store/infra/main.bicep, the sampling comment:250-:253, theDisableAspNetCoreMetricssetting:301-:302and the 67% comment:315-:318. These held:LoggingQueryDecorator.cs:46,:51,:69,:91-:92,CqrsMetrics.cs:24,:30,:36, and inExtensions.Telemetry.cs:70,:74-:75,:83-:85,:105-:108,:112-:113,:123,:139-:140,:147,:163,:181,:184,:204,:250,:271,:278,:290. The anchors the dated sections keep are left as recorded.
Revision (2026-12-03)
MMCA.Common v1.331.0. Instrumentation, meters, the metrics knobs, poll-span filtering and the exporters are unchanged. Two points are corrected in the Decision.
- The sample ratio reaches Azure Monitor. The distro's own sampler replaces the
ParentBasedSamplerthatAddServiceDefaultssets, soAddAzureMonitorExporter()now passes a configuredTelemetry:TracesSampleRatioto it asSamplingRatioand clearsTracesPerSecond(MMCA.Common/Source/Hosting/MMCA.Common.Azure.Startup/AzureMonitorExporterExtensions.cs:75-:81), reusing the sameTryGetTraceSampleRatioparser (Extensions.Telemetry.cs:229). A deployment that setsTelemetry__TracesSampleRatiotherefore samples at that fixed percentage; without the key the distro's rate-limited default applies (:83-:86). - One exported list of framework trace sources.
FrameworkActivitySourceNames(Extensions.Telemetry.cs:87-:93, subscribed at:132-:133) andFrameworkActivitySourceExportTestskeep the subscribed sources and the Common-created sources equal.