public void updateMetrics() {
    recordMessagesConsumed(metricCollectors.currentConsumptionRate());
    recordTotalMessagesConsumed(metricCollectors.totalMessageConsumption());
    recordTotalBytesConsumed(metricCollectors.totalBytesConsumption());
    recordMessagesProduced(metricCollectors.currentProductionRate());
    recordMessageConsumptionByQueryStats(metricCollectors.currentConsumptionRateByQuery());
    recordErrorRate(metricCollectors.currentErrorRate());
  }
@Test
  public void shouldRecordMaxMessagesConsumedByQuery() {
    final int numMessagesConsumed = 500;
    consumeMessages(numMessagesConsumed, "group1");
    consumeMessages(numMessagesConsumed * 100, "group2");
    engineMetrics.updateMetrics();

    final double value = getMetricValue("messages-consumed-max");
    final double legacyValue = getMetricValueLegacy("messages-consumed-max");

    assertThat(Math.floor(value), closeTo(numMessagesConsumed, 5.0));
    assertThat(Math.floor(legacyValue), closeTo(numMessagesConsumed, 5.0));
  }