Skip to content

Commit ab0eab2

Browse files
committed
Add documentation for customizing health check tags
1 parent ec63b03 commit ab0eab2

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,32 @@ The health checks will automatically:
104104

105105
Health checks are tagged with `akka`, `persistence`, and either `journal` or `snapshot-store` for filtering purposes.
106106

107+
#### Customizing Health Check Tags
108+
109+
You can customize the tags applied to health checks by providing an `IEnumerable<string>` to the `WithHealthCheck()` method:
110+
111+
```csharp
112+
var host = new HostBuilder()
113+
.ConfigureServices((context, services) => {
114+
services.AddAkka("my-system-name", (builder, provider) =>
115+
{
116+
builder.WithSqlPersistence(
117+
connectionString: _myConnectionString,
118+
providerName: ProviderName.SqlServer2019,
119+
journalBuilder: j => j.WithHealthCheck(
120+
unHealthyStatus: HealthStatus.Degraded,
121+
name: "sql-journal",
122+
tags: new[] { "backend", "database", "sql" }),
123+
snapshotBuilder: s => s.WithHealthCheck(
124+
unHealthyStatus: HealthStatus.Degraded,
125+
name: "sql-snapshot",
126+
tags: new[] { "backend", "database", "sql" }));
127+
});
128+
});
129+
```
130+
131+
When tags are not specified, the default tags are used: `["akka", "persistence", "journal"]` for journals and `["akka", "persistence", "snapshot-store"]` for snapshot stores.
132+
107133
For ASP.NET Core applications, you can expose these health checks via an endpoint:
108134

109135
```csharp

0 commit comments

Comments
 (0)