Skip to content

Add OpenTelemetry forwarder infrastructure#9136

Merged
wiktork merged 5 commits intomainfrom
rajrang/otel-infrastructure
Apr 20, 2026
Merged

Add OpenTelemetry forwarder infrastructure#9136
wiktork merged 5 commits intomainfrom
rajrang/otel-infrastructure

Conversation

@rajkumar-rangaraj
Copy link
Copy Markdown
Contributor

Summary

Adds the infrastructure for OpenTelemetry out-of-process forwarder integration. This is PR 1 of 6 see #9135 for the full feature overview.

Changes

  • Directory.Packages.props Added OpenTelemetry.OutOfProcess.Forwarder.Configuration 0.1.0-beta.1 package version
  • dotnet-monitor.csproj Conditional package reference and BUILDING_OTEL preprocessor define, both gated on ENABLE_OTEL MSBuild property
  • generate-dev-sln.ps1 Set ENABLE_OTEL=true for dev builds; fix missing newline at EOF

How it works

When ENABLE_OTEL is set (to any non-empty value), the build:

  1. Adds a PackageReference to OpenTelemetry.OutOfProcess.Forwarder.Configuration
  2. Defines the BUILDING_OTEL constant for conditional compilation

All subsequent OTel code will be guarded with #if BUILDING_OTEL, ensuring zero impact on the default build.

Testing

  • Build without ENABLE_OTEL: no change in behavior, package not referenced
  • Build with ENABLE_OTEL=true: package restored, BUILDING_OTEL defined

- Add OpenTelemetry.OutOfProcess.Forwarder.Configuration 0.1.0-beta.1 package version
- Add ENABLE_OTEL conditional compilation: when set, adds package reference and
  defines BUILDING_OTEL preprocessor symbol
- Set ENABLE_OTEL in generate-dev-sln.ps1 for dev builds
- Fix missing newline at end of generate-dev-sln.ps1
Comment thread src/Tools/dotnet-monitor/dotnet-monitor.csproj Outdated
Comment thread src/Tools/dotnet-monitor/dotnet-monitor.csproj
Address review feedback: remove ENABLE_OTEL gating so the package
is always referenced and BUILDING_OTEL is always defined, avoiding
the need for two separate builds.
@rajkumar-rangaraj rajkumar-rangaraj force-pushed the rajrang/otel-infrastructure branch from 9fe18aa to f52f7cd Compare April 3, 2026 23:04
@wiktork wiktork enabled auto-merge (squash) April 20, 2026 21:40
@wiktork wiktork merged commit 0eb6e5d into main Apr 20, 2026
21 checks passed
@wiktork wiktork deleted the rajrang/otel-infrastructure branch April 20, 2026 23:16
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.

2 participants