From d4faf1e76c9714e78370c0ed29aa76c52b6ab8b0 Mon Sep 17 00:00:00 2001 From: Jonathan Harden Date: Tue, 19 Sep 2023 11:32:58 +0100 Subject: [PATCH] PP-11548: Update prometheus initialisation --- build-local.sh | 6 +++++- .../java/uk/gov/pay/adminusers/app/AdminUsersApp.java | 10 ++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/build-local.sh b/build-local.sh index 72dbe1731..e5182ecde 100755 --- a/build-local.sh +++ b/build-local.sh @@ -5,4 +5,8 @@ set -e cd "$(dirname "$0")" mvn -DskipITs clean verify -docker build -t govukpay/adminusers:local . +if [ "$(uname -m)" == "arm64" ]; then + docker build -t governmentdigitalservice/pay-adminusers:local -f m1/arm64.Dockerfile . +else + docker build -t governmentdigitalservice/pay-adminusers:local . +fi diff --git a/src/main/java/uk/gov/pay/adminusers/app/AdminUsersApp.java b/src/main/java/uk/gov/pay/adminusers/app/AdminUsersApp.java index 364b41a1c..e4e87304a 100644 --- a/src/main/java/uk/gov/pay/adminusers/app/AdminUsersApp.java +++ b/src/main/java/uk/gov/pay/adminusers/app/AdminUsersApp.java @@ -37,7 +37,6 @@ import uk.gov.pay.adminusers.resources.UserResource; import uk.gov.service.payments.commons.utils.healthchecks.DatabaseHealthCheck; import uk.gov.service.payments.commons.utils.metrics.DatabaseMetricsService; -import uk.gov.service.payments.commons.utils.prometheus.PrometheusDefaultLabelSampleBuilder; import uk.gov.service.payments.logging.GovUkPayDropwizardRequestJsonLogLayoutFactory; import uk.gov.service.payments.logging.LoggingFilter; import uk.gov.service.payments.logging.LogstashConsoleAppenderFactory; @@ -121,13 +120,8 @@ private void initialiseMetrics(AdminUsersConfig configuration, Environment envir .build() .scheduleAtFixedRate(metricsService::updateMetricData, 0, METRICS_COLLECTION_PERIOD_SECONDS / 2, TimeUnit.SECONDS); - configuration.getEcsContainerMetadataUriV4().ifPresent(uri -> initialisePrometheusMetrics(environment, uri)); - } - - private void initialisePrometheusMetrics(Environment environment, URI ecsContainerMetadataUri) { - logger.info("Initialising prometheus metrics."); - CollectorRegistry collectorRegistry = new CollectorRegistry(); - collectorRegistry.register(new DropwizardExports(environment.metrics(), new PrometheusDefaultLabelSampleBuilder(ecsContainerMetadataUri))); + CollectorRegistry collectorRegistry = CollectorRegistry.defaultRegistry; + collectorRegistry.register(new DropwizardExports(environment.metrics())); environment.admin().addServlet("prometheusMetrics", new MetricsServlet(collectorRegistry)).addMapping("/metrics"); }