Repository navigation
Multitenant logs support - #62885
Multitenant logs support#62885
Conversation
Extend the trace multi-tenant routing mechanism to AzureMonitorLogExporter /
LogRecord: route logs to the correct ingestion endpoint based on the
microsoft.instrumentation_key / microsoft.ingestion_endpoint attributes,
reusing the existing signal-agnostic transmitter/storage/redirect plumbing.
Off by default behind the same EnableMultiTenantExport switch.
- TenantRouting: add raw-string TryGetRoute overload sharing validation.
- LogsHelper: add TryGetLogRoute, BuildLogTelemetryItem, and
OtelToAzureMonitorLogsMultiTenant; consume routing tags via
recognizeRoutingTags in ProcessLogRecordProperties/ExtractAvailabilityInfo.
- AzureMonitorLogExporter: multi-tenant gate + pooled EndpointRouteBatch export.
- Generalize event 61 message ("Telemetry is routed") and add CHANGELOG entry.
- Tests: MultiTenantLogRoutingTests (routing, parity, availability ordering,
exporter gate, trace-based filtering, persist-on-shutdown Track path).
- Demo: MultiTenantLogDemo wired into Program.cs via "multitenant logs".
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: dacfc0c4-4e41-460d-a866-cffed26f9bff
Reword the "no routing attributes" comments to explain the mechanism (routing attributes are stamped upstream only on records meant to be routed) instead of asserting a deployment-specific assumption about how many tenants enable observability. Comment-only; no behavior change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: dacfc0c4-4e41-460d-a866-cffed26f9bff
GenerateLogs now cycles through the four shapes the log exporter can produce - trace (MessageData), exception (ExceptionData), custom event (EventData), and availability (AvailabilityData) - by attaching the classifying microsoft.* attributes through a list-valued log state. Enable IncludeFormattedMessage so event/availability bodies survive. Verified end to end: routed, persisted envelopes carry ExceptionData, EventData, MessageData, and AvailabilityData under the tenant iKeys. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: dacfc0c4-4e41-460d-a866-cffed26f9bff
|
Azure Pipelines: Successfully started running 1 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟡 Changes recommended
Failed log conversion can leave and transmit an empty endpoint group, and the changelog structure needs restoration.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds opt-in multi-tenant routing for logs alongside existing trace routing.
Changes:
- Routes log telemetry by instrumentation key and endpoint attributes.
- Adds exporter, sampling, shutdown, and conversion tests.
- Adds a multi-tenant logging demo and diagnostics.
File summaries
| File | Description |
|---|---|
MultiTenantLogRoutingTests.cs |
Tests log routing and exporter behavior. |
MultiTenantTraceDemo.cs |
Shares HTTP policies with the log demo. |
Program.cs |
Adds log demo selection and execution. |
MultiTenantLogDemo.cs |
Generates routed multi-tenant logs. |
TenantRouting.cs |
Shares route validation across signals. |
LogsHelper.cs |
Converts and groups routed logs. |
AzureMonitorExporterEventSource.cs |
Generalizes the enablement diagnostic. |
AzureMonitorLogExporter.cs |
Adds opt-in multi-tenant export. |
CHANGELOG.md |
Documents multi-tenant log support. |
Review details
- Files reviewed: 9/9 changed files
- Comments generated: 3
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
PR #62707 (multi-tenant trace export) merged 2026-09-09, after the 1.9.0 exporter release dated 2026-09-04, so its changelog entry was misplaced under the already-released 1.9.0 section. Move it up to the unreleased 1.10.0-beta.1 Features Added section alongside the logs entry. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: dacfc0c4-4e41-460d-a866-cffed26f9bff
| [NotNullWhen(true)] out string? instrumentationKey, | ||
| [NotNullWhen(true)] out string? ingestionEndpoint) | ||
| { | ||
| ingestionEndpoint = null; |
There was a problem hiding this comment.
I know this comment is coming in post merge, still wanted to post it here for consideration.
Do we need to add any debugging/logging here so we can troubleshoot why data is not flowing to a destination. I'm sure we are going to be asked why data isn't flowing and w/o a clear way to identify misconfiguration, we will be in trouble.
Bare minimum implentation for multitenant logs support
Not in scope:
AAD
Live Metrics
appending the ikey/endpoint attrs via log scopes
No changes made to sampling code for trace based logs sampling, but there are tests that verify sampling behavior