From c7d694fbce877ae93dd20ef1a901b737d27af74d Mon Sep 17 00:00:00 2001 From: Evan Anderson Date: Fri, 23 Oct 2020 09:41:25 -0700 Subject: [PATCH] Clean up isNewExporterRequired --- metrics/exporter.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/metrics/exporter.go b/metrics/exporter.go index 37602d5824..910bc9a8d2 100644 --- a/metrics/exporter.go +++ b/metrics/exporter.go @@ -181,17 +181,17 @@ func isNewExporterRequired(newConfig *metricsConfig) bool { return true } - // If the OpenCensus address has changed, restart the exporter. - // TODO(evankanderson): Should we just always restart the opencensus agent? - if newConfig.backendDestination == openCensus { + switch newConfig.backendDestination { + case openCensus: + // If the OpenCensus address has changed, restart the exporter. + // TODO(evankanderson): Should we just always restart the opencensus agent? return newConfig.collectorAddress != cc.collectorAddress || newConfig.requireSecure != cc.requireSecure - } - - if newConfig.backendDestination == prometheus { + case prometheus: return newConfig.prometheusPort != cc.prometheusPort + case stackdriver: + return newConfig.stackdriverClientConfig != cc.stackdriverClientConfig } - - return newConfig.backendDestination == stackdriver && newConfig.stackdriverClientConfig != cc.stackdriverClientConfig + return false } // newMetricsExporter gets a metrics exporter based on the config.