Skip to content

Add OTel for SQL, ESDB#494

Open
bartelink wants to merge 5 commits into
masterfrom
otel
Open

Add OTel for SQL, ESDB#494
bartelink wants to merge 5 commits into
masterfrom
otel

Conversation

@bartelink
Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings April 17, 2026 14:45
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds OpenTelemetry (Activity-based) instrumentation to additional store adapters (EventStoreDb, legacy EventStore, SqlStreamStore) and updates integration test infrastructure to assert store-operation classifications via captured Activities, with an ADR + changelog notes documenting the migration and breaking API change.

Changes:

  • Instrument store adapter operations by tagging Activity.Current and emitting store-operation Activities for test/OTel capture.
  • Update shared integration-test infrastructure to capture/assert store operations via ActivityListener (plus add an OTel→Serilog bridge helper and mapping tests).
  • Remove the legacy EventStore TCP connector’s Serilog-specific Logger API surface and adjust project/package validation configuration and references accordingly.

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/Equinox.SqlStreamStore.Postgres.Integration/Equinox.SqlStreamStore.Postgres.Integration.fsproj Links new shared OTel test helpers into Postgres SqlStreamStore integration tests.
tests/Equinox.SqlStreamStore.MySql.Integration/Equinox.SqlStreamStore.MySql.Integration.fsproj Links new shared OTel test helpers into MySql SqlStreamStore integration tests.
tests/Equinox.SqlStreamStore.MsSql.Integration/Equinox.SqlStreamStore.MsSql.Integration.fsproj Links new shared OTel test helpers into MsSql SqlStreamStore integration tests.
tests/Equinox.MessageDb.Integration/Equinox.MessageDb.Integration.fsproj Links new shared OTel test helpers into MessageDb integration tests.
tests/Equinox.EventStoreDb.Integration/StoreIntegration.fs Switches assertions to Activity-based capture and adds OTel↔Serilog mapping/bridge tests.
tests/Equinox.EventStoreDb.Integration/Infrastructure.fs Introduces Activity-based store operation capture (AsyncLocal-isolated) and updates test logging helpers.
tests/Equinox.EventStoreDb.Integration/Equinox.EventStoreDb.Integration.fsproj Links new shared OTel test helpers into EventStoreDb integration tests.
tests/Equinox.EventStore.Integration/Equinox.EventStore.Integration.fsproj Links new shared OTel test helpers into legacy EventStore integration tests.
src/Equinox.SqlStreamStore/SqlStreamStore.fs Adds Activity tagging + store-operation emission for write/read operations.
src/Equinox.SqlStreamStore/Equinox.SqlStreamStore.fsproj Links shared per-store Tracing.fs into SqlStreamStore.
src/Equinox.SqlStreamStore.Postgres/Equinox.SqlStreamStore.Postgres.fsproj Switches wrapper to unconditional ProjectReference; comments out baseline version.
src/Equinox.SqlStreamStore.MySql/Equinox.SqlStreamStore.MySql.fsproj Switches wrapper to unconditional ProjectReference; comments out baseline version.
src/Equinox.SqlStreamStore.MsSql/Equinox.SqlStreamStore.MsSql.fsproj Switches wrapper to unconditional ProjectReference; comments out baseline version.
src/Equinox.MessageDb/Tracing.fs Adds MessageDb ActivitySource + emitStoreOp.
src/Equinox.MessageDb/MessageDb.fs Emits store-operation Activities on write/read paths.
src/Equinox.EventStoreDb/Tracing.fs Adds shared store-specific tracing module (EventStoreDb/EventStore/SqlStreamStore) + emitStoreOp.
src/Equinox.EventStoreDb/EventStoreDb.fs Adds Activity tagging + store-operation emission for EventStoreDB operations.
src/Equinox.EventStoreDb/Equinox.EventStoreDb.fsproj Enables STORE_EVENTSTOREDB constant; includes Tracing.fs; comments out baseline.
src/Equinox.EventStore/EventStore.fs Adds Activity tagging + store-operation emission; removes Serilog-specific connector logger API.
src/Equinox.EventStore/Equinox.EventStore.fsproj Enables STORE_EVENTSTORE_LEGACY constant; links Tracing.fs; comments out baseline.
samples/Store/Integration/TestOutput.fs Makes log capture buffer thread-safe via locking.
samples/Store/Integration/OtelToSerilogBridge.fs Adds helper to translate completed Activities into Serilog log events.
samples/Store/Integration/ActivityCapture.fs Adds generic Activity capture helper for tests.
adr/0001-replace-serilog-with-opentelemetry-in-store-adapters.md Documents rationale/approach and breaking change details.
CHANGELOG.md Records new tracing support and breaking API removal.

Comment on lines +9 to +15
let listener = new ActivityListener(
ShouldListenTo = (fun source -> source.Name.StartsWith(sourceNamePrefix, StringComparison.Ordinal)),
Sample = (fun _ -> ActivitySamplingResult.AllDataAndRecorded),
ActivityStopped = (fun act -> captured.Add(act)))
do ActivitySource.AddActivityListener(listener)
member _.Clear() = captured.Clear()
member _.Activities = captured |> Seq.toList
.AddSource("Equinox")
.AddSource("Equinox.MessageDb")
.AddSource("StoreIntegration")
.AddSource("Npqsl")
@@ -70,7 +70,7 @@ open Equinox.EventStore
/// WARNING: Applies INSECURE overrides to match the docker-compose config. NEVER do this in staging or production.
let connectToLocalStore log =
Comment on lines +17 to +18
let tagStr name = match tag name with :? string as s -> s | _ -> null
let tagInt name = match tag name with :? int as i -> i | _ -> 0
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