Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Healthcheck diagnostics #1813

Merged
merged 2 commits into from
Oct 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion examples/AspNetGrains/Node1/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Proto.Cluster;
using Proto.Cluster.Seed;
using Proto.Remote;
using Proto.Remote.Healthchecks;
using Proto.Remote.HealthChecks;

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddLogging(x => x.AddConsole());
Expand Down Expand Up @@ -33,4 +33,6 @@
return entries;
});

app.MapHealthChecks("/health");

app.Run();
4 changes: 2 additions & 2 deletions examples/AspNetGrains/Node2/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Proto.Cluster;
using Proto.Cluster.Seed;
using Proto.Remote;
using Proto.Remote.Healthchecks;
using Proto.Remote.HealthChecks;

var builder = WebApplication.CreateBuilder(args);

Expand All @@ -16,13 +16,13 @@

builder.Services.AddHealthChecks().AddCheck<ActorSystemHealthCheck>("proto", null, new[] { "ready", "live" });


var app = builder.Build();

app.MapGet("/diagnostics", (ActorSystem system) =>
{
var entries = system.Diagnostics.Get();
return entries;
});
app.MapHealthChecks("/health");

app.Run();
2 changes: 1 addition & 1 deletion examples/Proto.Cluster.Dashboard.Host/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Proto.Cluster.Seed;
using Proto.Remote;
using Proto.Remote.GrpcNet;
using Proto.Remote.Healthchecks;
using Proto.Remote.HealthChecks;

var builder = WebApplication.CreateBuilder(args);

Expand Down
3 changes: 2 additions & 1 deletion src/Proto.Remote/Healthchecks/Healthcheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using JetBrains.Annotations;
using Microsoft.Extensions.Diagnostics.HealthChecks;

namespace Proto.Remote.Healthchecks;
namespace Proto.Remote.HealthChecks;

/// <summary>
/// Reports unhealthy status if the <see cref="ActorSystem" /> is shutting down or completed the shutdown.
Expand All @@ -22,6 +22,7 @@ public class ActorSystemHealthCheck : IHealthCheck
public ActorSystemHealthCheck(ActorSystem system)
{
_system = system;
_system.Diagnostics.RegisterEvent("Remote", "HealthChecks enabled");
}

public Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context,
Expand Down