public MetricsListener(MetricsListenerConfig listenerConfig, IMetricsProvider metricsProvider) { if (!(metricsProvider is MetricsProvider prometheusMetricsProvider)) { throw new ArgumentException($"IMetricsProvider of type {metricsProvider.GetType()} is incompatible with {this.GetType()}"); } this.listenerConfig = Preconditions.CheckNotNull(listenerConfig, nameof(listenerConfig)); this.metricServer = new MetricServer(listenerConfig.Host, listenerConfig.Port, listenerConfig.Suffix.Trim('/') + '/', prometheusMetricsProvider.DefaultRegistry); }