internal MeterProviderSdk(MetricProcessor metricProcessor, Dictionary <MeterRegistryKey, MeterSdk> registry, PushMetricController controller, CancellationTokenSource cts)
 {
     this.MetricProcessor         = metricProcessor;
     this.PushMetricController    = controller;
     this.CancellationTokenSource = cts;
     this.defaultMeter            = new MeterSdk(string.Empty, this.MetricProcessor);
     this.MeterRegistry           = registry;
     this.MeterRegistry.Add(new MeterRegistryKey(string.Empty, null), this.defaultMeter);
 }
Пример #2
0
        internal MeterProviderBuilderSdk AddMetricProcessor(MetricProcessor processor)
        {
            if (this.MetricProcessors.Count >= 1)
            {
                throw new InvalidOperationException("Only one MetricProcessor is allowed.");
            }

            this.MetricProcessors.Add(processor);
            return(this);
        }
        private MeterFactory(MeterBuilder meterBuilder)
        {
            this.metricProcessor = meterBuilder.MetricProcessor ?? new NoOpMetricProcessor();
            this.metricExporter  = meterBuilder.MetricExporter ?? new NoOpMetricExporter();

            // We only have PushMetricController now with only configurable thing being the push interval
            this.PushMetricController = new PushMetricController(
                this.meterRegistry,
                this.metricProcessor,
                this.metricExporter,
                meterBuilder.MetricPushInterval == default(TimeSpan) ? this.defaultPushInterval : meterBuilder.MetricPushInterval,
                new CancellationTokenSource());

            this.defaultMeter = new MeterSdk(string.Empty, this.metricProcessor);
            this.meterRegistry.Add(new MeterRegistryKey(string.Empty, null), this.defaultMeter);
        }
Пример #4
0
 public CounterHandleSDK(string metricName, LabelSet labelset, MetricProcessor <T> metricProcessor) : this()
 {
     this.metricProcessor = metricProcessor;
     this.labelset        = labelset;
 }
Пример #5
0
 internal MeterSDK(string meterName, MetricProcessor metricProcessor)
 {
     this.meterName       = meterName;
     this.metricProcessor = metricProcessor;
 }
Пример #6
0
 /// <summary>
 /// Configures metric processor. (aka batcher).
 /// </summary>
 /// <param name="metricProcessor">MetricProcessor instance.</param>
 /// <returns>The meter builder instance for chaining.</returns>
 public MeterBuilder SetMetricProcessor(MetricProcessor metricProcessor)
 {
     this.MetricProcessor = metricProcessor;
     return(this);
 }
        /// <summary>
        /// Add metric processor.
        /// </summary>
        /// <param name="meterProviderBuilder"><see cref="MeterProviderBuilder"/>.</param>
        /// <param name="processor">Measurement Processors.</param>
        /// <returns><see cref="MeterProvider"/>.</returns>
        public static MeterProviderBuilder AddMetricProcessor(this MeterProviderBuilder meterProviderBuilder, MetricProcessor processor)
        {
            if (meterProviderBuilder is MeterProviderBuilderSdk meterProviderBuilderSdk)
            {
                return(meterProviderBuilderSdk.AddMetricProcessor(processor));
            }

            return(meterProviderBuilder);
        }
 /// <summary>
 /// Sets processor.
 /// </summary>
 /// <param name="processor">Processor instance.</param>
 /// <returns>Returns <see cref="MeterProviderBuilder"/> for chaining.</returns>
 public MeterProviderBuilder SetProcessor(MetricProcessor processor)
 {
     this.metricProcessor = processor ?? new NoopMetricProcessor();
     return(this);
 }
 internal MeterProviderBuilder()
 {
     this.metricExporter     = new NoopMetricExporter();
     this.metricProcessor    = new NoopMetricProcessor();
     this.metricPushInterval = DefaultPushInterval;
 }
Пример #10
0
 public CounterSDK(string name, MetricProcessor <T> metricProcessor) : this()
 {
     this.metricName      = name;
     this.metricProcessor = metricProcessor;
 }