Search in sources :

Example 6 with JoinFileDescriptorBo

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

the class FileDescriptorCodec 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> timestamps = this.codec.decodeTimestamps(initialTimestamp, valueBuffer, numValues);
    // decode headers
    final byte[] header = valueBuffer.readPrefixedBytes();
    AgentStatHeaderDecoder headerDecoder = new BitCountingHeaderDecoder(header);
    JoinLongFieldEncodingStrategy openFileDescriptorCountEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode());
    // decode values
    final List<JoinLongFieldBo> openFileDescriptorCounts = this.codec.decodeValues(valueBuffer, openFileDescriptorCountEncodingStrategy, numValues);
    List<JoinStatBo> joinFileDescriptorBoList = new ArrayList<>(numValues);
    for (int i = 0; i < numValues; i++) {
        JoinFileDescriptorBo joinFileDescriptorBo = new JoinFileDescriptorBo();
        joinFileDescriptorBo.setId(id);
        joinFileDescriptorBo.setTimestamp(timestamps.get(i));
        joinFileDescriptorBo.setOpenFdCountJoinValue(openFileDescriptorCounts.get(i));
        joinFileDescriptorBoList.add(joinFileDescriptorBo);
    }
    return joinFileDescriptorBoList;
}
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) JoinLongFieldEncodingStrategy(com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldEncodingStrategy) JoinFileDescriptorBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinFileDescriptorBo) JoinLongFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo) AgentStatHeaderDecoder(com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder)

Example 7 with JoinFileDescriptorBo

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

the class JoinFileDescriptorBoMapperTest method map2Test.

@Test
public void map2Test() {
    final TFAgentStat tFAgentStat = new TFAgentStat();
    tFAgentStat.setAgentId("testAgent");
    tFAgentStat.setTimestamp(1491274138454L);
    final JoinFileDescriptorBoMapper mapper = new JoinFileDescriptorBoMapper();
    final JoinFileDescriptorBo joinFileDescriptorBo = mapper.map(tFAgentStat);
    assertEquals(joinFileDescriptorBo, joinFileDescriptorBo.EMPTY_JOIN_FILE_DESCRIPTOR_BO);
}
Also used : TFAgentStat(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat) JoinFileDescriptorBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinFileDescriptorBo) Test(org.junit.Test)

Example 8 with JoinFileDescriptorBo

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

the class JoinFileDescriptorBoMapper method map.

@Override
public JoinFileDescriptorBo map(TFAgentStat tFAgentStat) {
    if (!tFAgentStat.isSetFileDescriptor()) {
        return JoinFileDescriptorBo.EMPTY_JOIN_FILE_DESCRIPTOR_BO;
    }
    JoinFileDescriptorBo joinFileDescriptorBo = new JoinFileDescriptorBo();
    final String agentId = tFAgentStat.getAgentId();
    joinFileDescriptorBo.setId(agentId);
    joinFileDescriptorBo.setTimestamp(tFAgentStat.getTimestamp());
    TFFileDescriptor tFFileDescriptor = tFAgentStat.getFileDescriptor();
    final long openFileDescriptorCount = tFFileDescriptor.getOpenFileDescriptorCount();
    joinFileDescriptorBo.setOpenFdCountJoinValue(new JoinLongFieldBo(openFileDescriptorCount, openFileDescriptorCount, agentId, openFileDescriptorCount, agentId));
    return joinFileDescriptorBo;
}
Also used : JoinFileDescriptorBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinFileDescriptorBo) JoinLongFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo) TFFileDescriptor(com.navercorp.pinpoint.thrift.dto.flink.TFFileDescriptor)

Example 9 with JoinFileDescriptorBo

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

the class JoinFileDescriptorBoMapper method build.

@Override
public void build(TFAgentStat tFAgentStat, JoinAgentStatBo.Builder builder) {
    JoinFileDescriptorBo joinFileDescriptorBo = this.map(tFAgentStat);
    if (joinFileDescriptorBo == JoinFileDescriptorBo.EMPTY_JOIN_FILE_DESCRIPTOR_BO) {
        return;
    }
    builder.addFileDescriptor(joinFileDescriptorBo);
}
Also used : JoinFileDescriptorBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinFileDescriptorBo)

Example 10 with JoinFileDescriptorBo

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

the class JoinFileDescriptorSamplerTest method sampleDataPoints.

@Test
public void sampleDataPoints() throws Exception {
    JoinFileDescriptorSampler joinFileDescriptorSampler = new JoinFileDescriptorSampler();
    List<JoinFileDescriptorBo> joinFileDescriptorBoList = new ArrayList<>(5);
    long timeStamp = new Date().getTime();
    joinFileDescriptorBoList.add(new JoinFileDescriptorBo("testApp", 11, 60, "agent1_1", 20, "agent1_2", timeStamp + 5000));
    joinFileDescriptorBoList.add(new JoinFileDescriptorBo("testApp", 22, 52, "agent2_1", 10, "agent2_2", timeStamp + 10000));
    joinFileDescriptorBoList.add(new JoinFileDescriptorBo("testApp", 33, 39, "agent3_1", 90, "agent3_2", timeStamp + 15000));
    joinFileDescriptorBoList.add(new JoinFileDescriptorBo("testApp", 44, 42, "agent4_1", 25, "agent4_2", timeStamp + 20000));
    joinFileDescriptorBoList.add(new JoinFileDescriptorBo("testApp", 55, 55, "agent5_1", 54, "agent5_2", timeStamp + 25000));
    AggreJoinFileDescriptorBo aggreJoinFileDescriptorBo = joinFileDescriptorSampler.sampleDataPoints(0, new Date().getTime(), joinFileDescriptorBoList, new JoinFileDescriptorBo());
    assertEquals(aggreJoinFileDescriptorBo.getId(), "testApp");
    assertEquals(aggreJoinFileDescriptorBo.getOpenFdCountJoinValue(), new JoinLongFieldBo(33L, 10L, "agent2_2", 60L, "agent1_1"));
}
Also used : AggreJoinFileDescriptorBo(com.navercorp.pinpoint.web.vo.stat.AggreJoinFileDescriptorBo) ArrayList(java.util.ArrayList) AggreJoinFileDescriptorBo(com.navercorp.pinpoint.web.vo.stat.AggreJoinFileDescriptorBo) JoinFileDescriptorBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinFileDescriptorBo) JoinLongFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo) Date(java.util.Date) Test(org.junit.Test)

Aggregations

JoinFileDescriptorBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinFileDescriptorBo)10 JoinLongFieldBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo)4 ArrayList (java.util.ArrayList)4 JoinStatBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo)3 Test (org.junit.Test)3 TFAgentStat (com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat)2 TFFileDescriptor (com.navercorp.pinpoint.thrift.dto.flink.TFFileDescriptor)2 AggreJoinFileDescriptorBo (com.navercorp.pinpoint.web.vo.stat.AggreJoinFileDescriptorBo)2 AgentStatHeaderDecoder (com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder)1 BitCountingHeaderDecoder (com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder)1 JoinLongFieldEncodingStrategy (com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldEncodingStrategy)1 JoinLongFieldStrategyAnalyzer (com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldStrategyAnalyzer)1 Date (java.util.Date)1