public Metric(string category, string name, MetricType metricType)
 {
     Category = category;
     MetricType = metricType;
     Name = name;
     Occurred = DateTime.UtcNow;
     IsIncrement = false;
     Settings = new MetricSetting() { AutoReportZeroIfNothingReported = false };
 }
 /// <summary>
 /// Increment or decrement a guage metric type
 /// </summary>
 /// <param name="category">Category of the metric</param>
 /// <param name="metricName">Name of the metric</param>
 /// <param name="incrementBy">Value can be positive or negative to decrement. Defaults to 1</param>
 public static void IncrementGauge(string category, string metricName, double incrementBy, MetricSetting advancedSettings)
 {
     //leaving the count as 1 below because when it gets processed later it would sum up the count there
     var m = new Metric(category, metricName, MetricType.MetricLast);
     m.Value = incrementBy;
     m.IsIncrement = true;
     m.Settings = advancedSettings;
     StackifyLib.Internal.Metrics.MetricClient.QueueMetric(m);
 }
Beispiel #3
0
 public Metric(string category, string name, MetricType metricType)
 {
     Category    = category;
     MetricType  = metricType;
     Name        = name;
     Occurred    = DateTime.UtcNow;
     IsIncrement = false;
     Settings    = new MetricSetting()
     {
         AutoReportZeroIfNothingReported = false
     };
 }
 /// <summary>
 /// Sums up the values passed in and reports the total once per minute
 /// </summary>
 /// <param name="category">Category of the metric</param>
 /// <param name="metricName">Name of the metric</param>
 /// <param name="value"></param>
 public static void Sum(string category, string metricName, double value, MetricSetting advancedSettings = null)
 {
     var m = new Metric(category, metricName, MetricType.Counter);
     m.Value = value;
     m.Settings = advancedSettings;
     StackifyLib.Internal.Metrics.MetricClient.QueueMetric(m);
 }
 /// <summary>
 /// Sums up the values passed in and reports the average of the values once per minute
 /// </summary>
 /// <param name="category">Category of the metric</param>
 /// <param name="metricName">Name of the metric</param>
 /// <param name="value"></param>
 public static void Average(string category, string metricName, double value, MetricSetting advancedSettings = null)
 {
     var m = new Metric(category, metricName, MetricType.MetricAverage) { Value = value, Settings = advancedSettings };
     StackifyLib.Internal.Metrics.MetricClient.QueueMetric(m);
 }