remove old prometheus listener

This commit is contained in:
Diaa Sami 2023-07-17 15:47:58 +02:00 committed by Sanne Raymaekers
parent 3cfde5860d
commit cb0734145d
2 changed files with 1 additions and 26 deletions

View file

@ -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)

View file

@ -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"