コード例 #1
0
        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)));
        }
コード例 #2
0
 public IGauge CreateGauge(string name, Dictionary <string, string> tags)
 {
     return(new InMemoryMetric(_gauges.GetOrAdd(MetricsImpl.AddTagsToMetricName(name, tags), _ => new AtomicLong())));
 }
コード例 #3
0
 public ITimer CreateTimer(string name, Dictionary <string, string> tags)
 {
     return(new InMemoryMetric(_timers.GetOrAdd(MetricsImpl.AddTagsToMetricName(name, tags), _ => new AtomicLong())));
 }
コード例 #4
0
 private long GetValue(IDictionary <string, AtomicLong> collection, string name, Dictionary <string, string> tags)
 {
     return(GetValue(collection, MetricsImpl.AddTagsToMetricName(name, tags)));
 }