/// <summary> /// Stops the internal timer and logs a latency metric. /// </summary> public void Dispose() { _stopwatch.Stop(); _client.LogTimingAsync(_name, (int)_stopwatch.ElapsedMilliseconds); }
/// <summary> /// Log a timing / latency /// </summary> /// <param name="client">The statsd client instance.</param> /// <param name="name">The metric name.</param> /// <param name="milliseconds">The duration, in milliseconds, for this metric.</param> public static void LogTiming(this IStatsd client, string name, long milliseconds) { client.LogTimingAsync(name, milliseconds).ConfigureAwait(false).GetAwaiter().GetResult(); }
public static void LogTiming(this IStatsd client, string name, long milliseconds) { client.LogTimingAsync(name, milliseconds)?.Wait(); }