private long GetValue(IDictionary <string, AtomicLong> collection, string name, string tags) { if (tags == null || tags.Length == 0) { return(GetValue(collection, name)); } string[] entries = tags.Split(','); Dictionary <string, string> tagsAsMap = new Dictionary <string, string>(entries.Length); foreach (string entry in entries) { string[] keyValue = entry.Split('='); if (keyValue.Length == 2) { tagsAsMap[keyValue[0]] = keyValue[1]; } else { tagsAsMap[keyValue[0]] = ""; } } return(GetValue(collection, MetricsImpl.AddTagsToMetricName(name, tagsAsMap))); }
public IGauge CreateGauge(string name, Dictionary <string, string> tags) { return(new InMemoryMetric(_gauges.GetOrAdd(MetricsImpl.AddTagsToMetricName(name, tags), _ => new AtomicLong()))); }
public ITimer CreateTimer(string name, Dictionary <string, string> tags) { return(new InMemoryMetric(_timers.GetOrAdd(MetricsImpl.AddTagsToMetricName(name, tags), _ => new AtomicLong()))); }
private long GetValue(IDictionary <string, AtomicLong> collection, string name, Dictionary <string, string> tags) { return(GetValue(collection, MetricsImpl.AddTagsToMetricName(name, tags))); }