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); }
public override Meter GetMeter(string name, string version = null) { if (string.IsNullOrEmpty(name)) { return(this.defaultMeter); } lock (this.lck) { var key = new MeterRegistryKey(name, version); if (!this.meterRegistry.TryGetValue(key, out var meter)) { meter = this.defaultMeter = new MeterSdk(name, this.metricProcessor); this.meterRegistry.Add(key, meter); } return(meter); } }