|
5 | 5 | // ----------------------------------------------------------------------- |
6 | 6 |
|
7 | 7 | using System; |
| 8 | +using System.Collections.Generic; |
| 9 | +using System.Linq; |
8 | 10 | using System.Text; |
9 | 11 | using Akka.Configuration; |
10 | 12 | using Akka.Hosting; |
@@ -33,23 +35,26 @@ public AkkaPersistenceSnapshotBuilder(string snapshotStoreId, AkkaConfigurationB |
33 | 35 | /// <param name="unHealthyStatus">Default status to return when the plugin reports <see cref="PersistenceHealthStatus.Unhealthy"/> |
34 | 36 | /// or <see cref="PersistenceHealthStatus.Degraded"/>. Defaults to degraded.</param> |
35 | 37 | /// <param name="name">Optional name to add to the health check.</param> |
| 38 | + /// <param name="tags">Optional custom tags for the health check. If null, defaults to ["akka", "persistence", "snapshot-store"].</param> |
36 | 39 | /// <returns>The current builder instance for method chaining.</returns> |
37 | 40 | public AkkaPersistenceSnapshotBuilder WithHealthCheck(HealthStatus unHealthyStatus = HealthStatus.Degraded, |
38 | | - string? name = null) |
| 41 | + string? name = null, |
| 42 | + IEnumerable<string>? tags = null) |
39 | 43 | { |
40 | | - var registration = AddHealthCheck(name, unHealthyStatus); |
| 44 | + var registration = AddHealthCheck(name, unHealthyStatus, tags); |
41 | 45 | HealthCheckRegistration = registration; |
42 | 46 | return this; |
43 | 47 | } |
44 | 48 |
|
45 | | - private AkkaHealthCheckRegistration AddHealthCheck(string? name, HealthStatus unHealthyStatus) |
| 49 | + private AkkaHealthCheckRegistration AddHealthCheck(string? name, HealthStatus unHealthyStatus, IEnumerable<string>? tags = null) |
46 | 50 | { |
47 | 51 | var pluginId = $"akka.persistence.snapshot-store.{SnapshotStoreId}"; |
| 52 | + var healthCheckTags = tags?.ToList() ?? new List<string> { "akka", "persistence", "snapshot-store" }; |
48 | 53 | var registration = new AkkaHealthCheckRegistration( |
49 | 54 | name ?? $"Akka.Persistence.SnapshotStore.{SnapshotStoreId}", |
50 | 55 | new SnapshotStoreHealthCheck(pluginId), |
51 | 56 | unHealthyStatus, |
52 | | - ["akka", "persistence", "snapshot-store"]); |
| 57 | + healthCheckTags); |
53 | 58 | return registration; |
54 | 59 | } |
55 | 60 |
|
|
0 commit comments