Link Search Menu Expand Document

TelemetryPublisherRepository


The default IPublisherRepository implementation. JSON-serializes and gzip-compresses telemetry items, then POSTs them to {host}/v1/telemetry/publish, adding an X-API-Key header when an API key is provided.

Creating an Instance

var repository = new TelemetryPublisherRepository(
    host: "https://your-collector-host",
    apiKey: "YOUR_API_KEY",
    errorCallback: ex => logger.LogError(ex, "Publish failed"),
    logger: serilogLogger);

Methods

NameDescription
PublishPublishes a single TelemetryItem.
PublishManyPublishes multiple TelemetryItem objects in one batch.

The methods above have corresponding Async variants. Publish failures never throw — they are routed to the optional errorCallback and logger instead.

RepoDb.Telemetry.Default uses DefaultTelemetryPublisherRepository, a subclass of this class.