Ejemplo n.º 1
0
 /// <summary>
 /// A timer is basically a histogram of the duration of a type of event and a meter of the rate of its occurrence.
 /// <seealso cref="Histogram"/> and <seealso cref="Meter"/>
 /// </summary>
 /// <param name="name">Name of the metric. Must be unique across all timers in this context.</param>
 /// <param name="unit">Description of what the is being measured ( Unit.Requests , Unit.Items etc ) .</param>
 /// <param name="samplingType">Type of the sampling to use (see SamplingType for details ).</param>
 /// <param name="rateUnit">Time unit for rates reporting. Defaults to Second ( occurrences / second ).</param>
 /// <param name="durationUnit">Time unit for reporting durations. Defaults to Milliseconds. </param>
 /// <param name="tags">Optional set of tags that can be associated with the metric.</param>
 /// <returns>Reference to the metric</returns>
 public static Timer Timer(string name, Unit unit, SamplingType samplingType = SamplingType.FavourRecent,
     TimeUnit rateUnit = TimeUnit.Seconds, TimeUnit durationUnit = TimeUnit.Milliseconds, MetricTags tags = default(MetricTags))
 {
     return globalContext.Timer(name, unit, samplingType, rateUnit, durationUnit, tags);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// A Histogram measures the distribution of values in a stream of data: e.g., the number of results returned by a search.
 /// </summary>
 /// <param name="name">Name of the metric. Must be unique across all histograms in this context.</param>
 /// <param name="unit">Description of what the is being measured ( Unit.Requests , Unit.Items etc ) .</param>
 /// <param name="samplingType">Type of the sampling to use (see SamplingType for details ).</param>
 /// <param name="tags">Optional set of tags that can be associated with the metric.</param>
 /// <returns>Reference to the metric</returns>
 public static Histogram Histogram(string name, Unit unit, SamplingType samplingType = SamplingType.FavourRecent, MetricTags tags = default(MetricTags))
 {
     return globalContext.Histogram(name, unit, samplingType, tags);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// A counter is a simple incrementing and decrementing 64-bit integer. Ex number of active requests.
 /// </summary>
 /// <param name="name">Name of the metric. Must be unique across all counters in this context.</param>
 /// <param name="unit">Description of what the is being measured ( Unit.Requests , Unit.Items etc ) .</param>
 /// <param name="tags">Optional set of tags that can be associated with the metric. Tags can be string array or comma separated values in a string.
 /// ex: tags: "tag1,tag2" or tags: new[] {"tag1", "tag2"}
 /// </param>
 /// <returns>Reference to the metric</returns>
 public static Counter Counter(string name, Unit unit, MetricTags tags = default(MetricTags))
 {
     return globalContext.Counter(name, unit, tags);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// A meter measures the rate at which a set of events occur, in a few different ways. 
 /// This metric is suitable for keeping a record of now often something happens ( error, request etc ).
 /// </summary>
 /// <remarks>
 /// The mean rate is the average rate of events. It’s generally useful for trivia, 
 /// but as it represents the total rate for your application’s entire lifetime (e.g., the total number of requests handled, 
 /// divided by the number of seconds the process has been running), it doesn’t offer a sense of recency. 
 /// Luckily, meters also record three different exponentially-weighted moving average rates: the 1-, 5-, and 15-minute moving averages.
 /// </remarks>
 /// <param name="name">Name of the metric. Must be unique across all meters in this context.</param>
 /// <param name="unit">Description of what the is being measured ( Unit.Requests , Unit.Items etc ) .</param>
 /// <param name="rateUnit">Time unit for rates reporting. Defaults to Second ( occurrences / second ).</param>
 /// <param name="tags">Optional set of tags that can be associated with the metric.</param>
 /// <returns>Reference to the metric</returns>
 public static Meter Meter(string name, Unit unit, TimeUnit rateUnit = TimeUnit.Seconds, MetricTags tags = default(MetricTags))
 {
     return globalContext.Meter(name, unit, rateUnit, tags);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// A gauge is the simplest metric type. It just returns a value. This metric is suitable for instantaneous values.
 /// </summary>
 /// <param name="name">Name of this gauge metric. Must be unique across all gauges in this context.</param>
 /// <param name="valueProvider">Function that returns the value for the gauge.</param>
 /// <param name="unit">Description of want the value represents ( Unit.Requests , Unit.Items etc ) .</param>
 /// <param name="tags">Optional set of tags that can be associated with the metric.</param>
 /// <returns>Reference to the gauge</returns>
 public static void Gauge(string name, Func<double> valueProvider, Unit unit, MetricTags tags = default(MetricTags))
 {
     globalContext.Gauge(name, valueProvider, unit, tags);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Register a performance counter as a Gauge metric.
 /// </summary>
 /// <param name="name">Name of this gauge metric. Must be unique across all gauges in this context.</param>
 /// <param name="counterCategory">Category of the performance counter</param>
 /// <param name="counterName">Name of the performance counter</param>
 /// <param name="counterInstance">Instance of the performance counter</param>
 /// <param name="unit">Description of want the value represents ( Unit.Requests , Unit.Items etc ) .</param>
 /// <param name="tags">Optional set of tags that can be associated with the metric.</param>
 /// <returns>Reference to the gauge</returns>
 public static void PerformanceCounter(string name, string counterCategory, string counterName, string counterInstance, Unit unit, MetricTags tags = default(MetricTags))
 {
     globalContext.PerformanceCounter(name, counterCategory, counterName, counterInstance, unit, tags);
 }