Skip to content

Commit

Permalink
Make all healthcheck probes not instrumented by Phobos (#291)
Browse files Browse the repository at this point in the history
* Make persistence suicide probe not instrumented by Phobos

* Mark all healthcheck actors as INeverInstrumented
  • Loading branch information
Arkatufus authored Nov 27, 2024
1 parent c1245b9 commit 97434a9
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/Akka.HealthCheck.Cluster/ClusterLivenessProbe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
using Akka.Actor;
using Akka.Event;
using Akka.HealthCheck.Liveness;
using Phobos.Actor.Common;

namespace Akka.HealthCheck.Cluster
{
/// <summary>
/// Algorithm that indicates that we are live if we are a member of the cluster, and we are not
/// if we are removed from the cluster's membership.
/// </summary>
public sealed class ClusterLivenessProbe : ReceiveActor
public sealed class ClusterLivenessProbe : ReceiveActor, INeverInstrumented
{
public static readonly LivenessStatus DefaultClusterLivenessStatus =
LivenessStatus.Degraded("not yet joined cluster");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Akka.Cluster;
using Akka.Event;
using Akka.HealthCheck.Readiness;
using Phobos.Actor.Common;

namespace Akka.HealthCheck.Cluster
{
Expand All @@ -31,7 +32,7 @@ public ClusterReadinessProbeProvider(ActorSystem system) : base(system)
/// meaning that we have been partitioned away from everyone else for a lengthy period of
/// time.
/// </summary>
public sealed class ClusterReadinessProbe : ReceiveActor
public sealed class ClusterReadinessProbe : ReceiveActor, INeverInstrumented
{
public static readonly ReadinessStatus DefaultClusterReadinessStatus =
new ReadinessStatus(true, "not yet joined cluster");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Akka.Event;
using Akka.HealthCheck.Liveness;
using Akka.Persistence;
using Phobos.Actor.Common;

#nullable enable
namespace Akka.HealthCheck.Persistence
Expand Down Expand Up @@ -81,7 +82,7 @@ private CheckTimeout()
}
}

public class AkkaPersistenceLivenessProbe : ActorBase, IWithTimers
public class AkkaPersistenceLivenessProbe : ActorBase, IWithTimers, INeverInstrumented
{
public static readonly string PersistenceId = $"Akka.HealthCheck-{Guid.NewGuid()}";

Expand Down Expand Up @@ -247,7 +248,7 @@ private void PublishStatusUpdates()
/// <summary>
/// Validate that the snapshot store and the journal and both working
/// </summary>
internal class SuicideProbe : ReceivePersistentActor
internal class SuicideProbe : ReceivePersistentActor, INeverInstrumented
{
public static Props Props(IActorRef probe, string persistenceId, bool debugLog)
=> Actor.Props.Create(() => new SuicideProbe(probe, persistenceId, debugLog))
Expand Down
1 change: 1 addition & 0 deletions src/Akka.HealthCheck/Akka.HealthCheck.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

<ItemGroup>
<PackageReference Include="Akka" />
<PackageReference Include="Phobos.Actor.Common" />
<Using Include="Akka.Event" />
</ItemGroup>

Expand Down
5 changes: 3 additions & 2 deletions src/Akka.HealthCheck/Liveness/DefaultLivenessProbe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
using System.Collections.Generic;
using Akka.Actor;
using Akka.Event;
using Phobos.Actor.Common;

namespace Akka.HealthCheck.Liveness
{
/// <inheritdoc />
/// <inheritdoc cref="ReceiveActor"/>
/// <summary>
/// The default liveness probe implementation. Reports that the application
/// is live as soon as the <see cref="T:Akka.Actor.ActorSystem" /> is live.
/// </summary>
public sealed class DefaultLivenessProbe : ReceiveActor
public sealed class DefaultLivenessProbe : ReceiveActor, INeverInstrumented
{
private readonly ILoggingAdapter _log = Context.GetLogger();
private readonly LivenessStatus _livenessStatus;
Expand Down
5 changes: 3 additions & 2 deletions src/Akka.HealthCheck/Readiness/DefaultReadinessProbe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
using System.Collections.Generic;
using Akka.Actor;
using Akka.Event;
using Phobos.Actor.Common;

namespace Akka.HealthCheck.Readiness
{
/// <inheritdoc />
/// <inheritdoc cref="ReceiveActor"/>
/// <summary>
/// The default readiness probe implementation. Reports that the application
/// is ready as soon as the <see cref="T:Akka.Actor.ActorSystem" /> is up.
/// </summary>
public sealed class DefaultReadinessProbe : ReceiveActor
public sealed class DefaultReadinessProbe : ReceiveActor, INeverInstrumented
{
private readonly ILoggingAdapter _log = Context.GetLogger();
private readonly ReadinessStatus _readinessStatus;
Expand Down
3 changes: 2 additions & 1 deletion src/Akka.HealthCheck/Transports/LivenessTransportActor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@
using System.Collections.Immutable;
using System.Linq;
using System.Threading;
using Phobos.Actor.Common;

namespace Akka.HealthCheck.Transports
{
/// <summary>
/// Subscribes to <see cref="LivenessStatus" /> changes and signals
/// the underlying <see cref="IStatusTransport" /> accordingly.
/// </summary>
public sealed class LivenessTransportActor : ReceiveActor
public sealed class LivenessTransportActor : ReceiveActor, INeverInstrumented
{
private const int LivenessTimeout = 1000;
private readonly List<IActorRef> _livenessProbes;
Expand Down
3 changes: 2 additions & 1 deletion src/Akka.HealthCheck/Transports/ReadinessTransportActor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@
using Akka.Actor;
using Akka.Event;
using Akka.HealthCheck.Readiness;
using Phobos.Actor.Common;

namespace Akka.HealthCheck.Transports
{
/// <summary>
/// Subscribes to <see cref="ReadinessStatus" /> changes and signals
/// the underlying <see cref="IStatusTransport" /> accordingly.
/// </summary>
public sealed class ReadinessTransportActor : ReceiveActor
public sealed class ReadinessTransportActor : ReceiveActor, INeverInstrumented
{
private const int ReadinessTimeout = 1000;
private readonly ILoggingAdapter _log = Context.GetLogger();
Expand Down
1 change: 1 addition & 0 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<PackageVersion Include="Akka.Persistence.Hosting" Version="$(AkkaHostingVersion)" />
<PackageVersion Include="akka.persistence.sqlite" Version="$(AkkaVersion)" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="[3.0.0,)" />
<PackageVersion Include="Phobos.Actor.Common" Version="1.1.2" />
</ItemGroup>
<!-- Test dependencies -->
<ItemGroup>
Expand Down

0 comments on commit 97434a9

Please sign in to comment.