Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix daily runs: Adapt to the new format of Prometheus metrics #990

Merged
merged 1 commit into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@

import io.quarkus.test.bootstrap.KeycloakService;
import io.quarkus.test.bootstrap.RestService;
import io.quarkus.test.scenarios.annotations.DisabledOnQuarkusVersion;
import io.quarkus.test.services.KeycloakContainer;

@DisabledOnQuarkusVersion(version = "(2\\.[2-9]\\..*)|(2\\.1[0-5]\\..*)", reason = "Fixed in Quarkus 2.16")
public abstract class BaseMicrometerOidcSecurityIT {

static final String NORMAL_USER = "test-normal-user";
Expand All @@ -24,8 +26,8 @@ public abstract class BaseMicrometerOidcSecurityIT {
static final int ASSERT_SERVICE_TIMEOUT_MINUTES = 1;
static final String USER_PATH = "/user";
static final String HTTP_METRIC = "http_server_requests_seconds_count{method=\"GET\",";
static final String OK_HTTP_CALL_METRIC = HTTP_METRIC + "outcome=\"SUCCESS\",status=\"200\",uri=\"%s\",}";
static final String UNAUTHORIZED_HTTP_CALL_METRIC = HTTP_METRIC + "outcome=\"CLIENT_ERROR\",status=\"401\",uri=\"%s\",}";
static final String OK_HTTP_CALL_METRIC = HTTP_METRIC + "outcome=\"SUCCESS\",status=\"200\",uri=\"%s\"}";
static final String UNAUTHORIZED_HTTP_CALL_METRIC = HTTP_METRIC + "outcome=\"CLIENT_ERROR\",status=\"401\",uri=\"%s\"}";

//TODO Remove workaround after Keycloak is fixed https://github.com/keycloak/keycloak/issues/9916
@KeycloakContainer(command = { "start-dev --import-realm" })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ public class HttpServerMetricsIT {
private static final int ASSERT_METRICS_TIMEOUT_MINUTES = 1;
private static final List<String> HTTP_SERVER_REQUESTS_METRICS_SUFFIX = Arrays.asList("count", "sum", "max");

private static final String HTTP_SERVER_REQUESTS_METRICS_FORMAT = "http_server_requests_seconds_%s{method=\"GET\",outcome=\"SUCCESS\",status=\"200\",uri=\"%s\",}";
/*
* In versions before 2.16 metrics have format '{a,b,}' (with trailing comma)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

* Starting from 2.16 the format changed to '{a,b}'
* See https://github.com/quarkusio/quarkus/issues/30343 for details
* TODO: add '}' to the end, when this stabilizes
*/
private static final String HTTP_SERVER_REQUESTS_METRICS_FORMAT = "http_server_requests_seconds_%s{method=\"GET\",outcome=\"SUCCESS\",status=\"200\",uri=\"%s\"";
private static final String PING_PONG_ENDPOINT = "/without-metrics-pingpong";

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,20 @@
import org.junit.jupiter.api.Test;

import io.quarkus.test.scenarios.QuarkusScenario;
import io.quarkus.test.scenarios.annotations.DisabledOnQuarkusVersion;
import io.restassured.response.ValidatableResponse;
import io.restassured.specification.RequestSpecification;

@QuarkusScenario
@DisabledOnQuarkusVersion(version = "(2\\.[2-9]\\..*)|(2\\.1[0-5]\\..*)", reason = "Fixed in Quarkus 2.16")
public class MicroProfileApiIT {

private static final String PING_PONG = "ping pong";
private static final String PING_PONG_ENDPOINT = "/using-microprofile-pingpong";
private static final String COUNTER_FORMAT = "simple_counter_mp_total{scope=\"application\",} %s.0";
private static final String FIRST_GAUGE_FORMAT = "first_gauge_mp{scope=\"application\",} %s";
private static final String SECOND_GAUGE_FORMAT = "second_gauge_mp{scope=\"application\",} %s";
private static final String THIRD_GAUGE_FORMAT = "getThirdGauge{scope=\"application\",} %s";
private static final String COUNTER_FORMAT = "simple_counter_mp_total{scope=\"application\"} %s.0";
private static final String FIRST_GAUGE_FORMAT = "first_gauge_mp{scope=\"application\"} %s";
private static final String SECOND_GAUGE_FORMAT = "second_gauge_mp{scope=\"application\"} %s";
private static final String THIRD_GAUGE_FORMAT = "getThirdGauge{scope=\"application\"} %s";
private static final long DEFAULT_GAUGE_VALUE = 100;
private static final long GAUGE_INCREMENT = 1;

Expand Down