Phobos
Enterprise Application Monitoring and Management for Akka.NET OSS
Published by Petabridge
  • last updated 4 day(s) ago
  • 3479 daily downloads
  • 1922851 total downloads
  • Latest version: 2.8.5

Phobos.TestKit 2.0.0-beta4

Framework used for testing applications that have been instrumented using Phobos. Makes it feasible to test using data collected from actor traces, monitoring, and so forth.

Install-Package Phobos.TestKit -Version 2.0.0-beta4
dotnet add package Phobos.TestKit --version 2.0.0-beta4
<PackageReference Include="Phobos.TestKit" Version="2.0.0-beta4"/>
paket add Phobos.TestKit --version 2.0.0-beta4

Release Notes

Major Update to Phobos 2.x** This release contains some **breaking changes** which we've introduced intentionally in order to get users concerned about noise control from the Phobos tracing system to migrate over to a new set of APIs that perform the job in a much more coherent fashion that what we have currently in Phobos 1.4 / 2.0.0-beta3 and newer. You can see some examples of end-user negative experience reports with the current v1.x and 2.x trace filtering implementations here: https://github.com/petabridge/phobos-issues/issues/46 https://github.com/petabridge/phobos-issues/issues/49 There have been many more like these over the past couple of years - separating noise from useful signals has been a persistent challenge with Phobos tracing and the changes we're introducing in Phobos v1.5 and 2.0-beta4 address this with a small new API: ```csharp /// <summary> /// Each <see cref="ActorSystem"/> can implement exactly one of these to control /// the decision-making around which traces to include and which ones to exclude. /// /// When this type is configured, it will replace all of the <see cref="IFilterRule"/>s /// that have been previously defined. /// </summary> /// <seealso cref="FilterDecision"/> public interface ITraceFilter { /// <summary> /// Evaluates a message processed by an actor and determines whether or not to include it in the current /// or a new trace. /// </summary> /// <param name="message">The message currently being processed by an actor.</param> /// <param name="alreadyInTrace">Whether or not this message is already part of an active trace.</param> /// <returns><c>true</c> if we are going to trace the message, <c>false</c> otherwise.</returns> /// <remarks> /// Should return <c>true</c> unless you are explicitly trying to filter a given message out of your trace. /// </remarks> bool ShouldTraceMessage(object message, bool alreadyInTrace); } ``` This is the `ITraceFilter` - and there is _exactly one of these_ for your entire `ActorSystem`. It allows you to decide whether or not to trace an actor's message processing activity based on: Message type; Message content; and Whether or not we are inside an active trace or not. This API is astonishingly succinct, much clearer than the previous `TracingConfigBuilder` API from before, extremely performant, and very effective at limiting noise inside your Phobos-enabled Akka.NET applications. An example from one of our own stress testing applications: ```csharp public sealed class ScenarioTraceFilter : ITraceFilter { public bool ShouldTraceMessage(object message, bool alreadyInTrace) { switch (message) { /* Only start new traces for these commands / case IScenarioProtocolMessage _: case Petabridge.Cmd.Command _: case Petabridge.Cmd.CommandResponse _: return true; default: // otherwise, only allow messages already in trace to be included return alreadyInTrace; } } } ``` This class allows new traces to only be started handful of [Petabridge.Cmd](https://cmd.petabridge.com/) types and any messages and our custom `IScenarioProtocol` messages. Any additional messages _will not_ be included in a trace unless there is already an active trace present. You can add this `ITraceFilter` to your applications like so: ```csharp var phobosSetup = PhobosSetup.Create(new PhobosConfigBuilder() .WithMetrics(m => m.SetMetricsRoot(metrics)) // binds Phobos to same IMetricsRoot as ASP.NET Core .WithTracing(t => t.SetTracer(tracer) .SetTraceFilter(new ScenarioTraceFilter()) )) // binds Phobos to same tracer as ASP.NET Core .WithSetup(BootstrapSetup.Create() .WithActorRefProvider(PhobosProviderSelection .Local)); // last line activates Phobos inside Akka.NET ``` Phobos still supports the old `TracingConfigBuilder` pattern and the `WithIncludeMessage<T>` rules - however, all of those rules will be overidden and replaced when the `ITraceFilter` is used instead. We have broken the old `TracingConfigBuilder` method signatures in order to alert users to this important change - however, we are going to keep these changes in a beta state for a short period in order to gather feedback from affected users. If you are concerned about trace noise inside your application, _please try this beta_ and report on your experience on the [Phobos Issue Tracker](https://github.com/petabridge/phobos-issues).

Dependencies

.NETFramework

.NETCoreApp

Versions

Version
Downloads
Last Updated
5
4 day(s) ago
58
49 day(s) ago
62
97 day(s) ago
84
131 day(s) ago
53
132 day(s) ago
54
138 day(s) ago
54
145 day(s) ago
56
165 day(s) ago
54
172 day(s) ago
55
180 day(s) ago
79
341 day(s) ago
55
351 day(s) ago
54
357 day(s) ago
67
440 day(s) ago
59
476 day(s) ago
59
510 day(s) ago
59
544 day(s) ago
55
551 day(s) ago
54
600 day(s) ago
66
623 day(s) ago
158
683 day(s) ago
56
686 day(s) ago
179
741 day(s) ago
221
767 day(s) ago
57
770 day(s) ago
59
770 day(s) ago
68
775 day(s) ago
63
823 day(s) ago
1
825 day(s) ago
61
868 day(s) ago
1
957 day(s) ago
1
1030 day(s) ago
103
1089 day(s) ago
56
1093 day(s) ago
55
1097 day(s) ago
57
1104 day(s) ago
2
1117 day(s) ago
71
1141 day(s) ago
54
1147 day(s) ago
54
1148 day(s) ago
96
1148 day(s) ago
54
1148 day(s) ago
1
1173 day(s) ago
1
1173 day(s) ago
178
1183 day(s) ago
2
1217 day(s) ago
1
1218 day(s) ago
114
1218 day(s) ago
1
1224 day(s) ago
55
1231 day(s) ago
102
1247 day(s) ago
54
1260 day(s) ago
54
1271 day(s) ago
249
1292 day(s) ago
75
1329 day(s) ago
172
1331 day(s) ago
330
1364 day(s) ago
113
1385 day(s) ago
55
1393 day(s) ago
617
1447 day(s) ago
179
1463 day(s) ago
62
1469 day(s) ago
302
1489 day(s) ago
509
1532 day(s) ago
723
1590 day(s) ago
135
1594 day(s) ago
136
1594 day(s) ago
136
1594 day(s) ago
136
1594 day(s) ago
139
1624 day(s) ago
136
1639 day(s) ago
424
1660 day(s) ago
136
1694 day(s) ago
221
1707 day(s) ago
136
1707 day(s) ago

Info

Statistics

  • 8353 total downloads
  • 1 downloads of current version

Owners and Products

Petabridge Petabridge

Authors

Petabridge

Copyright

Copyright © 2017-2021 Petabridge

Petabridge