public static MeterFactory Create(Action <MeterBuilder> configure) { if (configure == null) { throw new ArgumentNullException(nameof(configure)); } var builder = new MeterBuilder(); configure(builder); return(new MeterFactory(builder)); }
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); }