Get Started for Telemetry
RepoDB ships with opt-in, drop-in telemetry via RepoDb.Telemetry.Default, built on top of RepoDb.Telemetry.Core. It wires up a default ITrace that captures every operation (Insert, Query, Update, Delete, etc.) and publishes it to an insights collector — no custom ITrace implementation required. See the Telemetry feature page for the full picture.
Installation
Install the library via NuGet using the Package Manager Console.
> Install-Package RepoDb.Telemetry.Default
Enable Telemetry
Call the globalized setup method once at application startup.
GlobalConfiguration
.Setup(new GlobalConfigurationOptions { UseRegisteredGlobalTraces = true })
.UseDefaultTelemetry(
host: "https://your-collector-host",
apiKey: "YOUR_API_KEY",
applicationName: "MyApp",
groupName: "Default");
That’s it — every operation across every connection in the application is now traced automatically.
UseRegisteredGlobalTraces = trueis required. It tells the library to run every globally registered tracer (this one included) for every operation, without passing atraceargument to each call.
Configuration
For more control, pass a DefaultTelemetryOption instead of individual arguments.
GlobalConfiguration
.Setup(new GlobalConfigurationOptions { UseRegisteredGlobalTraces = true })
.UseDefaultTelemetry(
new DefaultTelemetryOption("MyApp")
{
Host = "https://your-collector-host",
ApiKey = "YOUR_API_KEY",
Group = "Default",
Frequency = TimeSpan.FromSeconds(10)
},
errorCallback: ex => logger.LogError(ex, "Telemetry publish failed"),
logger: serilogLogger);
| Property | Description | Default |
|---|---|---|
| Application | Name of the application producing telemetry. | (required) |
| Group | Logical grouping for the dashboard. | "Default" |
| Host | Collector endpoint to publish to. | http://localhost:5000 |
| ApiKey | API key sent via X-API-Key. Leave empty if the collector does not require one. | null |
| Frequency | How often buffered telemetry is flushed. | 5 seconds |
Calling
UseDefaultTelemetry()more than once is safe — it reuses the same DefaultTelemetryTrace instance rather than starting a new one.
What Gets Captured
Every captured operation is represented as a DefaultTelemetryItem — application, group, session id, operation name, start time, statement, elapsed time, cancellation flag, client machine, source assembly, and version. See TelemetryItem for the full property list.
Items are buffered in memory and flushed on the configured Frequency, then JSON-serialized, gzip-compressed, and POSTed to your collector. Publish failures never throw — they are routed to the optional errorCallback and logger.
Next Steps
- Read the Telemetry feature page for how the pipeline fits together.
- Implement IPublisherRepository to publish somewhere other than the default HTTP collector.