Skip to content

Conversation

@Aaronontheweb
Copy link
Member

@Aaronontheweb Aaronontheweb commented Oct 21, 2025

Summary

Implements issue #679: Add customizable tags parameter to health check builder methods to allow users to override default health check tags.

Changes

Adds a new overload of WithHealthCheck() methods following extend-only design principles:

  • Original overload (unchanged): WithHealthCheck(HealthStatus = Degraded, string? name = null) - maintains backward compatibility
  • New overload: WithHealthCheck(HealthStatus unHealthyStatus, string? name, IEnumerable<string>? tags) - allows custom tags

When tags parameter is null, defaults are applied:

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

Overloads have non-overlapping signatures to prevent method ambiguity:

  • Original has 2 optional parameters
  • New overload requires all 3 parameters (no defaults)

Example Usage

// Use default tags (calls original overload)
builder.WithHealthCheck();

// Use default tags with custom status (calls original overload)
builder.WithHealthCheck(HealthStatus.Unhealthy);

// Use custom tags (calls new overload)
builder.WithHealthCheck(
    unHealthyStatus: HealthStatus.Degraded,
    name: "MyHealthCheck",
    tags: new[] { "backend", "database" });

Design Rationale

  • Extend-only design: Original method signature is preserved, no modifications to existing APIs
  • No binary compatibility issues: New method is additive, existing compiled code continues to work
  • No method ambiguity: Overloads have distinct signatures (different parameter requirements)

Testing

  • All 18 health check tests pass
  • Backward compatibility maintained: existing code calling WithHealthCheck() without tags parameter continues to work

Implements issue akkadotnet#679: Allow users to customize tags for health checks via optional parameter.

- Added optional `tags` parameter to AkkaPersistenceJournalBuilder.WithHealthCheck()
- Added optional `tags` parameter to AkkaPersistenceSnapshotBuilder.WithHealthCheck()
- When tags parameter is null, defaults to ["akka", "persistence", "journal"] or ["akka", "persistence", "snapshot-store"]
- Consolidates previous overloads into single method with all optional parameters to avoid ambiguity
- All 18 health check tests pass
@Aaronontheweb Aaronontheweb force-pushed the feature/679-customizable-health-check-tags branch from 28b73a2 to 533a3c5 Compare October 21, 2025 19:35
…tern

Updated AkkaPersistenceJournalBuilder and AkkaPersistenceSnapshotBuilder
to use optional parameters instead of method overloads, following the
pattern established in PR akkadotnet#682 for consistency across the codebase.

Changes:
- Removed separate overloads for WithHealthCheck() methods
- Added optional 'tags' parameter to existing methods
- Updated API approval tests to reflect new signatures
- All tests pass successfully
@Aaronontheweb Aaronontheweb merged commit bcdab40 into akkadotnet:dev Oct 25, 2025
2 checks passed
@Aaronontheweb Aaronontheweb deleted the feature/679-customizable-health-check-tags branch October 25, 2025 02:23
This was referenced Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant