/// <summary> /// Increment the "Actors Stopped" counter /// </summary> /// <param name="context">The context of the actor making this call</param> /// <param name="value">The value of the counter. 1 by default.</param> /// <param name="sampleRate">The sample rate. 100% by default.</param> public void IncrementActorStopped(IActorContext context = null, int value = 1, double?sampleRate = null) { Registry.UpdateCounter(CounterNames.ActorsStopped, value, sampleRate ?? GlobalSampleRate); if (context != null) { Registry.UpdateCounter(CounterNames.ActorSpecificCategory(context, CounterNames.ActorsStopped), value, sampleRate ?? GlobalSampleRate); } }
/// <summary> /// Increment a custom timing, used to measure the elapsed time of something /// </summary> /// <param name="metricName">The name of the timing as it will appear in your monitoring system</param> /// <param name="time">The amount of time that elapsed, in milliseconds</param> /// <param name="sampleRate">The sample rate. 100% by default.</param> /// <param name="context">The context of the actor making this call</param> public void Timing(string metricName, long time, double sampleRate = 1, IActorContext context = null) { Registry.UpdateTimer(metricName, time, sampleRate); if (context != null) { Registry.UpdateTimer(CounterNames.ActorSpecificCategory(context, metricName), time, sampleRate); } }
/// <summary> /// Increment a custom Gauge, used to measure arbitrary values (such as the size of messages, etc... non-counter measurements) /// </summary> /// <param name="metricName">The name of the timing as it will appear in your monitoring system</param> /// <param name="value">The value of the gauge</param> /// <param name="sampleRate">The sample rate. 100% by default.</param> /// <param name="context">The context of the actor making this call</param> public void Gauge(string metricName, int value = 1, double sampleRate = 1, IActorContext context = null) { Registry.UpdateGauge(metricName, value, sampleRate); if (context != null) { Registry.UpdateGauge(CounterNames.ActorSpecificCategory(context, metricName), value, sampleRate); } }
/// <summary> /// Increment the "Infos" counter /// </summary> /// <param name="context">The context of the actor making this call</param> /// <param name="value">The value of the counter. 1 by default.</param> /// <param name="sampleRate">The sample rate. 100% by default.</param> public void IncrementInfosLogged(IActorContext context = null, int value = 1, double?sampleRate = null) { Registry.UpdateCounter(CounterNames.InfoMessages, value, sampleRate ?? GlobalSampleRate); if (context != null) { Registry.UpdateCounter(CounterNames.ActorSpecificCategory(context, CounterNames.InfoMessages), value, sampleRate ?? GlobalSampleRate); } }