Skip to content

Enhancement: Add tags parameter to AkkaPersistenceJournalBuilder.WithHealthCheck() and AkkaPersistenceSnapshotBuilder.WithHealthCheck() #680

@Aaronontheweb

Description

@Aaronontheweb

Summary

Add customizable tags parameter to existing health check methods to allow users to customize tags for both readiness and connectivity checks.

Motivation

Currently, tags are hardcoded in health check registrations:

  • Journal: ["akka", "persistence", "journal"]
  • Snapshot: ["akka", "persistence", "snapshot-store"]

Users cannot customize tags for operational tooling integration (e.g., filtering health checks by custom tags for specific monitoring strategies).

Proposed API

Current signature

public AkkaPersistenceJournalBuilder WithHealthCheck(
    HealthStatus unHealthyStatus = HealthStatus.Degraded,
    string? name = null)

New overload (backward compatible)

public AkkaPersistenceJournalBuilder WithHealthCheck(
    HealthStatus unHealthyStatus = HealthStatus.Degraded,
    string? name = null,
    IEnumerable<string>? tags = null)

Same for AkkaPersistenceSnapshotBuilder.WithHealthCheck()

Default Behavior

  • If tags is null, use existing defaults
  • Journal: ["akka", "persistence", "journal"]
  • Snapshot: ["akka", "persistence", "snapshot-store"]
  • User-provided tags override defaults entirely

Usage Example

builder.WithJournal(
    new SqlServerJournalOptions { ... },
    journal => journal
        .WithHealthCheck(
            unHealthyStatus: HealthStatus.Degraded,
            name: "app-journal",
            tags: new[] { "custom", "database", "readiness" }));

Implementation Notes

  • Add new overload method (don't modify existing signature)
  • Both overloads should delegate to common internal implementation
  • Update AkkaPersistenceHostingExtensions.cs private AddHealthCheck methods
  • No breaking changes
  • Backward compatible

Related

Needed to support both readiness and connectivity checks with custom tags

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions