You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add OpenTelemetry support for tracing and metrics (#77)
* feat: add OpenTelemetry support for tracing and metrics in Ratatosk framework
* feat: add ConnectorMeter utility for consistent meter naming in telemetry
* feat: enhance telemetry metrics with message count and improve activity scope management
* feat: enhance telemetry with additional messaging attributes and improve activity tracking
* feat: enhance telemetry metrics for message sending, receiving, and status queries
* feat: introduce request classes for messaging operations and enhance telemetry context handling
|`Ratatosk.Senders.InMemory`| In-memory `IRepository<Sender>` for development and testing. |[](https://www.nuget.org/packages/Ratatosk.Senders.InMemory/)|
59
59
|`Ratatosk.Senders.EntityFramework`| EF Core persistence for the sender identity registry (`SenderDbContext`, `EntitySenderRepository`, `DbSender`). |[](https://www.nuget.org/packages/Ratatosk.Senders.EntityFramework/)|
60
+
|`Ratatosk.Extensions.OpenTelemetry`| Convenience extensions for wiring Ratatosk telemetry sources into OpenTelemetry SDK. |[](https://www.nuget.org/packages/Ratatosk.Extensions.OpenTelemetry/)|
60
61
61
62
## Quick example
62
63
@@ -144,7 +145,7 @@ Locks the public API and ships stable package releases with production-ready gua
144
145
Adds retry/circuit-breaker policies, OpenTelemetry signals, health checks, and timeout controls.
145
146
146
147
-[x]**Retry policies** — Polly-based retry and circuit-breaker integrated at the connector base level.
147
-
-[]**OpenTelemetry tracing & metrics** — ActivitySources, Meters, and histograms per connector.
148
+
-[x]**OpenTelemetry tracing & metrics** — ActivitySources, Meters, and histograms per connector.
148
149
-[ ]**Health checks** — ASP.NET Core `IHealthCheck` implementations auto-registered per connector.
149
150
-[ ]**Connector-level timeout configuration** — Per-operation timeout via the DI registration API.
Copy file name to clipboardExpand all lines: ROADMAP.md
+11-8Lines changed: 11 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,9 @@
2
2
3
3
This document describes the planned evolution of the **Ratatosk Framework** — a .NET library that provides a unified, provider-agnostic model for sending and receiving messages across multiple channels and connectors. Each milestone below includes a summary of its intent, detailed descriptions of every planned feature, and the rationale behind each decision.
@@ -272,6 +272,8 @@ A generic sender identity system that decouples message composition from sender
272
272
273
273
A messaging connector that fails silently, cannot be monitored, or brings down dependent services on provider outages is not production-ready. This milestone adds the operational layer that connectors need to be trusted in production: structured retry and circuit-breaker policies, distributed tracing and metrics via OpenTelemetry, health check endpoints, and consistent structured logging across all connectors.
274
274
275
+
Retry policies and OpenTelemetry tracing & metrics are complete in this release. Health checks and timeout configuration remain in progress.
276
+
275
277
---
276
278
277
279
### Retry Policies
@@ -294,23 +296,24 @@ Polly-based retry and circuit-breaker policies integrated at the connector base
294
296
295
297
---
296
298
297
-
### OpenTelemetry Tracing & Metrics
299
+
### OpenTelemetry Tracing & Metrics ✓
298
300
299
301
> *"You cannot improve what you cannot observe."*
300
302
301
-
#### The Problem Today
303
+
#### The Problem (Before)
302
304
303
-
There is no built-in telemetry in the connector layer. Developers who want to trace message send latency, track delivery rates, or count failures must instrument their own wrapper code on top of the connectors.
305
+
There was no built-in telemetry in the connector layer. Developers who wanted to trace message send latency, track delivery rates, or count failures had to instrument their own wrapper code on top of the connectors.
304
306
305
-
#### What We Are Building
307
+
#### What We Built
306
308
307
-
Activity sources and metric instruments built into the connector base: an `ActivitySource` per connector for distributed tracing (spans for send, receive, status query), and `Meter` instruments for counters (messages sent, received, failed) and histograms (send latency, payload size). All telemetry follows OpenTelemetry semantic conventions and is automatically exported via the application's configured OTLP pipeline.
309
+
Activity sources and metric instruments built into the connector base: an `ActivitySource` per connector for distributed tracing (spans for send, receive, status query), and `Meter` instruments for counters (messages sent, received, failed) and histograms (send latency, payload size). All telemetry follows OpenTelemetry semantic conventions and is automatically exported via the application's configured OTLP pipeline. A dedicated `Ratatosk.Extensions.OpenTelemetry` package provides convenience extensions (`WithOpenTelemetry()` on `MessagingBuilder`, `AddRatatoskInstrumentation()` on `TracerProviderBuilder`/`MeterProviderBuilder`). Telemetry options (`EnableTracing`, `EnableMetrics`, `EnablePayloadSizeMetrics`) are configurable per connector through connection settings or the builder API, following the same pattern as retry policies.
308
310
309
311
#### Benefits
310
312
311
313
- End-to-end distributed traces include connector-level spans out of the box
312
314
- Dashboards and alerts can be built on connector metrics without custom instrumentation
313
315
- Fully compatible with any OpenTelemetry-compliant backend (Jaeger, Prometheus, Azure Monitor, etc.)
316
+
- Payload size metrics are opt-in (disabled by default) to avoid serialisation overhead in high-throughput scenarios
|`Ratatosk.Senders.InMemory`| In-memory sender repository for development and testing, with optional seed data. |[](https://nuget.org/packages/Ratatosk.Senders.InMemory)|
72
72
|`Ratatosk.Senders.EntityFramework`| EF Core persistence for the sender identity registry (`SenderDbContext`, `EntitySenderRepository`, `DbSender`). |[](https://nuget.org/packages/Ratatosk.Senders.EntityFramework)|
73
+
|`Ratatosk.Extensions.OpenTelemetry`| Convenience extensions for wiring Ratatosk telemetry sources into OpenTelemetry SDK (`WithOpenTelemetry()` on `MessagingBuilder`, `AddRatatoskInstrumentation()` on `TracerProviderBuilder`/`MeterProviderBuilder`). |[](https://nuget.org/packages/Ratatosk.Extensions.OpenTelemetry)|
73
74
74
75
## Reading path
75
76
@@ -96,6 +97,7 @@ The framework is deliberately focused on the messaging contract and connector co
Copy file name to clipboardExpand all lines: docs/advanced.md
+3-33Lines changed: 3 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -145,41 +145,11 @@ Logger.LogInformation("Sending to {Receiver}", message.Receiver?.Address);
145
145
// [Connector: Twilio/SMS] [Message: sms-123] Sending to +15550002222
146
146
```
147
147
148
-
### Metrics to track
148
+
### OpenTelemetry tracing & metrics
149
149
150
-
For production monitoring, track per-connector metrics:
150
+
Ratatosk emits `ActivitySource` and `Meter` instruments from every connector operation — spans for send, receive, status query, and initialization; counters for messages sent, received, and failed; histograms for latency and payload size. The `IMessagingClient` facade emits its own telemetry under `Ratatosk.Client`.
`Ratatosk` depends on `Ratatosk.Abstractions` and `Ratatosk.Connectors` (which bring in `Microsoft.Extensions.DependencyInjection.Abstractions` and `Microsoft.Extensions.Logging.Abstractions`). The `Abstractions` and `Connector.Abstractions` packages have no external dependencies beyond the .NET BCL.
0 commit comments