Skip to content

Add Tracing and PluginProvider options to [DurableExecution] - #2614

Draft
normj wants to merge 1 commit into
normj/durable-otel-packagefrom
normj/durable-otel-annotations
Draft

normj wants to merge 1 commit into
normj/durable-otel-packagefrom
normj/durable-otel-annotations

Conversation

@normj

@normj normj commented Nov 18, 2026

Copy link
Copy Markdown
Member

Stacked on #2612 (base is normj/durable-otel-package). Merge #2611 and #2612 first.

What

Two new options on [DurableExecution]:

  • Tracing = DurableTracing.Execution | Invocation adds the OpenTelemetry plugin from Amazon.Lambda.DurableExecution.OpenTelemetry.
  • PluginProvider = nameof(Method) names a static parameterless method on the same class returning IEnumerable<IDurableInstrumentationPluginFactory> (arrays and lists work).

If both are set they combine, with the OpenTelemetry plugin first. The generated handler calls both directly, with no reflection, so it stays trim and AOT friendly. Output is unchanged when neither option is set.

Notes

  • Tracing does not set X-Ray Tracing: Active in serverless.template. Lambda only supplies the trace header when that is on, so it is documented rather than forced.
  • New diagnostics: AWSLambda0146 (plugin API not available in the referenced SDK), 0147 (OTel package not referenced), 0148 (invalid PluginProvider).
  • Loading plugins from an environment variable or layer is not part of this change.

Tests

  • 25 new generator tests (DurableExecutionPluginTests) with three snapshots; the generated code is compiled against the real API shapes.
  • Mutating the generator (dropping the options argument, wrong ordering, skipped validation) fails the tests.
  • Full Annotations generator suite: 617 passed on net8.0 and net10.0.
  • TestDurableServerlessApp now uses both options against the real OTel package and builds.

Tracing = DurableTracing.Execution or Invocation adds the OpenTelemetry plugin
to the generated handler. PluginProvider names a static method on the same
class that returns IDurableInstrumentationPluginFactory instances. When both
are set the OpenTelemetry plugin runs first. The generated code calls both
directly (no reflection) and is unchanged when neither option is set.

New diagnostics AWSLambda0146 to 0148 cover a missing plugin API, a missing
OpenTelemetry package reference and an invalid PluginProvider.
@normj
normj force-pushed the normj/durable-otel-annotations branch from 7e82de8 to bc7e8d4 Compare November 20, 2026 01:25

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant