Search in sources :

Example 1 with ScatterDataBuilder

use of com.navercorp.pinpoint.web.scatter.ScatterDataBuilder in project pinpoint by naver.

the class DotExtractor method getApplicationScatterData.

public Map<Application, ScatterData> getApplicationScatterData(long from, long to, int xGroupUnitMillis, int yGroupUnitMillis) {
    Map<Application, ScatterData> applicationScatterDataMap = new HashMap<>();
    for (Map.Entry<Application, List<Dot>> entry : this.dotMap.entrySet()) {
        Application application = entry.getKey();
        List<Dot> dotList = entry.getValue();
        ScatterDataBuilder scatterData = new ScatterDataBuilder(from, to, xGroupUnitMillis, yGroupUnitMillis);
        scatterData.addDot(dotList);
        applicationScatterDataMap.put(application, scatterData.build());
    }
    return applicationScatterDataMap;
}
Also used : HashMap(java.util.HashMap) Dot(com.navercorp.pinpoint.web.vo.scatter.Dot) ArrayList(java.util.ArrayList) List(java.util.List) ScatterDataBuilder(com.navercorp.pinpoint.web.scatter.ScatterDataBuilder) HashMap(java.util.HashMap) Map(java.util.Map) ScatterData(com.navercorp.pinpoint.web.scatter.ScatterData)

Example 2 with ScatterDataBuilder

use of com.navercorp.pinpoint.web.scatter.ScatterDataBuilder in project pinpoint by naver.

the class ScatterChartServiceImpl method selectScatterData.

@Override
public ScatterData selectScatterData(String applicationName, Range range, int xGroupUnit, int yGroupUnit, int limit, boolean backwardDirection) {
    Objects.requireNonNull(applicationName, "applicationName");
    Objects.requireNonNull(range, "range");
    LimitedScanResult<List<Dot>> scanResult = applicationTraceIndexDao.scanTraceScatterData(applicationName, range, limit, backwardDirection);
    ScatterDataBuilder builder = new ScatterDataBuilder(range.getFrom(), range.getTo(), xGroupUnit, yGroupUnit);
    builder.addDot(scanResult.getScanData());
    return builder.build();
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) ScatterDataBuilder(com.navercorp.pinpoint.web.scatter.ScatterDataBuilder)

Example 3 with ScatterDataBuilder

use of com.navercorp.pinpoint.web.scatter.ScatterDataBuilder in project pinpoint by naver.

the class ScatterChartServiceImpl method selectScatterData.

@Override
public ScatterData selectScatterData(List<TransactionId> transactionIdList, String applicationName, Range range, int xGroupUnit, int yGroupUnit, Filter<List<SpanBo>> filter) {
    Objects.requireNonNull(transactionIdList, "transactionIdList");
    Objects.requireNonNull(applicationName, "applicationName");
    Objects.requireNonNull(filter, "filter");
    final List<List<SpanBo>> traceList = traceDao.selectAllSpans(transactionIdList);
    populateAgentNameListOfList(traceList);
    ScatterDataBuilder scatterData = new ScatterDataBuilder(range.getFrom(), range.getTo(), xGroupUnit, yGroupUnit);
    for (List<SpanBo> trace : traceList) {
        if (!filter.include(trace)) {
            continue;
        }
        for (SpanBo span : trace) {
            if (applicationName.equals(span.getApplicationId())) {
                final TransactionId transactionId = span.getTransactionId();
                final Dot dot = new Dot(transactionId, span.getCollectorAcceptTime(), span.getElapsed(), span.getErrCode(), span.getAgentId());
                scatterData.addDot(dot);
            }
        }
    }
    return scatterData.build();
}
Also used : Dot(com.navercorp.pinpoint.web.vo.scatter.Dot) ArrayList(java.util.ArrayList) List(java.util.List) ScatterDataBuilder(com.navercorp.pinpoint.web.scatter.ScatterDataBuilder) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) TransactionId(com.navercorp.pinpoint.common.profiler.util.TransactionId)

Example 4 with ScatterDataBuilder

use of com.navercorp.pinpoint.web.scatter.ScatterDataBuilder in project pinpoint by naver.

the class HbaseApplicationTraceIndexDaoTest method scanTraceScatterDataTest.

@Test
public void scanTraceScatterDataTest() {
    List<List<Dot>> scatterDotList = createScatterDotList();
    when(this.hbaseOperations2.findParallel(any(TableName.class), any(Scan.class), any(AbstractRowKeyDistributor.class), anyInt(), any(RowMapper.class), anyInt())).thenReturn(scatterDotList);
    Range range = Range.newRange(1000L, 5000L);
    LimitedScanResult<List<Dot>> scanResult = this.applicationTraceIndexDao.scanTraceScatterData("app", range, 10, false);
    ScatterDataBuilder builder = new ScatterDataBuilder(range.getFrom(), range.getTo(), 1, 5);
    scanResult.getScanData().forEach(builder::addDot);
    ScatterData result = builder.build();
    Assert.assertEquals(1000L, result.getFrom());
    Assert.assertEquals(5000L, result.getTo());
    Assert.assertEquals(2000L, result.getOldestAcceptedTime());
    Assert.assertEquals(3000L, result.getLatestAcceptedTime());
}
Also used : TableName(org.apache.hadoop.hbase.TableName) AbstractRowKeyDistributor(com.sematext.hbase.wd.AbstractRowKeyDistributor) ArrayList(java.util.ArrayList) List(java.util.List) Scan(org.apache.hadoop.hbase.client.Scan) Range(com.navercorp.pinpoint.web.vo.Range) ScatterDataBuilder(com.navercorp.pinpoint.web.scatter.ScatterDataBuilder) ScatterData(com.navercorp.pinpoint.web.scatter.ScatterData) Test(org.junit.Test)

Example 5 with ScatterDataBuilder

use of com.navercorp.pinpoint.web.scatter.ScatterDataBuilder in project pinpoint by naver.

the class HbaseApplicationTraceIndexDaoTest method scanTraceScatterDataEmptyTest.

@Test
public void scanTraceScatterDataEmptyTest() {
    List<ScatterData> scannedList = new ArrayList<>();
    when(this.hbaseOperations2.findParallel(any(TableName.class), any(Scan.class), any(AbstractRowKeyDistributor.class), anyInt(), any(RowMapper.class), any(LimitEventHandler.class), anyInt())).thenReturn(scannedList);
    Range range = Range.newRange(1000L, 5000L);
    LimitedScanResult<List<Dot>> scanResult = this.applicationTraceIndexDao.scanTraceScatterData("app", range, 10, false);
    ScatterDataBuilder builder = new ScatterDataBuilder(range.getFrom(), range.getTo(), 1, 5);
    scanResult.getScanData().forEach(builder::addDot);
    ScatterData result = builder.build();
    Assert.assertEquals(1000L, result.getFrom());
    Assert.assertEquals(5000L, result.getTo());
    Assert.assertEquals(0, result.getScatterData().size());
}
Also used : ArrayList(java.util.ArrayList) AbstractRowKeyDistributor(com.sematext.hbase.wd.AbstractRowKeyDistributor) Range(com.navercorp.pinpoint.web.vo.Range) ScatterDataBuilder(com.navercorp.pinpoint.web.scatter.ScatterDataBuilder) TableName(org.apache.hadoop.hbase.TableName) Scan(org.apache.hadoop.hbase.client.Scan) ArrayList(java.util.ArrayList) List(java.util.List) ScatterData(com.navercorp.pinpoint.web.scatter.ScatterData) Test(org.junit.Test)

Aggregations

ScatterDataBuilder (com.navercorp.pinpoint.web.scatter.ScatterDataBuilder)5 ArrayList (java.util.ArrayList)5 List (java.util.List)5 ScatterData (com.navercorp.pinpoint.web.scatter.ScatterData)3 Range (com.navercorp.pinpoint.web.vo.Range)2 Dot (com.navercorp.pinpoint.web.vo.scatter.Dot)2 AbstractRowKeyDistributor (com.sematext.hbase.wd.AbstractRowKeyDistributor)2 TableName (org.apache.hadoop.hbase.TableName)2 Scan (org.apache.hadoop.hbase.client.Scan)2 Test (org.junit.Test)2 TransactionId (com.navercorp.pinpoint.common.profiler.util.TransactionId)1 SpanBo (com.navercorp.pinpoint.common.server.bo.SpanBo)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1