Search in sources :

Example 6 with JoinActiveTraceBo

use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinActiveTraceBo in project pinpoint by naver.

the class ActiveTraceCodec method encodeValues.

@Override
public void encodeValues(Buffer valueBuffer, List<JoinStatBo> joinActiveTraceBoList) {
    if (CollectionUtils.isEmpty(joinActiveTraceBoList)) {
        throw new IllegalArgumentException("JoinActiveTraceBoList must not be empty");
    }
    final int numValues = joinActiveTraceBoList.size();
    valueBuffer.putVInt(numValues);
    List<Long> timestamps = new ArrayList<>(numValues);
    UnsignedShortEncodingStrategy.Analyzer.Builder versionAnalyzerBuilder = new UnsignedShortEncodingStrategy.Analyzer.Builder();
    UnsignedIntegerEncodingStrategy.Analyzer.Builder schemaTypeAnalyzerBuilder = new UnsignedIntegerEncodingStrategy.Analyzer.Builder();
    JoinIntFieldStrategyAnalyzer.Builder totalCountAnalyzerBuilder = new JoinIntFieldStrategyAnalyzer.Builder();
    for (JoinStatBo joinStatBo : joinActiveTraceBoList) {
        JoinActiveTraceBo joinActiveTraceBo = (JoinActiveTraceBo) joinStatBo;
        timestamps.add(joinActiveTraceBo.getTimestamp());
        versionAnalyzerBuilder.addValue(joinActiveTraceBo.getVersion());
        schemaTypeAnalyzerBuilder.addValue(joinActiveTraceBo.getHistogramSchemaType());
        totalCountAnalyzerBuilder.addValue(joinActiveTraceBo.getTotalCountJoinValue());
    }
    codec.encodeTimestamps(valueBuffer, timestamps);
    encodeDataPoints(valueBuffer, versionAnalyzerBuilder.build(), schemaTypeAnalyzerBuilder.build(), totalCountAnalyzerBuilder.build());
}
Also used : JoinIntFieldStrategyAnalyzer(com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinIntFieldStrategyAnalyzer) UnsignedIntegerEncodingStrategy(com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.UnsignedIntegerEncodingStrategy) ArrayList(java.util.ArrayList) JoinStatBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo) JoinIntFieldStrategyAnalyzer(com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinIntFieldStrategyAnalyzer) StrategyAnalyzer(com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.StrategyAnalyzer) JoinActiveTraceBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinActiveTraceBo) UnsignedShortEncodingStrategy(com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.UnsignedShortEncodingStrategy)

Example 7 with JoinActiveTraceBo

use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinActiveTraceBo in project pinpoint by naver.

the class ActiveTraceCodec method decodeValues.

@Override
public List<JoinStatBo> decodeValues(Buffer valueBuffer, ApplicationStatDecodingContext decodingContext) {
    final String id = decodingContext.getApplicationId();
    final long baseTimestamp = decodingContext.getBaseTimestamp();
    final long timestampDelta = decodingContext.getTimestampDelta();
    final long initialTimestamp = baseTimestamp + timestampDelta;
    int numValues = valueBuffer.readVInt();
    List<Long> timestampList = this.codec.decodeTimestamps(initialTimestamp, valueBuffer, numValues);
    final byte[] header = valueBuffer.readPrefixedBytes();
    AgentStatHeaderDecoder headerDecoder = new BitCountingHeaderDecoder(header);
    EncodingStrategy<Short> versionEncodingStrategy = UnsignedShortEncodingStrategy.getFromCode(headerDecoder.getCode());
    EncodingStrategy<Integer> schemaTypeEncodingStrategy = UnsignedIntegerEncodingStrategy.getFromCode(headerDecoder.getCode());
    JoinIntFieldEncodingStrategy totalCountJoinIntValueEncodingStrategy = JoinIntFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode());
    List<Short> versionList = this.codec.decodeValues(valueBuffer, versionEncodingStrategy, numValues);
    List<Integer> schemaTypeList = this.codec.decodeValues(valueBuffer, schemaTypeEncodingStrategy, numValues);
    List<JoinIntFieldBo> totalCountJoinIntValueList = this.codec.decodeValues(valueBuffer, totalCountJoinIntValueEncodingStrategy, numValues);
    List<JoinStatBo> joinActiveTraceBoList = new ArrayList<>();
    for (int i = 0; i < numValues; i++) {
        JoinActiveTraceBo joinActiveTraceBo = new JoinActiveTraceBo();
        joinActiveTraceBo.setId(id);
        joinActiveTraceBo.setVersion(versionList.get(i));
        joinActiveTraceBo.setTimestamp(timestampList.get(i));
        joinActiveTraceBo.setHistogramSchemaType(schemaTypeList.get(i));
        joinActiveTraceBo.setTotalCountJoinValue(totalCountJoinIntValueList.get(i));
        joinActiveTraceBoList.add(joinActiveTraceBo);
    }
    return joinActiveTraceBoList;
}
Also used : BitCountingHeaderDecoder(com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder) ArrayList(java.util.ArrayList) JoinStatBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo) AgentStatHeaderDecoder(com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder) JoinIntFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo) JoinActiveTraceBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinActiveTraceBo) JoinIntFieldEncodingStrategy(com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinIntFieldEncodingStrategy)

Example 8 with JoinActiveTraceBo

use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinActiveTraceBo in project pinpoint by naver.

the class JoinAgentStatBoMapperTest method map4Test.

@Test
public void map4Test() {
    final String agentId = "testAgent";
    final JoinAgentStatBoMapper joinAgentStatBoMapper = new JoinAgentStatBoMapper();
    final TFAgentStatBatch tFAgentStatBatch = new TFAgentStatBatch();
    tFAgentStatBatch.setStartTimestamp(1491274138454L);
    tFAgentStatBatch.setAgentId(agentId);
    final TFAgentStat tFAgentStat = new TFAgentStat();
    tFAgentStat.setAgentId(agentId);
    tFAgentStat.setTimestamp(1491274148454L);
    final TFActiveTraceHistogram tFActiveTraceHistogram = new TFActiveTraceHistogram();
    List<Integer> activeTraceCount = new ArrayList<>(4);
    activeTraceCount.add(10);
    activeTraceCount.add(20);
    activeTraceCount.add(40);
    activeTraceCount.add(50);
    tFActiveTraceHistogram.setVersion((short) 2);
    tFActiveTraceHistogram.setHistogramSchemaType(1);
    tFActiveTraceHistogram.setActiveTraceCount(activeTraceCount);
    final TFActiveTrace tfActiveTrace = new TFActiveTrace();
    tfActiveTrace.setHistogram(tFActiveTraceHistogram);
    tFAgentStat.setActiveTrace(tfActiveTrace);
    final TFAgentStat tFAgentStat2 = new TFAgentStat();
    tFAgentStat2.setAgentId(agentId);
    tFAgentStat2.setTimestamp(1491275148454L);
    tFAgentStat2.setCollectInterval(5000);
    final TFActiveTraceHistogram tFActiveTraceHistogram2 = new TFActiveTraceHistogram();
    List<Integer> activeTraceCount2 = new ArrayList<>(4);
    activeTraceCount2.add(11);
    activeTraceCount2.add(21);
    activeTraceCount2.add(41);
    activeTraceCount2.add(51);
    tFActiveTraceHistogram2.setVersion((short) 2);
    tFActiveTraceHistogram2.setHistogramSchemaType(1);
    tFActiveTraceHistogram2.setActiveTraceCount(activeTraceCount2);
    final TFActiveTrace tfActiveTrace2 = new TFActiveTrace();
    tfActiveTrace2.setHistogram(tFActiveTraceHistogram2);
    tFAgentStat2.setActiveTrace(tfActiveTrace2);
    final List<TFAgentStat> tFAgentStatList = new ArrayList<>(2);
    tFAgentStatList.add(tFAgentStat);
    tFAgentStatList.add(tFAgentStat2);
    tFAgentStatBatch.setAgentStats(tFAgentStatList);
    JoinAgentStatBo joinAgentStatBo = joinAgentStatBoMapper.map(tFAgentStatBatch);
    assertEquals(joinAgentStatBo.getId(), agentId);
    assertEquals(joinAgentStatBo.getAgentStartTimestamp(), 1491274138454L);
    assertEquals(joinAgentStatBo.getTimestamp(), 1491274148454L);
    List<JoinActiveTraceBo> joinActiveTraceBoList = joinAgentStatBo.getJoinActiveTraceBoList();
    assertEquals(joinActiveTraceBoList.size(), 2);
    JoinActiveTraceBo joinActiveTraceBo = joinActiveTraceBoList.get(0);
    assertEquals(joinActiveTraceBo.getId(), agentId);
    assertEquals(joinActiveTraceBo.getTimestamp(), 1491274148454L);
    assertEquals(joinActiveTraceBo.getVersion(), 2);
    assertEquals(joinActiveTraceBo.getHistogramSchemaType(), 1);
    assertEquals(joinActiveTraceBo.getTotalCountJoinValue(), new JoinIntFieldBo(120, 120, agentId, 120, agentId));
    JoinActiveTraceBo joinActiveTraceBo2 = joinActiveTraceBoList.get(1);
    assertEquals(joinActiveTraceBo2.getId(), agentId);
    assertEquals(joinActiveTraceBo2.getTimestamp(), 1491275148454L);
    assertEquals(joinActiveTraceBo2.getVersion(), 2);
    assertEquals(joinActiveTraceBo2.getHistogramSchemaType(), 1);
    assertEquals(joinActiveTraceBo2.getTotalCountJoinValue(), new JoinIntFieldBo(124, 124, agentId, 124, agentId));
}
Also used : ArrayList(java.util.ArrayList) TFAgentStat(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat) TFAgentStatBatch(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch) JoinAgentStatBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo) JoinIntFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo) TFActiveTraceHistogram(com.navercorp.pinpoint.thrift.dto.flink.TFActiveTraceHistogram) JoinActiveTraceBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinActiveTraceBo) TFActiveTrace(com.navercorp.pinpoint.thrift.dto.flink.TFActiveTrace) Test(org.junit.Test)

Example 9 with JoinActiveTraceBo

use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinActiveTraceBo in project pinpoint by naver.

the class JoinThriftActiveTraceBoMapperTest method mapTest.

@Test
public void mapTest() throws Exception {
    final TFAgentStat tFAgentStat = new TFAgentStat();
    final String id = "testAgent";
    tFAgentStat.setAgentId(id);
    tFAgentStat.setTimestamp(1491274148454L);
    final TFActiveTraceHistogram tFActiveTraceHistogram = new TFActiveTraceHistogram();
    List<Integer> activeTraceCount = new ArrayList<>(4);
    activeTraceCount.add(10);
    activeTraceCount.add(20);
    activeTraceCount.add(40);
    activeTraceCount.add(50);
    tFActiveTraceHistogram.setVersion((short) 2);
    tFActiveTraceHistogram.setHistogramSchemaType(1);
    tFActiveTraceHistogram.setActiveTraceCount(activeTraceCount);
    final TFActiveTrace tFActiveTrace = new TFActiveTrace();
    tFActiveTrace.setHistogram(tFActiveTraceHistogram);
    tFAgentStat.setActiveTrace(tFActiveTrace);
    final JoinActiveTraceBoMapper joinActiveTraceBoMapper = new JoinActiveTraceBoMapper();
    final JoinActiveTraceBo joinActiveTraceBo = joinActiveTraceBoMapper.map(tFAgentStat);
    assertNotNull(joinActiveTraceBo);
    assertEquals(joinActiveTraceBo.getId(), id);
    assertEquals(joinActiveTraceBo.getTimestamp(), 1491274148454L);
    assertEquals(joinActiveTraceBo.getVersion(), 2);
    assertEquals(joinActiveTraceBo.getHistogramSchemaType(), 1);
    assertEquals(joinActiveTraceBo.getTotalCountJoinValue(), new JoinIntFieldBo(120, 120, id, 120, id));
}
Also used : JoinIntFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo) TFActiveTraceHistogram(com.navercorp.pinpoint.thrift.dto.flink.TFActiveTraceHistogram) JoinActiveTraceBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinActiveTraceBo) ArrayList(java.util.ArrayList) TFActiveTrace(com.navercorp.pinpoint.thrift.dto.flink.TFActiveTrace) TFAgentStat(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat) Test(org.junit.Test)

Example 10 with JoinActiveTraceBo

use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinActiveTraceBo in project pinpoint by naver.

the class JoinActiveTraceBoMapper method map.

@Override
public JoinActiveTraceBo map(TFAgentStat tFAgentStat) {
    if (!tFAgentStat.isSetActiveTrace()) {
        return JoinActiveTraceBo.EMPTY_JOIN_ACTIVE_TRACE_BO;
    }
    final TFActiveTrace tFactiveTrace = tFAgentStat.getActiveTrace();
    final String agentId = tFAgentStat.getAgentId();
    if (tFactiveTrace.isSetHistogram() == false) {
        return JoinActiveTraceBo.EMPTY_JOIN_ACTIVE_TRACE_BO;
    }
    final TFActiveTraceHistogram histogram = tFactiveTrace.getHistogram();
    final int totalCount = calculateTotalCount(tFactiveTrace.getHistogram());
    JoinActiveTraceBo joinActiveTraceBo = new JoinActiveTraceBo();
    joinActiveTraceBo.setId(agentId);
    joinActiveTraceBo.setTimestamp(tFAgentStat.getTimestamp());
    joinActiveTraceBo.setHistogramSchemaType(histogram.getHistogramSchemaType());
    joinActiveTraceBo.setVersion(histogram.getVersion());
    joinActiveTraceBo.setTotalCountJoinValue(new JoinIntFieldBo(totalCount, totalCount, agentId, totalCount, agentId));
    return joinActiveTraceBo;
}
Also used : JoinIntFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo) TFActiveTraceHistogram(com.navercorp.pinpoint.thrift.dto.flink.TFActiveTraceHistogram) JoinActiveTraceBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinActiveTraceBo) TFActiveTrace(com.navercorp.pinpoint.thrift.dto.flink.TFActiveTrace)

Aggregations

JoinActiveTraceBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinActiveTraceBo)11 JoinIntFieldBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo)6 ArrayList (java.util.ArrayList)6 Test (org.junit.Test)4 JoinStatBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo)3 TFActiveTrace (com.navercorp.pinpoint.thrift.dto.flink.TFActiveTrace)3 TFActiveTraceHistogram (com.navercorp.pinpoint.thrift.dto.flink.TFActiveTraceHistogram)3 TFAgentStat (com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat)3 AggreJoinActiveTraceBo (com.navercorp.pinpoint.web.vo.stat.AggreJoinActiveTraceBo)3 AgentStatHeaderDecoder (com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder)1 BitCountingHeaderDecoder (com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder)1 JoinIntFieldEncodingStrategy (com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinIntFieldEncodingStrategy)1 JoinIntFieldStrategyAnalyzer (com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinIntFieldStrategyAnalyzer)1 StrategyAnalyzer (com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.StrategyAnalyzer)1 UnsignedIntegerEncodingStrategy (com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.UnsignedIntegerEncodingStrategy)1 UnsignedShortEncodingStrategy (com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.UnsignedShortEncodingStrategy)1 JoinAgentStatBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo)1 TFAgentStatBatch (com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch)1