diff --git a/gateleen-monitoring/src/main/java/org/swisspush/gateleen/monitoring/MonitoringHandler.java b/gateleen-monitoring/src/main/java/org/swisspush/gateleen/monitoring/MonitoringHandler.java index a4fe0ec95..efd5bca5f 100644 --- a/gateleen-monitoring/src/main/java/org/swisspush/gateleen/monitoring/MonitoringHandler.java +++ b/gateleen-monitoring/src/main/java/org/swisspush/gateleen/monitoring/MonitoringHandler.java @@ -353,7 +353,7 @@ public void stopRequestMetricTracking(final String metricName, long startTime, S if (metricName != null) { double duration = (System.nanoTime() - startTime) / 1000000d; vertx.eventBus().publish(getMonitoringAddress(), - new JsonObject().put(METRIC_NAME, prefix + "routing." + metricName + ".duration").put(METRIC_ACTION, "update").put("n", duration)); + new JsonObject().put(METRIC_NAME, prefix + "routing." + metricName + ".duration").put(METRIC_ACTION, "set").put("n", duration)); } updatePendingRequestCount(false); } @@ -389,7 +389,7 @@ public void updateLastUsedQueueSizeInformation(final String queue) { vertx.eventBus().request(getRedisquesAddress(), buildGetQueueItemsCountOperation(queue), (Handler>>) reply -> { if (reply.succeeded() && OK.equals(reply.result().body().getString(STATUS))) { final long count = reply.result().body().getLong(VALUE); - vertx.eventBus().publish(getMonitoringAddress(), new JsonObject().put(METRIC_NAME, prefix + LAST_USED_QUEUE_SIZE_METRIC).put(METRIC_ACTION, "update").put("n", count)); + vertx.eventBus().publish(getMonitoringAddress(), new JsonObject().put(METRIC_NAME, prefix + LAST_USED_QUEUE_SIZE_METRIC).put(METRIC_ACTION, "set").put("n", count)); } else { log.error("Error gathering queue size for queue '{}'", queue); } diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/core/monitoring/MonitoringTest.java b/gateleen-test/src/test/java/org/swisspush/gateleen/core/monitoring/MonitoringTest.java index b1bfa6ad3..91ae8fb5e 100644 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/core/monitoring/MonitoringTest.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/core/monitoring/MonitoringTest.java @@ -29,10 +29,6 @@ @RunWith(VertxUnitRunner.class) public class MonitoringTest extends AbstractTest { Logger log = LoggerFactory.getLogger(MonitoringTest.class); - - private static final long MAX_DURATION_THRESHOLD = 100; - private static final double MEAN_DURATION_THRESHOLD = 25.0; - /** * Overwrite RestAssured configuration */ @@ -95,17 +91,7 @@ public void testStorageMetrics(TestContext context) throws Exception { // read the jmx infos if (mbs.isRegistered(beanNameObject)) { - log.info(" > Min: {}", mbs.getAttribute(beanNameObject, "Min")); - log.info(" > Mean: {}", mbs.getAttribute(beanNameObject, "Mean")); - log.info(" > Max: {}", mbs.getAttribute(beanNameObject, "Max")); - log.info(" > Count: {}", mbs.getAttribute(beanNameObject, "Count")); - log.info(" > StdDev: {}", mbs.getAttribute(beanNameObject, "StdDev")); - - // check max threshold - context.assertTrue((Long) mbs.getAttribute(beanNameObject, "Max") <= MAX_DURATION_THRESHOLD, "'Max' should be below the threshold"); - - // checm mean threshold - context.assertTrue((Double) mbs.getAttribute(beanNameObject, "Mean") <= MEAN_DURATION_THRESHOLD, "'Mean' should be below the threshold"); + log.info(" > Value: {}", mbs.getAttribute(beanNameObject, "Value")); } else { context.fail("could not found mbean " + beanName); } diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/hook/HookQueueingStrategiesTest.java b/gateleen-test/src/test/java/org/swisspush/gateleen/hook/HookQueueingStrategiesTest.java index c09efccce..910484a07 100644 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/hook/HookQueueingStrategiesTest.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/hook/HookQueueingStrategiesTest.java @@ -78,18 +78,18 @@ public void testDiscardPayloadQueueingStrategy(TestContext context) { when().get("pushnotification/queuing/queues/") .then().assertThat() .body("queues", hasItem(queueName)); - given().urlEncodingEnabled(true).when().get("pushnotification/queuing/queues/" + queueName) + given().urlEncodingEnabled(false).when().get("pushnotification/queuing/queues/" + queueName) .then().assertThat() .body(queueName, hasSize(3)); // check that no queue items do have a payload - String responseIndex0 = given().urlEncodingEnabled(true) + String responseIndex0 = given().urlEncodingEnabled(false) .when().get("pushnotification/queuing/queues/" + queueName + "/0") .then().extract().response().asString(); - String responseIndex1 = given().urlEncodingEnabled(true) + String responseIndex1 = given().urlEncodingEnabled(false) .when().get("pushnotification/queuing/queues/" + queueName + "/1") .then().extract().response().asString(); - String responseIndex2 = given().urlEncodingEnabled(true) + String responseIndex2 = given().urlEncodingEnabled(false) .when().get("pushnotification/queuing/queues/" + queueName + "/2") .then().extract().response().asString(); @@ -147,7 +147,7 @@ public void testReducedPropagationQueueingStrategy(TestContext context) { .then().assertThat() .body("queues", hasItem(queueName)) .body("queues", not(hasItem(managerQueue))); - given().urlEncodingEnabled(true).when().get("pushnotification/queuing/queues/" + queueName) + given().urlEncodingEnabled(false).when().get("pushnotification/queuing/queues/" + queueName) .then().assertThat() .body(queueName, hasSize(3)); when().get("pushnotification/queuing/locks/") @@ -158,10 +158,10 @@ public void testReducedPropagationQueueingStrategy(TestContext context) { // after 5s an unlocked manager queue with a single queue item should exist and the original queue should be empty // and its lock should have been deleted Awaitility.await().untilAsserted(() -> when().get("pushnotification/queuing/queues/").then().assertThat().body("queues", hasItem(managerQueue))); - given().urlEncodingEnabled(true).when().get("pushnotification/queuing/queues/" + managerQueue) + given().urlEncodingEnabled(false).when().get("pushnotification/queuing/queues/" + managerQueue) .then().assertThat() .body(managerQueue, hasSize(1)); - given().urlEncodingEnabled(true).when().get("pushnotification/queuing/queues/" + queueName) + given().urlEncodingEnabled(false).when().get("pushnotification/queuing/queues/" + queueName) .then().assertThat() .body(queueName, empty()); @@ -181,7 +181,7 @@ public void testReducedPropagationQueueingStrategy(TestContext context) { .then().assertThat() .body("queues", hasItem(queueName)) .body("queues", hasItem(managerQueue)); - given().urlEncodingEnabled(true).when().get("pushnotification/queuing/queues/" + queueName) + given().urlEncodingEnabled(false).when().get("pushnotification/queuing/queues/" + queueName) .then().assertThat() .body(queueName, hasSize(2)); when().get("pushnotification/queuing/locks/") @@ -193,10 +193,10 @@ public void testReducedPropagationQueueingStrategy(TestContext context) { // and its lock should have been deleted TestUtils.waitSomeTime(5); Awaitility.await().untilAsserted(() -> when().get("pushnotification/queuing/queues/").then().assertThat().body("queues", hasItem(managerQueue))); - given().urlEncodingEnabled(true).when().get("pushnotification/queuing/queues/" + managerQueue) + given().urlEncodingEnabled(false).when().get("pushnotification/queuing/queues/" + managerQueue) .then().assertThat() .body(managerQueue, hasSize(1)); - given().urlEncodingEnabled(true).when().get("pushnotification/queuing/queues/" + queueName) + given().urlEncodingEnabled(false).when().get("pushnotification/queuing/queues/" + queueName) .then().assertThat() .body(queueName, empty());