Search in sources :

Example 16 with TAgentStat

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

the class ThriftAgentEventMapperTest method simpleTest1.

@Test
public void simpleTest1() {
    final String agentId = "agentId";
    final long startTimestamp = Long.MAX_VALUE;
    final long eventTimestamp = startTimestamp;
    final TAgentStat agentStat = createAgentStat(agentId, startTimestamp, eventTimestamp, 2);
    DeadlockBo deadlockBo = new DeadlockBo();
    deadlockBo.setDeadlockedThreadCount(agentStat.getDeadlock().getDeadlockedThreadCount());
    DeadlockEventBo expectedEventBo = new DeadlockEventBo(agentId, startTimestamp, eventTimestamp, AgentEventType.AGENT_DEADLOCK_DETECTED, deadlockBo);
    when(this.deadlockEventBoMapper.map(agentId, startTimestamp, startTimestamp, agentStat.getDeadlock())).thenReturn(expectedEventBo);
    AgentEventBo actualEventBo = agentEventMapper.map(agentStat);
    Assert.assertEquals(expectedEventBo, actualEventBo);
}
Also used : 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 17 with TAgentStat

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

the class ThriftAgentEventBatchMapper method map.

public List<AgentEventBo> map(TAgentStatBatch tAgentStatBatch) {
    if (tAgentStatBatch == null) {
        return Collections.emptyList();
    }
    final List<TAgentStat> agentStats = tAgentStatBatch.getAgentStats();
    if (CollectionUtils.isEmpty(agentStats)) {
        return Collections.emptyList();
    }
    final String agentId = tAgentStatBatch.getAgentId();
    final long startTimestamp = tAgentStatBatch.getStartTimestamp();
    List<AgentEventBo> agentEventBoList = new ArrayList<>(agentStats.size());
    for (TAgentStat tAgentStat : agentStats) {
        final long timestamp = tAgentStat.getTimestamp();
        if (tAgentStat.isSetDeadlock()) {
            TDeadlock deadlock = tAgentStat.getDeadlock();
            if (deadlock != null && deadlock.isSetDeadlockedThreadList()) {
                agentEventBoList.add(deadlockEventBoMapper.map(agentId, startTimestamp, timestamp, deadlock));
            }
        }
    }
    return agentEventBoList;
}
Also used : TDeadlock(com.navercorp.pinpoint.thrift.dto.TDeadlock) TAgentStat(com.navercorp.pinpoint.thrift.dto.TAgentStat) AgentEventBo(com.navercorp.pinpoint.common.server.bo.event.AgentEventBo) ArrayList(java.util.ArrayList)

Example 18 with TAgentStat

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

the class ThriftAgentStatHandlerV2 method handleSimple.

void handleSimple(TBase<?, ?> tBase) {
    // FIXME (2014.08) Legacy - TAgentStat should not be sent over the wire.
    if (tBase instanceof TAgentStat) {
        TAgentStat tAgentStat = (TAgentStat) tBase;
        this.handleAgentStat(tAgentStat);
    } else if (tBase instanceof TAgentStatBatch) {
        TAgentStatBatch tAgentStatBatch = (TAgentStatBatch) tBase;
        this.handleAgentStatBatch(tAgentStatBatch);
    } else {
        throw new IllegalArgumentException("unexpected tbase:" + tBase + " expected:" + TAgentStat.class.getName() + " or " + TAgentStatBatch.class.getName());
    }
}
Also used : TAgentStat(com.navercorp.pinpoint.thrift.dto.TAgentStat) TAgentStatBatch(com.navercorp.pinpoint.thrift.dto.TAgentStatBatch)

Example 19 with TAgentStat

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

the class StatThriftMessageConverter method toMessage.

@Override
public TBase<?, ?> toMessage(MetricType message) {
    if (message instanceof AgentStatMetricSnapshotBatch) {
        final AgentStatMetricSnapshotBatch agentStatMetricSnapshotBatch = (AgentStatMetricSnapshotBatch) message;
        final TAgentStatBatch agentStatBatch = new TAgentStatBatch();
        agentStatBatch.setAgentId(agentStatMetricSnapshotBatch.getAgentId());
        agentStatBatch.setStartTimestamp(agentStatMetricSnapshotBatch.getStartTimestamp());
        for (AgentStatMetricSnapshot agentStatMetricSnapshot : agentStatMetricSnapshotBatch.getAgentStats()) {
            final TAgentStat agentStat = convertAgentStat(agentStatMetricSnapshot);
            agentStatBatch.addToAgentStats(agentStat);
        }
        return agentStatBatch;
    } else if (message instanceof AgentStatMetricSnapshot) {
        final AgentStatMetricSnapshot agentStatMetricSnapshot = (AgentStatMetricSnapshot) message;
        final TAgentStat agentStat = convertAgentStat(agentStatMetricSnapshot);
        return agentStat;
    }
    return null;
}
Also used : AgentStatMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.AgentStatMetricSnapshot) TAgentStat(com.navercorp.pinpoint.thrift.dto.TAgentStat) TAgentStatBatch(com.navercorp.pinpoint.thrift.dto.TAgentStatBatch) AgentStatMetricSnapshotBatch(com.navercorp.pinpoint.profiler.monitor.metric.AgentStatMetricSnapshotBatch)

Example 20 with TAgentStat

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

the class StatThriftMessageConverter method convertAgentStat.

private TAgentStat convertAgentStat(final AgentStatMetricSnapshot agentStatMetricSnapshot) {
    final TAgentStat agentStat = new TAgentStat();
    agentStat.setTimestamp(agentStatMetricSnapshot.getTimestamp());
    agentStat.setCollectInterval(agentStatMetricSnapshot.getCollectInterval());
    // Agent information
    agentStat.setAgentId(agentStatMetricSnapshot.getAgentId());
    agentStat.setStartTimestamp(agentStatMetricSnapshot.getStartTimestamp());
    // Metric
    final JvmGcMetricSnapshot jvmGcMetricSnapshot = agentStatMetricSnapshot.getGc();
    if (jvmGcMetricSnapshot != null) {
        final TJvmGc jvmGc = convertJvmGc(jvmGcMetricSnapshot);
        agentStat.setGc(jvmGc);
    }
    final CpuLoadMetricSnapshot cpuLoadMetricSnapshot = agentStatMetricSnapshot.getCpuLoad();
    if (cpuLoadMetricSnapshot != null) {
        final TCpuLoad cpuLoad = convertCpuLoad(cpuLoadMetricSnapshot);
        agentStat.setCpuLoad(cpuLoad);
    }
    final TransactionMetricSnapshot transactionMetricSnapshot = agentStatMetricSnapshot.getTransaction();
    if (transactionMetricSnapshot != null) {
        final TTransaction transaction = convertTransaction(transactionMetricSnapshot);
        agentStat.setTransaction(transaction);
    }
    final ActiveTraceHistogram activeTraceHistogram = agentStatMetricSnapshot.getActiveTrace();
    if (activeTraceHistogram != null) {
        final TActiveTrace activeTrace = convertActiveTrace(activeTraceHistogram);
        agentStat.setActiveTrace(activeTrace);
    }
    final DataSourceMetricSnapshot dataSourceMetricSnapshot = agentStatMetricSnapshot.getDataSourceList();
    if (dataSourceMetricSnapshot != null) {
        final TDataSourceList dataSourceList = convertDataSourceList(dataSourceMetricSnapshot);
        agentStat.setDataSourceList(dataSourceList);
    }
    final ResponseTimeValue responseTimeValue = agentStatMetricSnapshot.getResponseTime();
    if (responseTimeValue != null) {
        final TResponseTime responseTime = convertResponseTime(responseTimeValue);
        agentStat.setResponseTime(responseTime);
    }
    final DeadlockMetricSnapshot deadlockMetricSnapshot = agentStatMetricSnapshot.getDeadlock();
    if (deadlockMetricSnapshot != null) {
        final TDeadlock deadlock = convertDeadlock(deadlockMetricSnapshot);
        agentStat.setDeadlock(deadlock);
    }
    final FileDescriptorMetricSnapshot fileDescriptorMetricSnapshot = agentStatMetricSnapshot.getFileDescriptor();
    if (fileDescriptorMetricSnapshot != null) {
        final TFileDescriptor fileDescriptor = convertFileDescriptor(fileDescriptorMetricSnapshot);
        agentStat.setFileDescriptor(fileDescriptor);
    }
    final BufferMetricSnapshot bufferMetricSnapshot = agentStatMetricSnapshot.getDirectBuffer();
    if (bufferMetricSnapshot != null) {
        final TDirectBuffer directBuffer = convertDirectBuffer(bufferMetricSnapshot);
        agentStat.setDirectBuffer(directBuffer);
    }
    final TotalThreadMetricSnapshot totalThreadMetricSnapshot = agentStatMetricSnapshot.getTotalThread();
    if (totalThreadMetricSnapshot != null) {
        final TTotalThreadCount totalThreadCount = convertTotalThreadCount(totalThreadMetricSnapshot);
        agentStat.setTotalThreadCount(totalThreadCount);
    }
    final LoadedClassMetricSnapshot loadedClassMetricSnapshot = agentStatMetricSnapshot.getLoadedClassCount();
    if (loadedClassMetricSnapshot != null) {
        final TLoadedClass loadedClass = convertLoadedClass(loadedClassMetricSnapshot);
        agentStat.setLoadedClass(loadedClass);
    }
    return agentStat;
}
Also used : ResponseTimeValue(com.navercorp.pinpoint.profiler.monitor.metric.response.ResponseTimeValue) TAgentStat(com.navercorp.pinpoint.thrift.dto.TAgentStat) BufferMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.buffer.BufferMetricSnapshot) TActiveTrace(com.navercorp.pinpoint.thrift.dto.TActiveTrace) TotalThreadMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.totalthread.TotalThreadMetricSnapshot) TJvmGc(com.navercorp.pinpoint.thrift.dto.TJvmGc) FileDescriptorMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.filedescriptor.FileDescriptorMetricSnapshot) TDirectBuffer(com.navercorp.pinpoint.thrift.dto.TDirectBuffer) ActiveTraceHistogram(com.navercorp.pinpoint.profiler.context.active.ActiveTraceHistogram) TActiveTraceHistogram(com.navercorp.pinpoint.thrift.dto.TActiveTraceHistogram) CpuLoadMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.cpu.CpuLoadMetricSnapshot) TCpuLoad(com.navercorp.pinpoint.thrift.dto.TCpuLoad) TResponseTime(com.navercorp.pinpoint.thrift.dto.TResponseTime) TDeadlock(com.navercorp.pinpoint.thrift.dto.TDeadlock) TDataSourceList(com.navercorp.pinpoint.thrift.dto.TDataSourceList) DataSourceMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.datasource.DataSourceMetricSnapshot) JvmGcMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.JvmGcMetricSnapshot) TLoadedClass(com.navercorp.pinpoint.thrift.dto.TLoadedClass) DeadlockMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.deadlock.DeadlockMetricSnapshot) LoadedClassMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.loadedclass.LoadedClassMetricSnapshot) TFileDescriptor(com.navercorp.pinpoint.thrift.dto.TFileDescriptor) TTotalThreadCount(com.navercorp.pinpoint.thrift.dto.TTotalThreadCount) TransactionMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.transaction.TransactionMetricSnapshot) TTransaction(com.navercorp.pinpoint.thrift.dto.TTransaction)

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