use of com.quorum.tessera.config.AppType in project tessera by ConsenSys.
the class PrometheusProtocolFormatterTest method singleArrayArgResourceResponseCorrectlyFormatted.
@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\n";
assertThat(protocolFormatter.format(mockMetrics, type)).isEqualTo(expectedResponse);
}
use of com.quorum.tessera.config.AppType in project tessera by ConsenSys.
the class PrometheusProtocolFormatterTest method multipleMetricsResponseCorrectlyFormatted.
@Test
public void multipleMetricsResponseCorrectlyFormatted() {
mockMetrics.add(new MBeanResourceMetric("GET->upCheck()#a10a4f8d", "AverageTime[ms]_total", "100"));
mockMetrics.add(new MBeanResourceMetric("POST->resend(ResendRequest)#8ca0a760", "RequestRate[requestsPerSeconds]", "1.3"));
AppType type = AppType.P2P;
String expectedResponse = "tessera_P2P_GET_upCheck_AverageTime_ms 100\n" + "tessera_P2P_POST_resend_ResendRequest_RequestRate_requestsPerSeconds 1.3\n";
assertThat(protocolFormatter.format(mockMetrics, type)).isEqualTo(expectedResponse);
}
use of com.quorum.tessera.config.AppType in project tessera by ConsenSys.
the class PrometheusProtocolFormatterTest method multipleArgResourceResponseCorrectlyFormatted.
@Test
public void multipleArgResourceResponseCorrectlyFormatted() {
mockMetrics.add(new MBeanResourceMetric("GET->receiveRaw(String;String)#fc8f8357", "AverageTime[ms]_total", "5.2"));
AppType type = AppType.P2P;
String expectedResponse = "tessera_P2P_GET_receiveRaw_StringString_AverageTime_ms 5.2\n";
assertThat(protocolFormatter.format(mockMetrics, type)).isEqualTo(expectedResponse);
}
use of com.quorum.tessera.config.AppType in project tessera by ConsenSys.
the class PrometheusProtocolFormatterTest method singleArgResourceResponseCorrectlyFormatted.
@Test
public void singleArgResourceResponseCorrectlyFormatted() {
mockMetrics.add(new MBeanResourceMetric("POST->resend(ResendRequest)#8ca0a760", "RequestRate[requestsPerSeconds]", "1.3"));
AppType type = AppType.P2P;
String expectedResponse = "tessera_P2P_POST_resend_ResendRequest_RequestRate_requestsPerSeconds 1.3\n";
assertThat(protocolFormatter.format(mockMetrics, type)).isEqualTo(expectedResponse);
}
use of com.quorum.tessera.config.AppType in project tessera by ConsenSys.
the class MetricsEnquirerTest method oneMBeanOneMetricEnclaveApp.
@Test
public void oneMBeanOneMetricEnclaveApp() throws MalformedObjectNameException, IntrospectionException, ReflectionException, AttributeNotFoundException, MBeanException, InstanceNotFoundException {
ObjectName mBeanName = new ObjectName("domain", "key", "value");
names.add(mBeanName);
AppType appType = AppType.ENCLAVE;
ObjectName objName = new ObjectName("org.glassfish.jersey:type=EnclaveApplication,subType=Resources,resource=com.quorum.tessera.*,executionTimes=RequestTimes,detail=methods,method=*");
when(mBeanServer.queryNames(objName, null)).thenReturn(names);
String attributeName = "name_total";
MBeanAttributeInfo[] mBeanAttributes = { new MBeanAttributeInfo(attributeName, "type", "desc", true, false, false) };
MBeanInfo mBeanInfo = new MBeanInfo(null, null, mBeanAttributes, null, null, null);
when(mBeanServer.getMBeanInfo(mBeanName)).thenReturn(mBeanInfo);
when(mBeanServer.getAttribute(any(ObjectName.class), any(String.class))).thenReturn(1);
List<MBeanMetric> metrics = metricsEnquirer.getMBeanMetrics(appType);
assertThat(metrics.size()).isEqualTo(1);
assertThat(metrics.get(0).getName()).isEqualTo("name_total");
}
Aggregations