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.
Hello,
This PR was inspired by a previous discussion on gitier about introducing OpenTelemetry in Marten project.
The PR has primarily divided the functionalities between two libraries: the core library (Marten), which is responsible for emitting diagnostics events during runtime to describe Marten internal infrastructure.
The second library (Marten.OpenTelemetry) is in charge of developing the OpenTelemetry instrumentation by subscribing to diagnostic events and creating activities (traces & spans) with tags and events.
The current scope of the PR covers Streams, to agree on the design for new proposed APIs and after that, it will cover the remaining components of Marten such as aggregates, projections, daemon, and so on.
Proposed APIS:
2.DiagnosticCategory : defines diagnostics categories that group some diagnostic events, such as Stream, Aggregate, and Project through declaring extension methods for IDiagnosticSource<DiagnosticCategory.[Type]>
So based on above design the DiagnosticSource of specific DiagnosticCategory (Stream) will write diagnostic events (StreamCreated, StreamAppended,..) to DiagnosticListeners that will be created by the Marten.OpenTelemetry library or even any other listeners for any use case, the diagnostic events will be created using extension methods that will extend this DiagnosticSource, these extension methods will be called inside the Marten infrastrcure code base such as , the EventStore.Stream class will used to invoke Stream DiagnosticSource extension methods
The library provides the blocks that build Marten OpenTelemetry instrumentation, that will be hooked to the OpenTelemetry SDK AddOpenTelemetryTracing method to instrument Marten diagnostic events in the shape of Activities/Traces to exporters