use of com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceHistogram in project pinpoint by naver.
the class GrpcActiveTraceBoMapper method map.
public ActiveTraceBo map(final PActiveTrace activeTrace) {
final PActiveTraceHistogram histogram = activeTrace.getHistogram();
final ActiveTraceHistogram activeTraceHistogram = createActiveTraceCountMap(histogram.getActiveTraceCountList());
final ActiveTraceBo activeTraceBo = new ActiveTraceBo();
activeTraceBo.setVersion((short) histogram.getVersion());
activeTraceBo.setHistogramSchemaType(histogram.getHistogramSchemaType());
activeTraceBo.setActiveTraceHistogram(activeTraceHistogram);
return activeTraceBo;
}
use of com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceHistogram in project pinpoint by naver.
the class ThriftActiveTraceBoMapperTest method verify.
@Override
protected void verify(TActiveTrace original, ActiveTraceBo mappedStatDataPoint) {
Assert.assertEquals("version", original.getHistogram().getVersion(), mappedStatDataPoint.getVersion());
Assert.assertEquals("schemaType", original.getHistogram().getHistogramSchemaType(), mappedStatDataPoint.getHistogramSchemaType());
List<Integer> activeTraceCountList = original.getHistogram().getActiveTraceCount();
for (int i = 0; i < activeTraceCountList.size(); i++) {
int activeTraceCount = activeTraceCountList.get(i);
final ActiveTraceHistogram activeTraceHistogram = mappedStatDataPoint.getActiveTraceHistogram();
if (i == 0) {
Assert.assertEquals("FAST", activeTraceCount, activeTraceHistogram.getFastCount());
} else if (i == 1) {
Assert.assertEquals("NORMAL", activeTraceCount, activeTraceHistogram.getNormalCount());
} else if (i == 2) {
Assert.assertEquals("SLOW", activeTraceCount, activeTraceHistogram.getSlowCount());
} else if (i == 3) {
Assert.assertEquals("VERY_SLOW", activeTraceCount, activeTraceHistogram.getVerySlowCount());
} else {
Assert.fail();
}
}
}
use of com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceHistogram in project pinpoint by naver.
the class ActiveTraceSampler method sampleDataPoints.
@Override
public SampledActiveTrace sampleDataPoints(int timeWindowIndex, long timestamp, List<ActiveTraceBo> dataPoints, ActiveTraceBo previousDataPoint) {
final HistogramSchema schema = BaseHistogramSchema.getDefaultHistogramSchemaByTypeCode(dataPoints.get(0).getHistogramSchemaType());
if (schema == null) {
return newUnSampledActiveTrace(timestamp);
}
AgentStatPoint<Integer> fast = newAgentStatPoint(schema.getFastSlot(), timestamp, dataPoints, ActiveTraceHistogram::getFastCount);
AgentStatPoint<Integer> normal = newAgentStatPoint(schema.getNormalSlot(), timestamp, dataPoints, ActiveTraceHistogram::getNormalCount);
AgentStatPoint<Integer> slow = newAgentStatPoint(schema.getSlowSlot(), timestamp, dataPoints, ActiveTraceHistogram::getSlowCount);
AgentStatPoint<Integer> verySlow = newAgentStatPoint(schema.getVerySlowSlot(), timestamp, dataPoints, ActiveTraceHistogram::getVerySlowCount);
SampledActiveTrace sampledActiveTrace = new SampledActiveTrace(fast, normal, slow, verySlow);
return sampledActiveTrace;
}
use of com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceHistogram in project pinpoint by naver.
the class ThriftActiveTraceBoMapper method map.
@Override
public ActiveTraceBo map(TActiveTrace tActiveTrace) {
TActiveTraceHistogram tActiveTraceHistogram = tActiveTrace.getHistogram();
ActiveTraceHistogram activeTraceHistogram = createActiveTraceCountMap(tActiveTraceHistogram.getActiveTraceCount());
ActiveTraceBo activeTraceBo = new ActiveTraceBo();
activeTraceBo.setVersion(tActiveTraceHistogram.getVersion());
activeTraceBo.setHistogramSchemaType(tActiveTraceHistogram.getHistogramSchemaType());
activeTraceBo.setActiveTraceHistogram(activeTraceHistogram);
return activeTraceBo;
}
use of com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceHistogram in project pinpoint by naver.
the class ActiveTraceSampler method filterActiveTraceBoList.
private List<Integer> filterActiveTraceBoList(List<ActiveTraceBo> dataPoints, ToIntFunction<ActiveTraceHistogram> counter) {
final List<Integer> result = new ArrayList<>(dataPoints.size());
for (ActiveTraceBo activeTraceBo : dataPoints) {
final ActiveTraceHistogram activeTraceHistogram = activeTraceBo.getActiveTraceHistogram();
final int count = counter.applyAsInt(activeTraceHistogram);
if (count != ActiveTraceBo.UNCOLLECTED_ACTIVE_TRACE_COUNT) {
result.add(count);
}
}
return result;
}
Aggregations