Skip to main content
Table of Contents

Class StrataraHealthCheckExtensions

Namespace
Microsoft.Extensions.DependencyInjection
Assembly
Stratara.EventSourcing.EntityFrameworkCore.dll

Health-check registration extensions for the Stratara event-sourcing write store: outbox-backlog depth and event-store connectivity. Both are opt-in — a consumer adds them to its existing IHealthChecksBuilder so no health dependency is forced on hosts that do not want one.

public static class StrataraHealthCheckExtensions
Inheritance
StrataraHealthCheckExtensions
Inherited Members

Fields

EventStoreCheckName

Default registration name for the event-store connectivity check — eventstore.

public const string EventStoreCheckName = "eventstore"

Field Value

string

OutboxCheckName

Default registration name for the outbox-backlog check — outbox.

public const string OutboxCheckName = "outbox"

Field Value

string

ReadyTag

Default tag applied to Stratara readiness checks — ready. Distinguishes them from liveness (live) checks so a host can map them to a separate readiness endpoint.

public const string ReadyTag = "ready"

Field Value

string

Methods

AddEventStoreHealthCheck(IHealthChecksBuilder, string, HealthStatus?, IEnumerable<string>?)

Registers the Stratara.EventSourcing.EntityFrameworkCore.HealthChecks.EventStoreHealthCheck, verifying that the event-store (write-side) database is reachable. Requires the write store to be registered (the check resolves IWriteDbContext from DI).

public static IHealthChecksBuilder AddEventStoreHealthCheck(this IHealthChecksBuilder builder, string name = "eventstore", HealthStatus? failureStatus = null, IEnumerable<string>? tags = null)

Parameters

builder IHealthChecksBuilder

The health-checks builder to register on.

name string

The registration name. Defaults to EventStoreCheckName.

failureStatus HealthStatus?

The status reported when the check fails, or null to use the default (Unhealthy).

tags IEnumerable<string>

Tags applied to the registration, or null to apply ReadyTag.

Returns

IHealthChecksBuilder

The same IHealthChecksBuilder for chaining.

Examples

services.AddHealthChecks().AddEventStoreHealthCheck();

AddOutboxHealthCheck(IHealthChecksBuilder, int?, int?, string, HealthStatus?, IEnumerable<string>?)

Registers the Stratara.EventSourcing.EntityFrameworkCore.HealthChecks.OutboxBacklogHealthCheck, reporting the depth and age of the Stratara outbox backlog. Requires the write store to be registered (the check resolves IWriteDbContext from DI).

public static IHealthChecksBuilder AddOutboxHealthCheck(this IHealthChecksBuilder builder, int? degradedThreshold = null, int? unhealthyThreshold = null, string name = "outbox", HealthStatus? failureStatus = null, IEnumerable<string>? tags = null)

Parameters

builder IHealthChecksBuilder

The health-checks builder to register on.

degradedThreshold int?

Pending-entry count at or above which the check reports Degraded, or null to never degrade on backlog depth.

unhealthyThreshold int?

Pending-entry count at or above which the check reports Unhealthy, or null to never fail on backlog depth.

name string

The registration name. Defaults to OutboxCheckName.

failureStatus HealthStatus?

The status reported when the check fails, or null to use the default (Unhealthy).

tags IEnumerable<string>

Tags applied to the registration, or null to apply ReadyTag.

Returns

IHealthChecksBuilder

The same IHealthChecksBuilder for chaining.

Examples

Requires the write store, which is where the check reads the backlog from:

services.AddHealthChecks().AddOutboxHealthCheck(unhealthyThreshold: 10_000);