Skip to content

Commit

Permalink
[Port #6294] add simple actor telemetry (#6299)
Browse files Browse the repository at this point in the history
* add simple actor telemetry (#6294)

* added initial actor telemetry for #6293

* added basic telemetry tests for local actors

* added spec to validate that `RemoteActorRef` doesn't influence counters

* updated `SpawnActorBenchmarks` to include telemetry impact

* converted telemetry events into `sealed class`es with `internal` constructors

* removed `Reason`

(cherry picked from commit 7f68c48)

* Update API Verify list

* Fix API verify list

* Fix API verify list

* fix API Verify list

Co-authored-by: Aaron Stannard <aaron@petabridge.com>
  • Loading branch information
Arkatufus and Aaronontheweb authored Dec 9, 2022
1 parent fddecf1 commit ec1e469
Show file tree
Hide file tree
Showing 12 changed files with 665 additions and 8 deletions.
16 changes: 14 additions & 2 deletions src/benchmark/Akka.Benchmarks/Actor/SpawnActorBenchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,19 @@ public class SpawnActorBenchmarks
{
[Params(100_000)]
public int ActorCount { get;set; }

[Params(true, false)]
public bool EnableTelemetry { get; set; }

private ActorSystem system;

[IterationSetup]
public void Setup()
{
system = ActorSystem.Create("system");
if(EnableTelemetry) // need to measure the impact of publishing actor start / stop events
system = ActorSystem.Create("system", "akka.actor.telemetry.enabled = true");
else
system = ActorSystem.Create("system");
}

[IterationCleanup]
Expand All @@ -38,7 +45,12 @@ public void Cleanup()
public async Task Actor_spawn()
{
var parent = system.ActorOf(Parent.Props);
await parent.Ask<TestDone>(new StartTest(ActorCount), TimeSpan.FromMinutes(2));

// spawn a bunch of actors
await parent.Ask<TestDone>(new StartTest(ActorCount), TimeSpan.FromMinutes(2)).ConfigureAwait(false);

// terminate the hierarchy
await parent.GracefulStop(TimeSpan.FromMinutes(1)).ConfigureAwait(false);
}

#region actors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,12 @@ namespace Akka.Actor
public static readonly Akka.Actor.IActorRef NoSender;
public static readonly Akka.Actor.Nobody Nobody;
}
public sealed class ActorRestarted : Akka.Actor.IActorTelemetryEvent, Akka.Actor.INoSerializationVerificationNeeded, Akka.Actor.INotInfluenceReceiveTimeout
{
public System.Type ActorType { get; }
public System.Exception Reason { get; }
public Akka.Actor.IActorRef Subject { get; }
}
public class ActorSelection : Akka.Actor.ICanTell
{
public ActorSelection() { }
Expand All @@ -339,13 +345,23 @@ namespace Akka.Actor
public Akka.Actor.ActorSelectionMessage Copy(object message = null, Akka.Actor.SelectionPathElement[] elements = null, System.Nullable<bool> wildCardFanOut = null) { }
public override string ToString() { }
}
public sealed class ActorStarted : Akka.Actor.IActorTelemetryEvent, Akka.Actor.INoSerializationVerificationNeeded, Akka.Actor.INotInfluenceReceiveTimeout
{
public System.Type ActorType { get; }
public Akka.Actor.IActorRef Subject { get; }
}
public class ActorStashPlugin : Akka.Actor.ActorProducerPluginBase
{
public ActorStashPlugin() { }
public override void AfterIncarnated(Akka.Actor.ActorBase actor, Akka.Actor.IActorContext context) { }
public override void BeforeIncarnated(Akka.Actor.ActorBase actor, Akka.Actor.IActorContext context) { }
public override bool CanBeAppliedTo(System.Type actorType) { }
}
public sealed class ActorStopped : Akka.Actor.IActorTelemetryEvent, Akka.Actor.INoSerializationVerificationNeeded, Akka.Actor.INotInfluenceReceiveTimeout
{
public System.Type ActorType { get; }
public Akka.Actor.IActorRef Subject { get; }
}
public abstract class ActorSystem : Akka.Actor.IActorRefFactory, System.IDisposable
{
protected ActorSystem() { }
Expand Down Expand Up @@ -991,6 +1007,11 @@ namespace Akka.Actor
{
Akka.Actor.IStash Stash { get; set; }
}
public interface IActorTelemetryEvent : Akka.Actor.INoSerializationVerificationNeeded, Akka.Actor.INotInfluenceReceiveTimeout
{
System.Type ActorType { get; }
Akka.Actor.IActorRef Subject { get; }
}
public interface IAdvancedScheduler : Akka.Actor.IActionScheduler, Akka.Actor.IRunnableScheduler { }
public interface IAutoReceivedMessage { }
public interface ICanTell
Expand Down Expand Up @@ -1689,6 +1710,7 @@ namespace Akka.Actor
public bool DebugRouterMisconfiguration { get; }
public bool DebugUnhandledMessage { get; }
public int DefaultVirtualNodesFactor { get; }
public bool EmitActorTelemetry { get; }
public bool FsmDebugEvent { get; }
public bool HasCluster { get; }
public string Home { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,12 @@ namespace Akka.Actor
public static readonly Akka.Actor.IActorRef NoSender;
public static readonly Akka.Actor.Nobody Nobody;
}
public sealed class ActorRestarted : Akka.Actor.IActorTelemetryEvent, Akka.Actor.INoSerializationVerificationNeeded, Akka.Actor.INotInfluenceReceiveTimeout
{
public System.Type ActorType { get; }
public System.Exception Reason { get; }
public Akka.Actor.IActorRef Subject { get; }
}
public class ActorSelection : Akka.Actor.ICanTell
{
public ActorSelection() { }
Expand All @@ -339,13 +345,23 @@ namespace Akka.Actor
public Akka.Actor.ActorSelectionMessage Copy(object message = null, Akka.Actor.SelectionPathElement[] elements = null, System.Nullable<bool> wildCardFanOut = null) { }
public override string ToString() { }
}
public sealed class ActorStarted : Akka.Actor.IActorTelemetryEvent, Akka.Actor.INoSerializationVerificationNeeded, Akka.Actor.INotInfluenceReceiveTimeout
{
public System.Type ActorType { get; }
public Akka.Actor.IActorRef Subject { get; }
}
public class ActorStashPlugin : Akka.Actor.ActorProducerPluginBase
{
public ActorStashPlugin() { }
public override void AfterIncarnated(Akka.Actor.ActorBase actor, Akka.Actor.IActorContext context) { }
public override void BeforeIncarnated(Akka.Actor.ActorBase actor, Akka.Actor.IActorContext context) { }
public override bool CanBeAppliedTo(System.Type actorType) { }
}
public sealed class ActorStopped : Akka.Actor.IActorTelemetryEvent, Akka.Actor.INoSerializationVerificationNeeded, Akka.Actor.INotInfluenceReceiveTimeout
{
public System.Type ActorType { get; }
public Akka.Actor.IActorRef Subject { get; }
}
public abstract class ActorSystem : Akka.Actor.IActorRefFactory, System.IDisposable
{
protected ActorSystem() { }
Expand Down Expand Up @@ -993,6 +1009,11 @@ namespace Akka.Actor
{
Akka.Actor.IStash Stash { get; set; }
}
public interface IActorTelemetryEvent : Akka.Actor.INoSerializationVerificationNeeded, Akka.Actor.INotInfluenceReceiveTimeout
{
System.Type ActorType { get; }
Akka.Actor.IActorRef Subject { get; }
}
public interface IAdvancedScheduler : Akka.Actor.IActionScheduler, Akka.Actor.IRunnableScheduler { }
public interface IAutoReceivedMessage { }
public interface ICanTell
Expand Down Expand Up @@ -1691,6 +1712,7 @@ namespace Akka.Actor
public bool DebugRouterMisconfiguration { get; }
public bool DebugUnhandledMessage { get; }
public int DefaultVirtualNodesFactor { get; }
public bool EmitActorTelemetry { get; }
public bool FsmDebugEvent { get; }
public bool HasCluster { get; }
public string Home { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,12 @@ namespace Akka.Actor
public static readonly Akka.Actor.IActorRef NoSender;
public static readonly Akka.Actor.Nobody Nobody;
}
public sealed class ActorRestarted : Akka.Actor.IActorTelemetryEvent, Akka.Actor.INoSerializationVerificationNeeded, Akka.Actor.INotInfluenceReceiveTimeout
{
public System.Type ActorType { get; }
public System.Exception Reason { get; }
public Akka.Actor.IActorRef Subject { get; }
}
public class ActorSelection : Akka.Actor.ICanTell
{
public ActorSelection() { }
Expand All @@ -339,13 +345,23 @@ namespace Akka.Actor
public Akka.Actor.ActorSelectionMessage Copy(object message = null, Akka.Actor.SelectionPathElement[] elements = null, System.Nullable<bool> wildCardFanOut = null) { }
public override string ToString() { }
}
public sealed class ActorStarted : Akka.Actor.IActorTelemetryEvent, Akka.Actor.INoSerializationVerificationNeeded, Akka.Actor.INotInfluenceReceiveTimeout
{
public System.Type ActorType { get; }
public Akka.Actor.IActorRef Subject { get; }
}
public class ActorStashPlugin : Akka.Actor.ActorProducerPluginBase
{
public ActorStashPlugin() { }
public override void AfterIncarnated(Akka.Actor.ActorBase actor, Akka.Actor.IActorContext context) { }
public override void BeforeIncarnated(Akka.Actor.ActorBase actor, Akka.Actor.IActorContext context) { }
public override bool CanBeAppliedTo(System.Type actorType) { }
}
public sealed class ActorStopped : Akka.Actor.IActorTelemetryEvent, Akka.Actor.INoSerializationVerificationNeeded, Akka.Actor.INotInfluenceReceiveTimeout
{
public System.Type ActorType { get; }
public Akka.Actor.IActorRef Subject { get; }
}
public abstract class ActorSystem : Akka.Actor.IActorRefFactory, System.IDisposable
{
protected ActorSystem() { }
Expand Down Expand Up @@ -991,6 +1007,11 @@ namespace Akka.Actor
{
Akka.Actor.IStash Stash { get; set; }
}
public interface IActorTelemetryEvent : Akka.Actor.INoSerializationVerificationNeeded, Akka.Actor.INotInfluenceReceiveTimeout
{
System.Type ActorType { get; }
Akka.Actor.IActorRef Subject { get; }
}
public interface IAdvancedScheduler : Akka.Actor.IActionScheduler, Akka.Actor.IRunnableScheduler { }
public interface IAutoReceivedMessage { }
public interface ICanTell
Expand Down Expand Up @@ -1689,6 +1710,7 @@ namespace Akka.Actor
public bool DebugRouterMisconfiguration { get; }
public bool DebugUnhandledMessage { get; }
public int DefaultVirtualNodesFactor { get; }
public bool EmitActorTelemetry { get; }
public bool FsmDebugEvent { get; }
public bool HasCluster { get; }
public string Home { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
[assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("Akka.Tests.Performance")]
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
[assembly: System.Runtime.InteropServices.GuidAttribute("1a5cab08-b032-49ca-8db3-9428c5a9db14")]
[assembly: System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.0", FrameworkDisplayName=".NET Standard 2.0")]
[assembly: System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.0", FrameworkDisplayName="")]
namespace Akka.Actor
{
public abstract class ActorBase : Akka.Actor.IInternalActor
Expand Down Expand Up @@ -314,6 +314,12 @@ namespace Akka.Actor
public static readonly Akka.Actor.IActorRef NoSender;
public static readonly Akka.Actor.Nobody Nobody;
}
public sealed class ActorRestarted : Akka.Actor.IActorTelemetryEvent, Akka.Actor.INoSerializationVerificationNeeded, Akka.Actor.INotInfluenceReceiveTimeout
{
public System.Type ActorType { get; }
public System.Exception Reason { get; }
public Akka.Actor.IActorRef Subject { get; }
}
public class ActorSelection : Akka.Actor.ICanTell
{
public ActorSelection() { }
Expand All @@ -340,13 +346,23 @@ namespace Akka.Actor
public Akka.Actor.ActorSelectionMessage Copy(object message = null, Akka.Actor.SelectionPathElement[] elements = null, System.Nullable<bool> wildCardFanOut = null) { }
public override string ToString() { }
}
public sealed class ActorStarted : Akka.Actor.IActorTelemetryEvent, Akka.Actor.INoSerializationVerificationNeeded, Akka.Actor.INotInfluenceReceiveTimeout
{
public System.Type ActorType { get; }
public Akka.Actor.IActorRef Subject { get; }
}
public class ActorStashPlugin : Akka.Actor.ActorProducerPluginBase
{
public ActorStashPlugin() { }
public override void AfterIncarnated(Akka.Actor.ActorBase actor, Akka.Actor.IActorContext context) { }
public override void BeforeIncarnated(Akka.Actor.ActorBase actor, Akka.Actor.IActorContext context) { }
public override bool CanBeAppliedTo(System.Type actorType) { }
}
public sealed class ActorStopped : Akka.Actor.IActorTelemetryEvent, Akka.Actor.INoSerializationVerificationNeeded, Akka.Actor.INotInfluenceReceiveTimeout
{
public System.Type ActorType { get; }
public Akka.Actor.IActorRef Subject { get; }
}
public abstract class ActorSystem : Akka.Actor.IActorRefFactory, System.IDisposable
{
protected ActorSystem() { }
Expand Down Expand Up @@ -988,6 +1004,11 @@ namespace Akka.Actor
{
Akka.Actor.IStash Stash { get; set; }
}
public interface IActorTelemetryEvent : Akka.Actor.INoSerializationVerificationNeeded, Akka.Actor.INotInfluenceReceiveTimeout
{
System.Type ActorType { get; }
Akka.Actor.IActorRef Subject { get; }
}
public interface IAdvancedScheduler : Akka.Actor.IActionScheduler, Akka.Actor.IRunnableScheduler { }
public interface IAutoReceivedMessage { }
public interface ICanTell
Expand Down Expand Up @@ -1682,6 +1703,7 @@ namespace Akka.Actor
public bool DebugRouterMisconfiguration { get; }
public bool DebugUnhandledMessage { get; }
public int DefaultVirtualNodesFactor { get; }
public bool EmitActorTelemetry { get; }
public bool FsmDebugEvent { get; }
public bool HasCluster { get; }
public string Home { get; }
Expand Down
Loading

0 comments on commit ec1e469

Please sign in to comment.