@Test public void singleArrayArgResourceResponseCorrectlyFormatted() { mockMetrics.add(new MBeanResourceMetric("POST->push(byte[])#7f702b7e", "MinTime[ms]_total", "3.4")); AppType type = AppType.P2P; String expectedResponse = "tessera_P2P_POST_push_byte_MinTime_ms 3.4"; assertThat(protocolFormatter.format(mockMetrics, type)).isEqualTo(expectedResponse); }
public String format(final List<MBeanMetric> metrics, AppType appType) { StringBuilder formattedMetrics = new StringBuilder(); for (final MBeanMetric metric : metrics) { final MBeanResourceMetric resourceMetric = (MBeanResourceMetric) metric; formattedMetrics.append("tessera_") .append(appType) .append("_") .append(sanitize(resourceMetric.getResourceMethod())) .append("_") .append(sanitize(resourceMetric.getName())) .append(" ") .append(resourceMetric.getValue()) .append("\n"); } return formattedMetrics.toString().trim(); }
PrometheusProtocolFormatter { public String format(final List<MBeanMetric> metrics, AppType appType) { StringBuilder formattedMetrics = new StringBuilder(); for (final MBeanMetric metric : metrics) { final MBeanResourceMetric resourceMetric = (MBeanResourceMetric) metric; formattedMetrics.append("tessera_") .append(appType) .append("_") .append(sanitize(resourceMetric.getResourceMethod())) .append("_") .append(sanitize(resourceMetric.getName())) .append(" ") .append(resourceMetric.getValue()) .append("\n"); } return formattedMetrics.toString().trim(); } }
PrometheusProtocolFormatter { public String format(final List<MBeanMetric> metrics, AppType appType) { StringBuilder formattedMetrics = new StringBuilder(); for (final MBeanMetric metric : metrics) { final MBeanResourceMetric resourceMetric = (MBeanResourceMetric) metric; formattedMetrics.append("tessera_") .append(appType) .append("_") .append(sanitize(resourceMetric.getResourceMethod())) .append("_") .append(sanitize(resourceMetric.getName())) .append(" ") .append(resourceMetric.getValue()) .append("\n"); } return formattedMetrics.toString().trim(); }  }
PrometheusProtocolFormatter { public String format(final List<MBeanMetric> metrics, AppType appType) { StringBuilder formattedMetrics = new StringBuilder(); for (final MBeanMetric metric : metrics) { final MBeanResourceMetric resourceMetric = (MBeanResourceMetric) metric; formattedMetrics.append("tessera_") .append(appType) .append("_") .append(sanitize(resourceMetric.getResourceMethod())) .append("_") .append(sanitize(resourceMetric.getName())) .append(" ") .append(resourceMetric.getValue()) .append("\n"); } return formattedMetrics.toString().trim(); }  String format(final List<MBeanMetric> metrics, AppType appType); }
PrometheusProtocolFormatter { public String format(final List<MBeanMetric> metrics, AppType appType) { StringBuilder formattedMetrics = new StringBuilder(); for (final MBeanMetric metric : metrics) { final MBeanResourceMetric resourceMetric = (MBeanResourceMetric) metric; formattedMetrics.append("tessera_") .append(appType) .append("_") .append(sanitize(resourceMetric.getResourceMethod())) .append("_") .append(sanitize(resourceMetric.getName())) .append(" ") .append(resourceMetric.getValue()) .append("\n"); } return formattedMetrics.toString().trim(); }  String format(final List<MBeanMetric> metrics, AppType appType);  }