Skip to content

Commit

Permalink
remove old prometheus listener
Browse files Browse the repository at this point in the history
  • Loading branch information
diaasami authored and croissanne committed Jul 19, 2023
1 parent 3cfde58 commit cb07341
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 26 deletions.
5 changes: 0 additions & 5 deletions cmd/osbuild-composer/composer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
Expand Down
22 changes: 1 addition & 21 deletions test/cases/api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit cb07341

Please sign in to comment.