Observability
Observability is useful everywhere, but absolutely crucial for distributed systems where information is passed between components asynchronously and where multiple independent components might call each other or have other types of interactions.
Even when you have a single application, it's important to have a good observability strategy in place. It helps you to understand what's going on in your application, to detect and diagnose problems, and to monitor the performance of your application.
Event-sourced systems benefit from observability in a number of ways. For example, you can see how commands are processed, what events are added to streams, and how downstream applications like read-model projections or reactors consume those events.
Observability featuresā
Eventuous provides built-in metrics and traces for:
- Event store
- Subscriptions, consumers, and event handlers
- Command services
- Producers
The built-in diagnostics integrate with OpenTelemetry using OpenTelemetry .NET.
Enabling diagnosticsā
Diagnostic instrumentation is enabled by default. You can disable it by setting the EVENTUOUS_DISABLE_DIAGS
environment variable to any value except 1
. It is also possible to disable diagnostics at runtime by calling EventuousDiagnostics.Disable()
static function.
When diagnostics are enabled, registering different Eventuous elements will wrap them in diagnostic decorators. The decorators collect metrics and traces for the registered elements. For example, when registering an event reader using AddEventReader
extension, the provided event reader type will be used by TracedEventReader
decorator, which collects metrics and traces for the event reader.
Eventuous offers a number of features to help you with observability, click on the links below to learn more:
šļø Metrics
Metrics are collected using several Meter instances. There are two available meters:
šļø Distributed tracing
Eventuous uses .NET Activity API to trace operations for command services, persistence, subscriptions, and producers. When OpenTelemetry integration is enabled, the traces are exported to the configured exporter.
šļø Logging
Eventuous uses the ASP.NET Core logging with ILoggerFactory and ILogger, so you can use the standard logging facilities to log diagnostics. For internal logging, Eventuous uses multiple event sources, which you can collect and analyse with tools like dotnet-trace.
šļø OpenTelemetry integration
Eventuous uses OpenTelemetry .NET to collect and export metrics and traces. The integration requires Eventuous.Diagnostics.OpenTelemetry package to be installed. The package provides extensions for OpenTelemetry .NET hosting and configuration.