RepoDb.Telemetry.Core 0.0.1-alpha2

Prefix Reserved
This is a prerelease version of RepoDb.Telemetry.Core.
dotnet add package RepoDb.Telemetry.Core --version 0.0.1-alpha2
                    
NuGet\Install-Package RepoDb.Telemetry.Core -Version 0.0.1-alpha2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RepoDb.Telemetry.Core" Version="0.0.1-alpha2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RepoDb.Telemetry.Core" Version="0.0.1-alpha2" />
                    
Directory.Packages.props
<PackageReference Include="RepoDb.Telemetry.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add RepoDb.Telemetry.Core --version 0.0.1-alpha2
                    
#r "nuget: RepoDb.Telemetry.Core, 0.0.1-alpha2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package RepoDb.Telemetry.Core@0.0.1-alpha2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=RepoDb.Telemetry.Core&version=0.0.1-alpha2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=RepoDb.Telemetry.Core&version=0.0.1-alpha2&prerelease
                    
Install as a Cake Tool

RepoDb.Telemetry.Core

Core building blocks for capturing operation-level telemetry (Insert, Query, Update, Delete, etc.) from RepoDB and publishing it to an insights collector.

This package is not meant to be used standalone by most users — it defines the contracts and reusable pieces that a telemetry implementation is built on. If you just want telemetry working out of the box, use RepoDb.Telemetry.Default instead. Use this package directly only if you want to customize how telemetry is published or captured.

Key Types

  • TelemetryOption — settings for a telemetry session: Application, Group, Host, ApiKey, and Frequency (how often buffered data is flushed).
  • TelemetryItem — the shape of a single captured telemetry record (operation name, statement, elapsed time, session id, client, source, etc.).
  • TelemetryTrace — an abstract ITrace implementation that hooks into RepoDB's before/after execution events, buffers them in memory, and flushes on a timer. It leaves GetPublisherRepository() for a subclass to implement, so it must be subclassed rather than instantiated directly.
  • IPublisherRepository — the contract for sending buffered TelemetryItems to a collector.
  • TelemetryPublisherRepository — an abstract IPublisherRepository; gzip-compresses and POSTs the payload to {host}/{GetRequestUri()}/publish, adding an X-API-Key header when an API key is provided. It leaves GetRequestUri() for a subclass to implement, so it must be subclassed rather than instantiated directly.

Getting Started

TelemetryTrace and TelemetryPublisherRepository are both abstract — they define the buffering/publishing machinery, but leave one method each for a subclass to fill in. If you just want telemetry working out of the box, use RepoDb.Telemetry.Default, which already provides concrete DefaultTelemetryTrace and DefaultTelemetryPublisherRepository implementations.

To implement your own, subclass both types:

public class MyTelemetryPublisherRepository : TelemetryPublisherRepository
{
    public MyTelemetryPublisherRepository(string host, string apiKey = null,
        Action<Exception> errorCallback = null, ILogger logger = null)
        : base(host, apiKey, errorCallback, logger)
    { }

    public override string GetRequestUri() => "v1/telemetry/my-app";
}

public class MyTelemetryTrace : TelemetryTrace
{
    public MyTelemetryTrace(TelemetryOption option,
        Action<Exception> errorCallback = null, ILogger logger = null)
        : base(option, errorCallback, logger)
    { }

    public override TelemetryPublisherRepository GetPublisherRepository()
        => new MyTelemetryPublisherRepository(Option.Host, Option.ApiKey, ErrorCallback, Logger);
}

Then create an option, start the trace, and attach it to RepoDB:

var option = new TelemetryOption("MyApp")
{
    Host = "https://your-collector-host",
    ApiKey = "YOUR_API_KEY",
    Group = "Default",
    Frequency = TimeSpan.FromSeconds(5)
};

var trace = new MyTelemetryTrace(option, errorCallback: ex => logger.LogError(ex, "Telemetry error"));
trace.Start();

Attach the trace to an individual call:

connection.QueryAll<Customer>(trace: trace);

Or register it so it applies to every operation across the app:

GlobalConfiguration
    .Setup(new GlobalConfigurationOptions { UseRegisteredGlobalTraces = true });

GlobalTraceRegistration.Register(trace);

Custom Publishing

To send telemetry somewhere other than an HTTP collector entirely (bypassing TelemetryPublisherRepository), implement IPublisherRepository directly and use it from your own ITrace implementation (following the same pattern as TelemetryTrace):

public class MyPublisherRepository : IPublisherRepository
{
    public void Publish(TelemetryItem telemetryItem) { /* send to your sink */ }
    public void PublishAsync(TelemetryItem telemetryItem, CancellationToken cancellationToken = default) { /* ... */ }
    public void PublishMany(IEnumerable<TelemetryItem> telemetryItems) { /* ... */ }
    public void PublishManyAsync(IEnumerable<TelemetryItem> telemetryItems, CancellationToken cancellationToken = default) { /* ... */ }
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on RepoDb.Telemetry.Core:

Package Downloads
RepoDb.Telemetry.Default

The default telemetry package for RepoDB library.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.1-alpha2 39 7/11/2026
0.0.1-alpha1 50 7/8/2026