Ejemplo n.º 1
0
 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
     });
 }
Ejemplo n.º 2
0
        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;
            }
        }
Ejemplo n.º 3
0
 public void Dispose()
 {
     if (ds != null)
     {
         ds.Counter(metricName, -value, tags: tags);
         ds = null;
     }
 }
Ejemplo n.º 4
0
 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
     });
 }
Ejemplo n.º 5
0
 public static void ConfigureDefault(string address, int port = 8125, string metricNamePrefix = null, string[] defaultTags = null)
 {
     Default.Dispose();
     Default = new DatadogStats(address, port, metricNamePrefix, defaultTags);
 }