コード例 #1
0
 public void Send(InfluxPoint point)
 {
     using (var writer = new StringWriter()) {
         point.Format(writer, _tags);
         _text.Send(writer.ToString());
     }
 }
コード例 #2
0
 public void Send(InfluxPoint point)
 {
     if (_queue.Count > _maxLevel)
     {
         Interlocked.Increment(ref _discarded);
         return;
     }
     _queue.Enqueue(point);
 }
コード例 #3
0
        public static void Record(string measurement,
                                  Dictionary <string, object> values,
                                  Dictionary <string, string> tags = null,
                                  int sampleRate = 1)
        {
            if (!Sampler(sampleRate))
            {
                return;
            }
            var point = new InfluxPoint(measurement, values, tags);

            _statsD.Send(point);
        }
コード例 #4
0
ファイル: Metrics.cs プロジェクト: judgie79/telegraf-client
        /// <summary>
        /// Set the gauge to the given absolute value.
        /// </summary>
        /// <param name="measurement">Name of the metric.</param>
        /// <param name="value">Absolute value of the gauge to set.</param>
        public static void RecordValue(string measurement, object value,
                                       IReadOnlyDictionary <string, string> tags = null,
                                       int sampleRate = 1)
        {
            if (!Sampler(sampleRate))
            {
                return;
            }
            var values = new Dictionary <string, object> {
                { "value", value }
            };
            var point = new InfluxPoint(measurement, values, tags);

            _statsD.Send(point);
        }
コード例 #5
0
        /// <summary>
        /// Send a counter value.
        /// </summary>
        /// <param name="measurement">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 RecordCount(
            string measurement, long count   = 1,
            Dictionary <string, string> tags = null,
            int sampleRate = 1)
        {
            if (!Sampler(sampleRate))
            {
                return;
            }
            var values = new Dictionary <string, object> {
                { "count", count }
            };
            var point = new InfluxPoint(measurement, values, tags);

            _statsD.Send(point);
        }
コード例 #6
0
        /// <summary>
        /// Record the given values
        /// </summary>
        /// <param name="measurement">Name of the metric.</param>
        /// <param name="values">Dictionary of key/values to set.</param>
        /// <param name="tags">Dictionary of key/values to store with entry.</param>
        /// <param name="sampleRate">Sample rate to reduce the load on your metric server. Defaults to 1 (100%).</param>
        public static void Record(string measurement, Dictionary <string, object> values, Dictionary <string, string> tags = null, int sampleRate = 1)
        {
            if (!Sampler(sampleRate))
            {
                return;
            }

            if (tags == null)
            {
                tags = new Dictionary <string, string>();
            }

            // Ensure the entry is always unique
            tags.Add("__guid", Guid.NewGuid().ToString());

            var point = new InfluxPoint(measurement, values, tags);

            _statsD.Send(point);
        }
コード例 #7
0
 public void Send(InfluxPoint point)
 {
 }