Search in sources :

Example 1 with HistogramSnapshot

use of com.navercorp.pinpoint.profiler.monitor.metric.rpc.HistogramSnapshot in project pinpoint by naver.

the class DefaultRpcMetricTest method testAddResponseTime.

@Test
public void testAddResponseTime() throws Exception {
    HistogramSchema schema = ASYNC_HTTP_CLIENT.getHistogramSchema();
    DefaultRpcMetric metric = new DefaultRpcMetric(ASYNC_HTTP_CLIENT);
    metric.addResponseTime("test1", schema.getFastSlot().getSlotTime(), false);
    metric.addResponseTime("test2", schema.getSlowSlot().getSlotTime(), false);
    metric.addResponseTime("test2", schema.getSlowSlot().getSlotTime(), false);
    metric.addResponseTime("test3", schema.getFastSlot().getSlotTime(), true);
    metric.addResponseTime("test3", schema.getFastSlot().getSlotTime(), true);
    metric.addResponseTime("test3", schema.getVerySlowSlot().getSlotTime(), true);
    List<HistogramSnapshot> snapshotList = metric.createSnapshotList();
    Assert.assertEquals(snapshotList.size(), 3);
}
Also used : HistogramSchema(com.navercorp.pinpoint.common.trace.HistogramSchema) DefaultRpcMetric(com.navercorp.pinpoint.profiler.monitor.metric.rpc.DefaultRpcMetric) HistogramSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.rpc.HistogramSnapshot) Test(org.junit.Test)

Example 2 with HistogramSnapshot

use of com.navercorp.pinpoint.profiler.monitor.metric.rpc.HistogramSnapshot in project pinpoint by naver.

the class HistogramTest method testAddResponseTime.

@Test
public void testAddResponseTime() throws Exception {
    HistogramSchema schema = ServiceType.STAND_ALONE.getHistogramSchema();
    LongAdderHistogram histogram = new LongAdderHistogram(ServiceType.STAND_ALONE);
    histogram.addResponseTime(1000, false);
    histogram.addResponseTime(3000, false);
    histogram.addResponseTime(3000, false);
    histogram.addResponseTime(5000, false);
    histogram.addResponseTime(5000, false);
    histogram.addResponseTime(5000, false);
    histogram.addResponseTime(6000, false);
    histogram.addResponseTime(6000, false);
    histogram.addResponseTime(6000, false);
    histogram.addResponseTime(6000, false);
    histogram.addResponseTime(schema.getFastSlot().getSlotTime(), true);
    histogram.addResponseTime(schema.getFastSlot().getSlotTime(), true);
    histogram.addResponseTime(schema.getFastSlot().getSlotTime(), true);
    histogram.addResponseTime(schema.getFastSlot().getSlotTime(), true);
    histogram.addResponseTime(schema.getFastSlot().getSlotTime(), true);
    HistogramSnapshot snapshot = histogram.createSnapshot();
    Assert.assertEquals(snapshot.getFastCount(), 1);
    Assert.assertEquals(snapshot.getNormalCount(), 2);
    Assert.assertEquals(snapshot.getSlowCount(), 3);
    Assert.assertEquals(snapshot.getVerySlowCount(), 4);
    Assert.assertEquals(snapshot.getFastErrorCount(), 5);
}
Also used : LongAdderHistogram(com.navercorp.pinpoint.profiler.monitor.metric.rpc.LongAdderHistogram) HistogramSchema(com.navercorp.pinpoint.common.trace.HistogramSchema) HistogramSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.rpc.HistogramSnapshot) Test(org.junit.Test)

Aggregations

HistogramSchema (com.navercorp.pinpoint.common.trace.HistogramSchema)2 HistogramSnapshot (com.navercorp.pinpoint.profiler.monitor.metric.rpc.HistogramSnapshot)2 Test (org.junit.Test)2 DefaultRpcMetric (com.navercorp.pinpoint.profiler.monitor.metric.rpc.DefaultRpcMetric)1 LongAdderHistogram (com.navercorp.pinpoint.profiler.monitor.metric.rpc.LongAdderHistogram)1