From cb0734145d3e1fea3bcd08faa3b810ad6ac07e44 Mon Sep 17 00:00:00 2001 From: Diaa Sami Date: Mon, 17 Jul 2023 15:47:58 +0200 Subject: [PATCH] remove old prometheus listener --- cmd/osbuild-composer/composer.go | 5 ----- test/cases/api.sh | 22 +--------------------- 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/cmd/osbuild-composer/composer.go b/cmd/osbuild-composer/composer.go index 79b6f75dd..3574abbd5 100644 --- a/cmd/osbuild-composer/composer.go +++ b/cmd/osbuild-composer/composer.go @@ -281,10 +281,6 @@ func (c *Composer) Start() error { // handler functions don't. mux.Handle(apiRouteV2+"/", c.api.V2(apiRouteV2)) - // Metrics handler attached to api mux to avoid a - // separate listener/socket - mux.Handle("/metrics", promhttp.Handler().(http.HandlerFunc)) - handler := http.Handler(mux) var err error if c.config.Koji.EnableJWT { @@ -296,7 +292,6 @@ func (c *Composer) Start() error { []string{ "/api/image-builder-composer/v2/openapi/?$", "/api/image-builder-composer/v2/errors/?$", - "/metrics/?$", }, mux) if err != nil { panic(err) diff --git a/test/cases/api.sh b/test/cases/api.sh index 66fcafcf1..e66c11b80 100755 --- a/test/cases/api.sh +++ b/test/cases/api.sh @@ -407,29 +407,11 @@ createReqFile # function collectMetrics(){ - METRICS_OUTPUT=$(curl \ - --cacert /etc/osbuild-composer/ca-crt.pem \ - --key /etc/osbuild-composer/client-key.pem \ - --cert /etc/osbuild-composer/client-crt.pem \ - https://localhost/metrics) + METRICS_OUTPUT=$(curl http://localhost:8008/metrics) echo "$METRICS_OUTPUT" | grep "^image_builder_composer_request_count.*path=\"/api/image-builder-composer/v2/compose\"" | cut -f2 -d' ' } -function testNewMetricsPort(){ - METRICS_OUTPUT1=$(curl \ - --cacert /etc/osbuild-composer/ca-crt.pem \ - --key /etc/osbuild-composer/client-key.pem \ - --cert /etc/osbuild-composer/client-crt.pem \ - https://localhost/metrics) - METRICS_OUTPUT2=$(curl http://localhost:8008/metrics) - - COMPOSES1=$(echo "$METRICS_OUTPUT1" | grep "^image_builder_composer_request_count.*path=\"/api/image-builder-composer/v2/compose\"" | cut -f2 -d' ') - COMPOSES2=$(echo "$METRICS_OUTPUT2" | grep "^image_builder_composer_request_count.*path=\"/api/image-builder-composer/v2/compose\"" | cut -f2 -d' ') - - test "$COMPOSES1" = "$COMPOSES2" -} - function sendCompose() { OUTPUT=$(mktemp) HTTPSTATUS=$(curl \ @@ -584,8 +566,6 @@ sudo "${CONTAINER_RUNTIME}" exec "${DB_CONTAINER_NAME}" psql -U postgres -d osbu "DELETE FROM jobs WHERE id = '$COMPOSE_ID'" sudo systemctl start "osbuild-remote-worker@localhost:8700.service" -testNewMetricsPort - # full integration case INIT_COMPOSES="$(collectMetrics)" sendCompose "$REQUEST_FILE"