public void WriteTrace(Span[] trace)
        {
            if (_synchronousSend)
            {
                _api.SendTracesAsync(new[] { trace }).Wait();
                return;
            }

            var success = _tracesBuffer.Push(trace);

            if (!success)
            {
                Log.Debug("Trace buffer is full. Dropping a trace from the buffer.");
            }

            if (_statsd != null)
            {
                _statsd.AppendIncrementCount(TracerMetricNames.Queue.EnqueuedTraces);
                _statsd.AppendIncrementCount(TracerMetricNames.Queue.EnqueuedSpans, trace.Length);

                if (!success)
                {
                    _statsd.AppendIncrementCount(TracerMetricNames.Queue.DroppedTraces);
                    _statsd.AppendIncrementCount(TracerMetricNames.Queue.DroppedSpans, trace.Length);
                }

                _statsd.Send();
            }
        }
예제 #2
0
 public void Event(string title, string text, string alertType = null, string aggregationKey = null, string sourceType = null, int?dateHappened = null, string priority = null, string hostname = null, string[] tags = null)
 {
     if (_statsD == null)
     {
         return;
     }
     _statsD.Send(title, text, alertType, aggregationKey, sourceType, dateHappened, priority, hostname, tags);
 }
 static WaitCallback CreateSender(int sends, int threads, int which, IStatsd statsd, ManualResetEvent done)
 {
     return x => {
         for (int i = 0; i < sends; i++)
             if (which == (i % threads))
                 statsd.Send(i.ToString());
         done.Set();
     };
 }
예제 #4
0
 static WaitCallback CreateSender(int sends, int threads, int which, IStatsd statsd, ManualResetEvent done)
 {
     return(x => {
         for (int i = 0; i < sends; i++)
         {
             if (which == (i % threads))
             {
                 statsd.Send(i.ToString());
             }
         }
         done.Set();
     });
 }
예제 #5
0
        public void WriteTrace(List <Span> trace)
        {
            var success = _tracesBuffer.Push(trace);

            if (!success)
            {
                Log.Debug("Trace buffer is full, dropping it.");
            }

            if (_statsd != null)
            {
                _statsd.AppendIncrementCount(TracerMetricNames.Queue.EnqueuedTraces);
                _statsd.AppendIncrementCount(TracerMetricNames.Queue.EnqueuedSpans, trace.Count);

                if (!success)
                {
                    _statsd.AppendIncrementCount(TracerMetricNames.Queue.DroppedTraces);
                }

                _statsd.Send();
            }
        }
예제 #6
0
        public void WriteTrace(Span[] trace)
        {
            var success = _tracesBuffer.Push(trace);

            if (!success)
            {
                Log.Debug("Trace buffer is full. Dropping a trace from the buffer.");
            }

            if (_statsd != null)
            {
                _statsd.AppendIncrementCount(TracerMetricNames.Queue.EnqueuedTraces);
                _statsd.AppendIncrementCount(TracerMetricNames.Queue.EnqueuedSpans, trace.Length);

                if (!success)
                {
                    _statsd.AppendIncrementCount(TracerMetricNames.Queue.DroppedTraces);
                    _statsd.AppendIncrementCount(TracerMetricNames.Queue.DroppedSpans, trace.Length);
                }

                _statsd.Send();
            }
        }
예제 #7
0
        public void Publish(Metric metric)
        {
            Log.DebugFormat("{0} | {1} | {2}", metric.Name, metric.Value, metric.Type);

            switch (metric.Type)
            {
            case MetricType.Gauge:
                _statsdClient.Send <Statsd.Gauge>(metric.Name, metric.Value);
                return;

            case MetricType.Count:
                break;

            case MetricType.Timing:
                break;

            default:
                throw new NotSupportedException();
            }

            throw new NotSupportedException();
        }
예제 #8
0
 public static void Send(this IStatsd statsd, Action actionToTime, string statName, double sampleRate = 1) =>
 statsd.Send(actionToTime, statName.AsSpan(), sampleRate);
예제 #9
0
 public static void Send <TCommandType>(this IStatsd statsd, string name, double value, bool isDeltaValue) where TCommandType : IAllowsDouble, IAllowsDelta =>
 statsd.Send <TCommandType>(name.AsSpan(), value, isDeltaValue);
예제 #10
0
 public static void Send <TCommandType>(this IStatsd statsd, string name, int value) where TCommandType : IAllowsInteger =>
 statsd.Send <TCommandType>(name.AsSpan(), value);
 public void send_counters()
 {
     Parallel.For(0, ThreadCount, x => _stats.Send <Statsd.Counting>(Guid.NewGuid().ToString(), 5));
     Assert.That(DistinctMetricsSent(), Is.EqualTo(ThreadCount));
 }
예제 #12
0
 /// <summary>
 /// Send a counter value.
 /// </summary>
 /// <param name="statName">Name of the metric.</param>
 /// <param name="value">Value of the counter. Defaults to 1.</param>
 /// <param name="sampleRate">Sample rate to reduce the load on your metric server. Defaults to 1 (100%).</param>
 public static void Counter(string statName, int value = 1, double sampleRate = 1)
 {
     _statsD.Send <Statsd.Counting>(BuildNamespacedStatName(statName), value, sampleRate);
 }
예제 #13
0
 public static void Counter(string statName, int value = 1, object tags = null, double sampleRate = 1)
 {
     _statsD.Send <Counting>(statName, value, sampleRate, tags);
 }