Example #1
0
 /// <summary>
 ///     Given a new <seealso cref="Gauge{T}" />, registers it under the given metric name.
 /// </summary>
 /// <param name="metricName">the name of the metric</param>
 /// <param name="metric">the metric</param>
 /// <typeparam name="T">the type of the value returned by the metric</typeparam>
 /// <returns>{@code metric}</returns>
 public Gauge<T> NewGauge<T>(
     MetricName metricName,
     Gauge<T> metric)
 {
     return GetOrAdd(metricName, metric);
 }
Example #2
0
 private void NotifyMetricAdded(
     MetricName name,
     Metric metric)
 {
     MetricAdded?.Invoke(this, new MetricsRegistryEventArgs(name, metric));
 }
Example #3
0
 /// <summary>
 ///     Creates a new <seealso cref="Counter" /> and registers it under the given metric name.
 /// </summary>
 /// <param name="metricName">the name of the metric</param>
 /// <returns>a new <seealso cref="Counter"/></returns>
 public Counter NewCounter(MetricName metricName)
 {
     return GetOrAdd(metricName, new Counter());
 }
Example #4
0
 private void NotifyMetricRemoved(MetricName name)
 {
     MetricRemoved?.Invoke(this, new MetricsRegistryEventArgs(name));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MetricsRegistryEventArgs"/> class.
 /// </summary>
 /// <param name="name">The name.</param>
 public MetricsRegistryEventArgs(MetricName name)
 {
     Name = name;
 }