[Draft] OpenTelemetry out-of-process forwarder integration#9135
Draft
rajkumar-rangaraj wants to merge 11 commits intomainfrom
Draft
[Draft] OpenTelemetry out-of-process forwarder integration#9135rajkumar-rangaraj wants to merge 11 commits intomainfrom
rajkumar-rangaraj wants to merge 11 commits intomainfrom
Conversation
- Replace project reference with NuGet package reference - Rename OTEL_REPO_ROOT to ENABLE_OTEL; make OTel package conditional - Fix async void StopListening -> async Task StopListeningAsync - Add thread safety (lock) to EndpointListener start/stop - Add IAsyncDisposable to EndpointManager - Fix exception handling in service retry loop - Improve process discovery log message (info instead of warn+stacktrace) - Add per-pipeline error handling with RunPipelineAsync wrapper - Promote pipeline lifecycle logs from Trace to Information level - Fix static processStartTimeUtc -> instance field in MetricsStore - Change visibility: public -> internal on ServiceCollectionExtensions - Bound maxMetricCount to 50k instead of int.MaxValue - Fix documentation to match actual JSON config format - Fix test-otel-config.json (Batch -> PeriodicExporting for metrics) - Remove stale project refs from generate-dev-sln.ps1 - Perf: Cache InstrumentationScope objects in log/trace loggers - Perf: Reuse attribute list in MetricProducer.ParseAttributes - Perf: Reuse DiagnosticsClient per listener
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a draft PR containing the full OTel forwarder integration. It will be split into smaller PRs for review. Posting as a draft to give reviewers an overview of the complete feature.
What this does
Integrates
OpenTelemetry.OutOfProcess.Forwarder.Configurationpackage into dotnet-monitor to forward logs, metrics, and traces from target .NET applications via OTLP — without requiring any changes to the target app.Planned PR breakdown
ENABLE_OTELconditional compilation, package reference,generate-dev-sln.ps1updatedotnet-monitor.csproj,Directory.Packages.props,generate-dev-sln.ps1SnapshotMetricsoverload,MetricsSnapshottypes, instanceprocessStartTimeUtcIMetricsStore.cs,MetricsStore.csOpenTelemetryService,EndpointManager,EndpointListener,EndpointInfoSourceCallbacks, DI registrationOpenTelemetryService.cs,OpenTelemetryEndpointManager.cs,OpenTelemetryEndpointListener.cs,OpenTelemetryEndpointInfoSourceCallbacks.cs,OpenTelemetryServiceCollectionExtensions.cs,CollectCommandHandler.csOpenTelemetryLogRecordLogger,OpenTelemetryCountersLogger+MetricProducer,OpenTelemetryActivityLoggerOpenTelemetryLogRecordLogger.cs,OpenTelemetryCountersLogger.cs,OpenTelemetryMetricProducer.cs,OpenTelemetryMetricProducerFactory.cs,OpenTelemetryActivityLogger.csopentelemetry-configuration.md, config README updateopentelemetry-configuration.md,README.mdtest-otel-config.jsonFiles changed (18 files, +2055 / -31)
Directory.Packages.propsOpenTelemetry.OutOfProcess.Forwarder.Configurationpackage versiondocumentation/configuration/README.mddocumentation/configuration/opentelemetry-configuration.mdgenerate-dev-sln.ps1$OtelRepoRootparam, addedENABLE_OTELsrc/.../Metrics/IMetricsStore.csMetricsSnapshot,MetricsSnapshotMeter,MetricsSnapshotInstrumenttypessrc/.../Metrics/MetricsStore.csSnapshotMetrics(out MetricsSnapshot)overload, instanceprocessStartTimeUtcsrc/.../Commands/CollectCommandHandler.csservices.AddOpenTelemetry()under#if BUILDING_OTELsrc/.../Extensions/OpenTelemetryServiceCollectionExtensions.csinternal)src/.../Logging/OpenTelemetryLogRecordLogger.cssrc/.../Metrics/OpenTelemetryCountersLogger.cssrc/.../Metrics/OpenTelemetryMetricProducer.csMetricProducerfor OTel SDKsrc/.../Metrics/OpenTelemetryMetricProducerFactory.cssrc/.../OpenTelemetryEndpointInfoSourceCallbacks.cssrc/.../OpenTelemetryEndpointListener.cssrc/.../OpenTelemetryEndpointManager.csIAsyncDisposablesrc/.../OpenTelemetryService.csBackgroundServicefor process discoverysrc/.../Tracing/OpenTelemetryActivityLogger.cssrc/.../dotnet-monitor.csprojBUILDING_OTELdefinetest-otel-config.jsonTesting
Verified end-to-end with a sample ASP.NET app (
WebApplication2):http://localhost:4318/v1/metricshttp://localhost:4318/v1/logshttp://localhost:4318/v1/tracesDefaultProcessfilter