/// <summary>
        /// Counters only increase in value and reset to zero when the process restarts.
        /// </summary>
        public Counter CreateCounter(string name, string help, CounterConfiguration configuration = null)
        {
            configuration = configuration ?? CounterConfiguration.Default;

            var metric = new Counter(name, help, configuration.LabelNames, configuration.SuppressInitialValue);

            return((Counter)_registry.GetOrAdd(metric));
        }
        public CounterGroupQuery(string name, string description, string query, IEnumerable <Column> labelColumns, Column valueColumn, MetricFactory metricFactory, int?millisecondTimeout)
        {
            Name = name;
            this._description  = description;
            Query              = query;
            this._valueColumn  = valueColumn;
            MillisecondTimeout = millisecondTimeout;
            this._labelColumns = labelColumns.OrderBy(x => x.Order).ToArray();

            var counterConfiguration = new Prometheus.CounterConfiguration
            {
                LabelNames = this._labelColumns.Select(x => x.Label).ToArray()
            };

            _counter = metricFactory.CreateCounter(name, description, counterConfiguration);
        }
 public static Counter CreateCounter(string name, string help, CounterConfiguration configuration) =>
 DefaultFactory.CreateCounter(name, help, configuration);
示例#4
0
 /// <summary>
 /// Counters only increase in value and reset to zero when the process restarts.
 /// </summary>
 public Counter CreateCounter(string name, string help, CounterConfiguration configuration = null)
 {
     return(_registry.GetOrAdd(new CollectorRegistry.CollectorInitializer <Counter, CounterConfiguration>(
                                   (n, h, config) => new Counter(n, h, config.LabelNames, config.SuppressInitialValue),
                                   name, help, configuration ?? CounterConfiguration.Default)));
 }