コード例 #1
0
 private void SendMetric(string metricName, int value)
 {
     if (_optionalTransport != null)
     {
         var message = Statsd.Metric.GetCommand <Statsd.Counting, int>(
             string.Empty,
             metricName,
             value,
             1.0,
             _optionalTags);
         var bytes = BufferBuilder.GetBytes(message);
         _optionalTransport.Send(bytes, bytes.Length);
     }
 }
コード例 #2
0
 private void SendMetric(string metricName, int value)
 {
     if (_optionalTransport != null && _optionalMetricSerializer != null)
     {
         var serializedMetric = new SerializedMetric();
         var metricStats      = new StatsMetric
         {
             MetricType   = MetricType.Count,
             StatName     = metricName,
             NumericValue = value,
             SampleRate   = 1.0,
             Tags         = _optionalTags,
         };
         _optionalMetricSerializer.SerializeTo(ref metricStats, serializedMetric);
         var bytes = BufferBuilder.GetBytes(serializedMetric.ToString());
         _optionalTransport.Send(bytes, bytes.Length);
     }
 }