Search in sources :

Example 6 with TAgentStat

use of com.navercorp.pinpoint.thrift.dto.TAgentStat in project pinpoint by naver.

the class AgentStatHandlerV2Test method testHandleForTAgentStat.

@Test
public void testHandleForTAgentStat() {
    // Given
    final String agentId = "agentId";
    final long startTimestamp = Long.MAX_VALUE;
    final TAgentStat agentStat = createAgentStat(agentId, startTimestamp);
    final AgentStatBo mappedAgentStat = new AgentStatBo();
    when(this.agentStatMapper.map(agentStat)).thenReturn(mappedAgentStat);
    // When
    agentStatHandler.handle(agentStat);
    // Then
    verify(jvmGcDao).insert(mappedAgentStat.getAgentId(), mappedAgentStat.getJvmGcBos());
    verify(jvmGcDetailedDao).insert(mappedAgentStat.getAgentId(), mappedAgentStat.getJvmGcDetailedBos());
    verify(cpuLoadDao).insert(mappedAgentStat.getAgentId(), mappedAgentStat.getCpuLoadBos());
    verify(transactionDao).insert(mappedAgentStat.getAgentId(), mappedAgentStat.getTransactionBos());
    verify(activeTraceDao).insert(mappedAgentStat.getAgentId(), mappedAgentStat.getActiveTraceBos());
    verify(dataSourceDao).insert(mappedAgentStat.getAgentId(), mappedAgentStat.getDataSourceListBos());
}
Also used : AgentStatBo(com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo) TAgentStat(com.navercorp.pinpoint.thrift.dto.TAgentStat) Test(org.junit.Test)

Example 7 with TAgentStat

use of com.navercorp.pinpoint.thrift.dto.TAgentStat in project pinpoint by naver.

the class ThriftAgentEventMapperTest method simpleTest2.

@Test
public void simpleTest2() {
    final String agentId = "agentId";
    final long startTimestamp = Long.MAX_VALUE;
    final long eventTimestamp = startTimestamp;
    final TAgentStat agentStat = createAgentStat(agentId, startTimestamp, eventTimestamp, 0);
    DeadlockBo deadlockBo = new DeadlockBo();
    DeadlockEventBo expectedEventBo = new DeadlockEventBo(agentId, startTimestamp, eventTimestamp, AgentEventType.AGENT_DEADLOCK_DETECTED, deadlockBo);
    when(this.deadlockEventBoMapper.map(any(String.class), any(Long.class), any(Long.class), any(TDeadlock.class))).thenReturn(expectedEventBo);
    AgentEventBo actualEventBo = agentEventMapper.map(agentStat);
    Assert.assertNull(actualEventBo);
}
Also used : TDeadlock(com.navercorp.pinpoint.thrift.dto.TDeadlock) TAgentStat(com.navercorp.pinpoint.thrift.dto.TAgentStat) DeadlockBo(com.navercorp.pinpoint.common.server.bo.event.DeadlockBo) AgentEventBo(com.navercorp.pinpoint.common.server.bo.event.AgentEventBo) DeadlockEventBo(com.navercorp.pinpoint.common.server.bo.event.DeadlockEventBo) Test(org.junit.Test)

Example 8 with TAgentStat

use of com.navercorp.pinpoint.thrift.dto.TAgentStat in project pinpoint by naver.

the class ThriftAgentEventMapperTest method createAgentStat.

private TAgentStat createAgentStat(String agentId, long startTimestamp, long eventTimestamp, int deadlockThreadCount) {
    final TAgentStat agentStat = new TAgentStat();
    agentStat.setAgentId(agentId);
    agentStat.setStartTimestamp(startTimestamp);
    agentStat.setTimestamp(eventTimestamp);
    if (deadlockThreadCount > 0) {
        TDeadlock tDeadlock = new TDeadlock();
        tDeadlock.setDeadlockedThreadCount(deadlockThreadCount);
        for (int i = 0; i < deadlockThreadCount; i++) {
            tDeadlock.addToDeadlockedThreadList(new TThreadDump());
        }
        agentStat.setDeadlock(tDeadlock);
    }
    return agentStat;
}
Also used : TDeadlock(com.navercorp.pinpoint.thrift.dto.TDeadlock) TAgentStat(com.navercorp.pinpoint.thrift.dto.TAgentStat) TThreadDump(com.navercorp.pinpoint.thrift.dto.command.TThreadDump)

Example 9 with TAgentStat

use of com.navercorp.pinpoint.thrift.dto.TAgentStat in project pinpoint by naver.

the class ThriftAgentStatBatchMapper method map.

public AgentStatBo map(TAgentStatBatch tAgentStatBatch) {
    if (!tAgentStatBatch.isSetAgentStats()) {
        return null;
    }
    final String agentId = tAgentStatBatch.getAgentId();
    final long startTimestamp = tAgentStatBatch.getStartTimestamp();
    AgentStatBo.Builder builder = AgentStatBo.newBuilder(agentId, startTimestamp);
    for (TAgentStat tAgentStat : tAgentStatBatch.getAgentStats()) {
        this.statMapper.map(builder, tAgentStat);
    }
    return builder.build();
}
Also used : AgentStatBo(com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo) TAgentStat(com.navercorp.pinpoint.thrift.dto.TAgentStat)

Example 10 with TAgentStat

use of com.navercorp.pinpoint.thrift.dto.TAgentStat in project pinpoint by naver.

the class DefaultTBaseLocator method addBodyFactory.

public static void addBodyFactory(TypeLocatorBuilder<TBase<?, ?>> builder) {
    builder.addBodyFactory(SPAN, new BodyFactory<TBase<?, ?>>() {

        @Override
        public TBase<?, ?> getObject() {
            return new TSpan();
        }
    });
    builder.addBodyFactory(AGENT_INFO, new BodyFactory<TBase<?, ?>>() {

        @Override
        public TBase<?, ?> getObject() {
            return new TAgentInfo();
        }
    });
    builder.addBodyFactory(AGENT_STAT, new BodyFactory<TBase<?, ?>>() {

        @Override
        public TBase<?, ?> getObject() {
            return new TAgentStat();
        }
    });
    builder.addBodyFactory(AGENT_STAT_BATCH, new BodyFactory<TBase<?, ?>>() {

        @Override
        public TBase<?, ?> getObject() {
            return new TAgentStatBatch();
        }
    });
    builder.addBodyFactory(SPANCHUNK, new BodyFactory<TBase<?, ?>>() {

        @Override
        public TBase<?, ?> getObject() {
            return new TSpanChunk();
        }
    });
    builder.addBodyFactory(SPANEVENT, new BodyFactory<TBase<?, ?>>() {

        @Override
        public TBase<?, ?> getObject() {
            return new TSpanEvent();
        }
    });
    builder.addBodyFactory(SQLMETADATA, new BodyFactory<TBase<?, ?>>() {

        @Override
        public TBase<?, ?> getObject() {
            return new TSqlMetaData();
        }
    });
    builder.addBodyFactory(APIMETADATA, new BodyFactory<TBase<?, ?>>() {

        @Override
        public TBase<?, ?> getObject() {
            return new TApiMetaData();
        }
    });
    builder.addBodyFactory(RESULT, new BodyFactory<TBase<?, ?>>() {

        @Override
        public TBase<?, ?> getObject() {
            return new TResult();
        }
    });
    builder.addBodyFactory(STRINGMETADATA, new BodyFactory<TBase<?, ?>>() {

        @Override
        public TBase<?, ?> getObject() {
            return new TStringMetaData();
        }
    });
    builder.addBodyFactory(NETWORK_CHECK, new BodyFactory<TBase<?, ?>>() {

        @Override
        public TBase<?, ?> getObject() {
            return new NetworkAvailabilityCheckPacket();
        }
    });
    builder.addBodyFactory(CHUNK, new BodyFactory<TBase<?, ?>>() {

        @Override
        public TBase<?, ?> getObject() {
            return null;
        }
    });
}
Also used : TAgentStat(com.navercorp.pinpoint.thrift.dto.TAgentStat) TAgentStatBatch(com.navercorp.pinpoint.thrift.dto.TAgentStatBatch) TStringMetaData(com.navercorp.pinpoint.thrift.dto.TStringMetaData) TResult(com.navercorp.pinpoint.thrift.dto.TResult) TSpanChunk(com.navercorp.pinpoint.thrift.dto.TSpanChunk) TApiMetaData(com.navercorp.pinpoint.thrift.dto.TApiMetaData) TSpan(com.navercorp.pinpoint.thrift.dto.TSpan) TBase(org.apache.thrift.TBase) TSqlMetaData(com.navercorp.pinpoint.thrift.dto.TSqlMetaData) TAgentInfo(com.navercorp.pinpoint.thrift.dto.TAgentInfo) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent)

Aggregations

TAgentStat (com.navercorp.pinpoint.thrift.dto.TAgentStat)20 TAgentStatBatch (com.navercorp.pinpoint.thrift.dto.TAgentStatBatch)6 ArrayList (java.util.ArrayList)5 AgentStatBo (com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo)4 TDeadlock (com.navercorp.pinpoint.thrift.dto.TDeadlock)4 TJvmGc (com.navercorp.pinpoint.thrift.dto.TJvmGc)4 Test (org.junit.Test)4 AgentEventBo (com.navercorp.pinpoint.common.server.bo.event.AgentEventBo)3 TDataSourceList (com.navercorp.pinpoint.thrift.dto.TDataSourceList)3 DeadlockBo (com.navercorp.pinpoint.common.server.bo.event.DeadlockBo)2 DeadlockEventBo (com.navercorp.pinpoint.common.server.bo.event.DeadlockEventBo)2 TCpuLoad (com.navercorp.pinpoint.thrift.dto.TCpuLoad)2 AgentStat (com.navercorp.pinpoint.web.vo.AgentStat)2 ActiveTraceHistogramBo (com.navercorp.pinpoint.common.server.bo.ActiveTraceHistogramBo)1 AgentStatMemoryGcBo (com.navercorp.pinpoint.common.server.bo.AgentStatMemoryGcBo)1 ActiveTraceBo (com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo)1 CpuLoadBo (com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo)1 DataSourceBo (com.navercorp.pinpoint.common.server.bo.stat.DataSourceBo)1 DataSourceListBo (com.navercorp.pinpoint.common.server.bo.stat.DataSourceListBo)1 JvmGcBo (com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo)1