public static CounterScope StartNew(DatadogStats dogstats, string metricName, long value, string[] tags) { dogstats.Counter(metricName, value, tags: tags); return(new CounterScope { ds = dogstats, metricName = metricName, tags = tags }); }
public void Dispose() { if (sw != null) { sw.Stop(); switch (type) { case MeasureType.Timer: ds.Timer(metricName, sw.Elapsed.TotalMilliseconds, sampleRate, tags); break; case MeasureType.Gauge: ds.Gauge(metricName, sw.Elapsed.TotalMilliseconds, sampleRate, tags); break; case MeasureType.Histogram: ds.Histogram(metricName, sw.Elapsed.TotalMilliseconds, sampleRate, tags); break; default: break; } ThreadSafeUtil.ReturnStopwatch(sw); sw = null; ds = null; } }
public void Dispose() { if (ds != null) { ds.Counter(metricName, -value, tags: tags); ds = null; } }
public static MeasureElapsedScope StartNew(DatadogStats dogstats, MeasureType type, string metricName, double sampleRate, string[] tags) { return(new MeasureElapsedScope { sw = ThreadSafeUtil.RentStopwatchStartNew(), ds = dogstats, type = type, metricName = metricName, tags = tags, sampleRate = sampleRate }); }
public static void ConfigureDefault(string address, int port = 8125, string metricNamePrefix = null, string[] defaultTags = null) { Default.Dispose(); Default = new DatadogStats(address, port, metricNamePrefix, defaultTags); }