Beispiel #1
0
 /// <summary>
 /// Registers a new metric with the specified <paramref name="name"/> and returns the created metric. If a metric
 /// with the specified name already exists, the existing metric will be returned instead.
 /// </summary>
 /// <param name="name">The name of the metric.</param>
 /// <param name="groupName">The group name of the metric.</param>
 /// <param name="obsolete">Whether the metric is obsolete.</param>
 public static AnalyticsMetric Register(string name, string groupName, bool obsolete)
 {
     if (All.TryGetValue(name, out var metric))
     {
         return(metric);
     }
     metric = new AnalyticsMetric(name, groupName, obsolete);
     All.Add(metric.Name, metric);
     return(metric);
 }
 /// <summary>
 /// Adds the specified metric to the collection.
 /// </summary>
 /// <param name="metric">The metric to add.</param>
 public void Add(AnalyticsMetric metric)
 {
     _list.Add(metric);
 }
Beispiel #3
0
 /// <summary>
 /// Attempts to find metric with the specified <paramref name="name"/>.
 /// </summary>
 /// <param name="name">The name of the metric.</param>
 /// <param name="metric">The metric.</param>
 /// <returns><c>true</c> if the metric was found, otherwise <c>false</c>.</returns>
 public static bool TryGet(string name, out AnalyticsMetric metric)
 {
     return(All.TryGetValue(name, out metric));
 }