Exemplo n.º 1
0
        private IEnumerable <KeyValuePair <TLabels, TMetric> > EnumerateLabelled()
        {
            if (_labelledMetrics == null)
            {
                yield break;
            }

            foreach (var labelled in _labelledMetrics)
            {
                yield return(new KeyValuePair <TLabels, TMetric>(LabelsHelper.FromArray <TLabels>(labelled.Value.LabelValues), labelled.Value));
            }
        }
Exemplo n.º 2
0
 public MetricFamily(TConfig configuration, MetricType metricType, Func <TConfig, IReadOnlyList <string>, TImplementation> instanceFactory)
 {
     _metricType      = metricType;
     _configuration   = configuration;
     _metricNames     = new[] { _configuration.Name };
     _instanceFactory = instanceFactory;
     _unlabelled      = _instanceFactory(_configuration, default);
     LabelNames       = LabelsHelper.FromArray <TLabels>(configuration.LabelNames);
     if (configuration.LabelNames.Count > 0)
     {
         _labelledMetrics = new ConcurrentDictionary <int, TImplementation>();
     }
 }