Skip to content

feat(otel): export OTLP traces#156

Merged
yordis merged 1 commit intomasterfrom
yordis/feat-otlp-tracing
May 3, 2026
Merged

feat(otel): export OTLP traces#156
yordis merged 1 commit intomasterfrom
yordis/feat-otlp-tracing

Conversation

@yordis
Copy link
Copy Markdown
Member

@yordis yordis commented May 3, 2026

  • EventStore needs all OpenTelemetry signals to leave the node through the same OTLP configuration surface.
  • Operators should not need a separate tracing setup model when logs and metrics already support shared and signal-specific OTLP destinations.
  • Baseline request tracing makes the observability path complete enough for collector-backed deployments to validate logs, metrics, and traces together.

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@cursor
Copy link
Copy Markdown

cursor Bot commented May 3, 2026

PR Summary

Medium Risk
Adds new OpenTelemetry tracing export and ASP.NET Core request instrumentation, which can affect runtime performance and telemetry routing if misconfigured.

Overview
Adds OTLP trace export alongside existing logs/metrics export, using the same shared + per-signal EventStore:OpenTelemetry:* configuration model.

Wires tracing into node startup via OpenTelemetry WithTracing, enabling ASP.NET Core request instrumentation and an OTLP exporter when Traces:Enabled (or Traces:Otlp settings) are present; includes new config helpers/tests and updates docs plus build/license metadata for the new OpenTelemetry.Instrumentation.AspNetCore dependency.

Reviewed by Cursor Bugbot for commit 401fc38. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 3, 2026

Walkthrough

This pull request adds OpenTelemetry traces support to EventStore's OTLP export infrastructure. Changes include: new trace configuration prefixes and enablement check; tracing setup in ClusterVNodeStartup with ASP.NET Core instrumentation; the OpenTelemetry.Instrumentation.AspNetCore NuGet dependency; comprehensive test coverage of OTLP traces configuration behavior; and updated documentation reflecting traces alongside existing metrics and logs exports.

Changes

OpenTelemetry Traces Support

Layer / File(s) Summary
Configuration Data Shape
src/EventStore.Core/Configuration/OpenTelemetryConfiguration.cs
Introduces OtlpTracesPrefix and OtlpTracesOtlpPrefix constants, and adds OtlpTracesEnabled() extension method to detect whether traces are enabled via configuration or per-signal OTLP section.
Dependency Declarations
src/Directory.Packages.props, src/EventStore.Core/EventStore.Core.csproj
Adds centrally managed NuGet package version for OpenTelemetry.Instrumentation.AspNetCore (1.15.2) and declares the package reference in the core project.
Core Tracing Setup
src/EventStore.Core/ClusterVNodeStartup.cs
Introduces ConfigureTracing helper method that configures the tracer provider with eventstore service resource, adds ASP.NET Core instrumentation, and conditionally binds OTLP exporter when traces are enabled.
License Configuration
qodana.yaml, src/qodana.yaml
Registers OpenTelemetry.Instrumentation.AspNetCore v1.15.2 with Apache-2.0 license in Qodana dependency overrides.
Tests & Documentation
src/EventStore.Core.XUnit.Tests/OpenTelemetry/OtlpTracingConfigurationTests.cs, docs/diagnostics/integrations.md
Adds five configuration tests covering disabled-by-default behavior, enablement via runtime switch, per-signal section override behavior, and endpoint/header/protocol parsing. Documentation updated to describe traces in OpenTelemetry exports, sample config, environment variables, and troubleshooting guidance.

Sequence Diagram

sequenceDiagram
    participant App as Application<br/>Startup
    participant Config as Configuration<br/>System
    participant OTLP as OpenTelemetry<br/>Builder
    participant Tracer as Tracer<br/>Provider
    participant Instr as ASP.NET Core<br/>Instrumentation
    participant Exporter as OTLP<br/>Exporter

    App->>Config: Read EventStore:OpenTelemetry:Traces config
    Config-->>App: Traces enabled + OTLP endpoint
    App->>OTLP: ConfigureTracing(builder, config)
    OTLP->>Tracer: Set service resource name = "eventstore"
    OTLP->>Instr: Add AspNetCore instrumentation
    OTLP->>Exporter: Configure OTLP exporter with endpoint
    Exporter-->>OTLP: Exporter ready
    Note over App,Exporter: At request time
    App->>Instr: HTTP request arrives
    Instr->>Tracer: Record span
    Tracer->>Exporter: Export spans
    Exporter-->>Exporter: Send to OTLP collector
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Hops with glee through telemetry trails,
Traces now dance where the story tells tales,
Config, instrumentation, OTLP takes flight,
AspNetCore whispers each span in the night—
Signals aligned! Metrics, logs, traces in sight!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(otel): export OTLP traces' accurately and clearly summarizes the main change - adding OTLP trace export functionality to the EventStore.
Description check ✅ Passed The description explains the motivation and goals for adding OTLP trace export, relating directly to the changeset which implements tracing support alongside existing metrics and logs.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch yordis/feat-otlp-tracing

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 401fc38. Configure here.

Comment thread docs/diagnostics/integrations.md
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/EventStore.Core/ClusterVNodeStartup.cs (1)

265-265: ⚡ Quick win

Extract the "eventstore" service-name literal into a shared constant.

The service name "eventstore" is used identically in both ConfigureMetrics (line 265) and ConfigureTracing (line 347). Extracting it prevents a future rename from silently diverging the two signal pipelines.

♻️ Proposed refactor
+   private const string ServiceName = "eventstore";

    private static void ConfigureMetrics(...)
    {
        meterOptions
-           .SetResourceBuilder(ResourceBuilder.CreateDefault().AddService("eventstore"))
+           .SetResourceBuilder(ResourceBuilder.CreateDefault().AddService(ServiceName))
            ...
    }

    private static void ConfigureTracing(...)
    {
-       tracerOptions.SetResourceBuilder(ResourceBuilder.CreateDefault().AddService("eventstore"));
+       tracerOptions.SetResourceBuilder(ResourceBuilder.CreateDefault().AddService(ServiceName));
        ...
    }

Also applies to: 347-347

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/EventStore.Core/ClusterVNodeStartup.cs` at line 265, Extract the literal
"eventstore" into a shared constant and use that constant in both metrics and
tracing setup to avoid divergence: define a const string (e.g., ServiceName or
EventStoreServiceName) and replace occurrences of
ResourceBuilder.CreateDefault().AddService("eventstore") and the matching call
in ConfigureTracing with ResourceBuilder.CreateDefault().AddService(ServiceName)
(or the chosen constant) so both ConfigureMetrics and ConfigureTracing reference
the same identifier.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/EventStore.Core/ClusterVNodeStartup.cs`:
- Line 265: Extract the literal "eventstore" into a shared constant and use that
constant in both metrics and tracing setup to avoid divergence: define a const
string (e.g., ServiceName or EventStoreServiceName) and replace occurrences of
ResourceBuilder.CreateDefault().AddService("eventstore") and the matching call
in ConfigureTracing with ResourceBuilder.CreateDefault().AddService(ServiceName)
(or the chosen constant) so both ConfigureMetrics and ConfigureTracing reference
the same identifier.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c961157c-126a-4a3d-a794-bccb94fc7f29

📥 Commits

Reviewing files that changed from the base of the PR and between 21a0e0c and 401fc38.

📒 Files selected for processing (8)
  • docs/diagnostics/integrations.md
  • qodana.yaml
  • src/Directory.Packages.props
  • src/EventStore.Core.XUnit.Tests/OpenTelemetry/OtlpTracingConfigurationTests.cs
  • src/EventStore.Core/ClusterVNodeStartup.cs
  • src/EventStore.Core/Configuration/OpenTelemetryConfiguration.cs
  • src/EventStore.Core/EventStore.Core.csproj
  • src/qodana.yaml

@yordis yordis merged commit 270f627 into master May 3, 2026
18 checks passed
@yordis yordis deleted the yordis/feat-otlp-tracing branch May 3, 2026 05:35
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