Skip to content

Breaking change: update OpenTelemetry to 1.18.0 - #20042

Closed
Jose Perez Rodriguez (joperezr) wants to merge 1 commit into
mainfrom
joperezr-opentelemetry-1-18-migration
Closed

Jose Perez Rodriguez (joperezr) wants to merge 1 commit into
mainfrom
joperezr-opentelemetry-1-18-migration

Conversation

@joperezr

Copy link
Copy Markdown
Member

Description

Updates the coordinated OpenTelemetry package family from 1.17.0 to 1.18.0 and OpenTelemetry.Instrumentation.GrpcNetClient from 1.15.1-beta.1 to 1.18.0-beta.1. It also updates Azure.Monitor.OpenTelemetry.Exporter from 1.8.3 to 1.9.0 and the required Azure.Core dependency from 1.61.0 to 1.62.0.

This intentionally keeps the OpenTelemetry and Azure Monitor exporter versions coherent. Azure Monitor 1.9.0 requires OpenTelemetry.Extensions.Hosting 1.18.0 and changes shutdown handling used by the Aspire CLI.

Upstream release notes:

The ServiceDefaults templates derive their package versions from eng/Versions.props, so newly generated projects use OpenTelemetry 1.18.0. Existing customer projects keep the package versions written when they were generated and are not automatically changed by this PR. The non-CPM MAUI ServiceDefaults project also resolves its explicit OpenTelemetry version properties to 1.18.0.

Dependency blocker

OpenTelemetry.Instrumentation.GrpcNetClient 1.18.0-beta.1 is the only updated package not currently available from the approved internal feeds. The required dotnet-migrate-package import is paused because the preceding unrelated Testcontainers import run 3072323 failed the same intermediate quarantine that previously blocked the bUnit import. The quarantine has not been bypassed, and no follow-up import was queued.

Breaking changes

OpenTelemetry 1.18.0 reduces the default maximum serialized OTLP export request from 128 MiB to 64 MiB. If an entire serialized batch exceeds 64 MiB, the exporter does not send it and drops the whole batch. Users that intentionally rely on requests between 64 MiB and 128 MiB can preserve the previous limit:

using OpenTelemetry.Exporter;

builder.Services.Configure<OtlpExporterOptions>(options =>
{
    options.MaxRequestSizeBytes = 128 * 1024 * 1024;
});

builder.Services.AddOpenTelemetry()
    .UseOtlpExporter();

MaxRequestSizeBytes supports values up to 256 MiB. OpenTelemetry 1.18.0 also introduces a 4 MiB default maximum OTLP response size; an oversized response is discarded and treated as non-retryable. Server-provided retry delays are clamped to at least 100 ms, and certain non-transient HTTP failures are no longer retried.

Aspire does not override these limits. Newly generated ServiceDefaults projects and Aspire's own OTLP-exporting processes therefore use the new defaults. Existing generated customer projects remain on their current OpenTelemetry versions unless they update those package references.

Azure Monitor OpenTelemetry Exporter 1.9.0 changes provider shutdown and Dispose() so pending telemetry is first persisted to offline storage and then drained in the background during the available shutdown window. This directly affects the Aspire CLI, which configures Azure Monitor with a storage directory and disposes its provider at process exit. To restore the previous shutdown behavior, set:

AppContext.SetSwitch(
    "Azure.Monitor.OpenTelemetry.Exporter.DisablePersistOnShutdown",
    isEnabled: true);

Short-lived processes that want persistence without waiting for the background drain can set Azure.Monitor.OpenTelemetry.Exporter.ShutdownDrainBudgetMilliseconds to 0 with AppContext.SetData or a runtimeconfig.json config property. ForceFlush behavior is unchanged unless Azure.Monitor.OpenTelemetry.Exporter.PersistOnForceFlush is enabled.

Rollback is limited to restoring OpenTelemetry packages to 1.17.0, OpenTelemetry.Instrumentation.GrpcNetClient to 1.15.1-beta.1, Azure Monitor OpenTelemetry Exporter to 1.8.3, and Azure.Core to 1.61.0.

Validation:

  • Built the OpenTelemetry-consuming Aspire.Hosting project for net8.0, net9.0, and net10.0.
  • Built Aspire.Cli with Azure Monitor OpenTelemetry Exporter 1.9.0.
  • Built the template pack and verified generated ServiceDefaults package references resolve to OpenTelemetry 1.18.0.
  • Verified the MAUI ServiceDefaults explicit package references evaluate to OpenTelemetry 1.18.0.
  • Ran the targeted CLI Azure Monitor and OTLP provider tests.
  • Full repository restore remains blocked until OpenTelemetry.Instrumentation.GrpcNetClient 1.18.0-beta.1 can be imported through the approved pipeline.

Fixes # (issue)

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No

Coordinate Azure Monitor OpenTelemetry Exporter 1.9.0 and its Azure.Core dependency with the OpenTelemetry 1.18 package family.

Co-authored-by: Copilot App <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 20042

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 20042"

@github-actions github-actions Bot added the area-integrations Issues pertaining to Aspire Integrations packages label Sep 10, 2026
@aspire-repo-bot
aspire-repo-bot Bot requested a balanced review from Copilot September 10, 2026 19:07
@joperezr Jose Perez Rodriguez (joperezr) added the breaking-change Issue or PR that represents a breaking API or functional change over a prerelease. label Sep 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Tests selector

Selects the full PR test matrix + all PR-gated jobs (ALL) — a rule matching 'Directory.Packages.props' selects ALL

Advisory workflow impact (4)

  • Aspire.Deployment.EndToEnd.Tests (deployment workflow-only)
  • Aspire.EndToEnd.Tests (outerloop-only)
  • Aspire.Oracle.EntityFrameworkCore.Tests (outerloop-only)
  • deployment-e2e (schedule/dispatch-only)

Selection computed for commit 383aa7f.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

GrpcNetClient 1.18.0-beta.1 must be imported into the approved internal feeds before repository restore can succeed.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 1 High severity

New issues introduced by this change (1)
Severity Finding
High severity Directory.Packages.props — Import the GrpcNetClient package before merging
What changed in this PR

Updates Aspire’s coordinated OpenTelemetry dependency family and Azure Monitor exporter.

Changes:

  • Upgrades OpenTelemetry packages to 1.18.0.
  • Updates Azure Monitor exporter to 1.9.0 and Azure.Core to 1.62.0.
File Description
eng/​Versions.props Updates shared telemetry version properties.
Directory.Packages.props Updates centrally managed package versions.

Comment thread Directory.Packages.props
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="$(OpenTelemetryInstrumentationExtensionsHostingVersion)" />
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="$(OpenTelemetryInstrumentationAspNetCoreVersion)" />
<PackageVersion Include="OpenTelemetry.Instrumentation.GrpcNetClient" Version="1.15.1-beta.1" />
<PackageVersion Include="OpenTelemetry.Instrumentation.GrpcNetClient" Version="1.18.0-beta.1" />
@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@danroth27

Copy link
Copy Markdown
Member

Jose Perez Rodriguez (@joperezr) OTel 1.19 is now out.

James Newton-King (JamesNK) pushed a commit that referenced this pull request Sep 23, 2026
## Summary

- update the Blazor hosted and standalone playgrounds to OpenTelemetry
exporter/hosting 1.19.1 and HTTP instrumentation 1.19.0
- remove the browser `BackgroundExportHandler` workaround and its
resilience dependency
- configure logging through `OpenTelemetryBuilder.WithLogging`, matching
the OpenTelemetry 1.19 API

The package updates are scoped to the two playground solution graphs so
this change is independent of the broader repository-wide OpenTelemetry
update in #20042.

## Testing

- `dotnet build playground\BlazorHosted\BlazorHosted.slnx --no-restore`
- `dotnet build playground\BlazorStandalone\BlazorStandalone.slnx
--no-restore`
- `dotnet test --project
tests\Aspire.Playground.Tests\Aspire.Playground.Tests.csproj
--no-launch-profile -- --filter-method
"*.HostedBlazorWasm_ServesAppAndWeatherApi" --filter-method
"*.StandaloneBlazorWasm_GatewayServesAppAndWeatherApi"
--filter-not-trait "quarantined=true" --filter-not-trait
"outerloop=true" --hangdump --hangdump-timeout 10m`
- launched both AppHosts with `aspire start --isolated` and verified in
a real browser that the weather page rendered and traces, logs, and
metrics each exported through the OTLP proxy with HTTP 200

Copilot-Session: 1fb0cde9-afea-4acd-924d-2d5ebcb29be4
@IEvangelist

Copy link
Copy Markdown
Member

Superseded by #20387, which now includes the coordinated OpenTelemetry 1.18.0 family, GrpcNetClient 1.18.0-beta.1, and Azure Monitor Exporter 1.9.0. These are the newest releases meeting the requested seven-day age requirement. The approved GrpcNetClient import succeeded (https://dev.azure.com/dnceng/internal/_build/results?buildId=3085688), full solution restore succeeds, 104 focused CLI tests pass, and the final Windows Native AOT publish passes. Closing this draft to keep the upgrade in one PR.

@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 14.0 milestone Sep 23, 2026
James Newton-King (JamesNK) added a commit that referenced this pull request Sep 25, 2026
## Description

Preserves wildcard agent-hook coverage and all currently eligible Aspire
telemetry while removing shell startup and synchronous upload waits.

- Both hook and uploader modes run through `AgentTelemetryCommand` and
normal command dispatch. `InitializeTelemetryOnStartup` defaults to
true; the agent command defers provider creation and enrichment until an
eligible event exists. Existing first-run and generic invocation-span
rules are preserved.
- Skill names and reference paths come from the embedded bundle's
`skill-manifest.json`, read in memory with the existing manifest types
and source-generated serializer. The shipped inventory preserves all 7
skills and 33 references. MCP tool names still come from the embedded
canonical hook because the manifest does not contain a tool inventory.
- Hook environment-variable reads use injected `IEnvironment`; hook
tests run in-process without changing global environment state. A
documented setting bounds input before parsing.
- Eligible telemetry is persisted through Azure Monitor Exporter's
existing disk-backed storage. An independent CLI uploader keeps its
existing batching/retry machinery alive until the backlog drains.
- Legacy Aspire registrations migrate idempotently without removing
unrelated user hooks. The latest main merge preserves shell completions
and the v0.0.3 skills bundle.

Fixes #20329
Closes #20042

### Coordinated OpenTelemetry upgrade

The committed upgrade supersedes closed draft #20042 and consistently
uses the newest releases published at least seven days before September
23, 2026:

| Packages | Version | NuGet publication date (UTC) |
| --- | --- | --- |
| Console, InMemory, OTLP exporters; Extensions.Hosting | 1.18.0 |
August 21 |
| AspNetCore, Http, Runtime, SqlClient instrumentation | 1.18.0 | August
21 |
| GrpcNetClient instrumentation | 1.18.0-beta.1 | August 21 |
| Azure Monitor Exporter | 1.9.0 | September 5 |

The 1.19.x releases were too recent for that age requirement and are not
the target. The GrpcNetClient approved-feed import [succeeded in run
3085688](https://dev.azure.com/dnceng/internal/_build/results?buildId=3085688),
and full solution restore succeeded against configured feeds. No
quarantine was bypassed. Existing Blazor playground-specific overrides
from #20339 are unchanged. Seq's generated configuration schema was
refreshed for the added OTLP properties.

### Breaking changes

OpenTelemetry 1.18 reduces the default maximum serialized OTLP request
from 128 MiB to 64 MiB. Oversized batches are dropped. Consumers relying
on the previous limit can configure:

```csharp
builder.Services.Configure<OpenTelemetry.Exporter.OtlpExporterOptions>(options =>
{
    options.MaxRequestSizeBytes = 128 * 1024 * 1024;
});
```

The default maximum OTLP response size is 4 MiB. Generated
ServiceDefaults inherit updated versions; existing customer projects are
not rewritten. Ordinary CLI shutdown behavior is explicitly preserved
despite the Azure Monitor upgrade.

### User-facing usage

After installing the updated CLI, refresh agent configuration:

```shell
aspire agent init
```

Claude retains `matcher: "*"`; Copilot retains unfiltered `postToolUse`.
Both directly execute `aspire agent telemetry --hook` without
PowerShell/Bash. Compatibility scripts are taken unchanged from the
canonical bundle.

`ASPIRE_AGENT_TELEMETRY_MAX_PAYLOAD_CHARACTERS` configures the native
input bound: default 65,536 UTF-16 characters, range 1–1,048,576.
Oversized input is drained without retention; invalid values produce a
diagnostic without breaking the agent.

### Validation

- Review refactor: 370 tests passed, one Linux-only skip, covering
startup/completions, normal command routing, deferred
provider/enrichment initialization, opt-out, all three event categories,
and existing telemetry behavior.
- Manifest change: 137 focused tests passed, including archive/JSON
validation, canonical reporting-set parity, hook classification, and
skills bundle regressions.
- Final Windows x64 Native AOT publish passed after the manifest change.
- The real cross-process lease-expiry recovery test is now marked
`[OuterloopTest]`; fast persistence and uploader-lifecycle coverage
remains in regular CI. The real recovery scenario passed before this
scheduling-only change.
- Coordinated dependency upgrade: full solution restore,
Hosting/template builds, generated ServiceDefaults/MAUI version
verification, and 21 Seq tests across .NET 8/9/10 passed. Seq
stabilization packaging passed. Restore reported existing unrelated
vulnerability advisories.
- Real Copilot CLI 1.0.87-0, isolated COPILOT_HOME: `postToolUse` with
`exec`/`args` ran its recorder after a `view` call.
- Performance trade-off: normal command dispatch measured 145.4 ms
median and 210.7 ms p95 for unrelated native hooks over 25 local Windows
launches; the old PowerShell sample was approximately 337–460 ms. The
earlier pre-host shortcut measured 52.3 ms median but was removed in
response to review. These are direct-process samples, not a zero-cost
guarantee.
- Linux/macOS runtime performance was not tested locally.

### Security considerations

The hook processes bounded untrusted JSON and launches an independent
uploader. Catalog inputs come from embedded release-verified resources,
not mutable user-installed skills/scripts. Only manifest-listed
`references/` files are reference events; evals and scripts are
excluded. No new listener, ingestion endpoint, raw-payload storage, or
telemetry category is introduced. Direct argument vectors avoid shell
interpretation. Existing exporter storage and process-isolation helpers
are reused. Security review should cover classification parity,
configuration ownership, and detached-process lifetime.

Delivery remains subject to disk failures, exporter limits, retention,
and permanent ingestion errors. Interrupted uploads may stay leased for
several minutes; at-least-once delivery permits duplicates. Environment
opt-out applies at process launch, not retroactively to running
processes.

## Checklist

- Is this feature complete?
  - [x] Yes. Ready to ship.
  - [ ] No. Follow-up changes expected.
- Are you including unit tests for the changes and scenario tests if
relevant?
  - [x] Yes
  - [ ] No
- Did you add public API?
  - [ ] Yes
    - If yes, did you have an API Review for it?
      - [ ] Yes
      - [ ] No
- Did you add `<remarks />` and `<code />` elements on your triple slash
comments?
      - [ ] Yes
      - [ ] No
  - [x] No
- Does the change make any security assumptions or guarantees?
  - [x] Yes
    - If yes, have you done a threat model and had a security review?
      - [ ] Yes
      - [x] No
  - [ ] No

---------

Co-authored-by: David Pine <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: James Newton-King <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-integrations Issues pertaining to Aspire Integrations packages breaking-change Issue or PR that represents a breaking API or functional change over a prerelease.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants