use of com.navercorp.pinpoint.common.trace.HistogramSchema in project pinpoint by naver.
the class HistogramTest method testJson.
@Test
public void testJson() throws Exception {
HistogramSchema schema = ServiceType.STAND_ALONE.getHistogramSchema();
Histogram original = new Histogram(ServiceType.STAND_ALONE);
original.addCallCount(schema.getFastSlot().getSlotTime(), 100);
String json = objectMapper.writeValueAsString(original);
HashMap hashMap = objectMapper.readValue(json, HashMap.class);
Assert.assertEquals(hashMap.get(schema.getFastSlot().getSlotName()), 100);
Assert.assertEquals(hashMap.get(schema.getErrorSlot().getSlotName()), 0);
}
use of com.navercorp.pinpoint.common.trace.HistogramSchema in project pinpoint by naver.
the class LegacyAgentStatChartGroup method addActiveTraceData.
private void addActiveTraceData(AgentStat agentStat) {
long timestamp = agentStat.getTimestamp();
HistogramSchema schema = agentStat.getHistogramSchema();
if (schema != null) {
Map<SlotType, Integer> activeTraceCounts = agentStat.getActiveTraceCounts();
int fastCount = activeTraceCounts.get(SlotType.FAST);
if (fastCount != UNCOLLECTED_DATA) {
TitledDataPoint<Long, Integer> fastDataPoint = new TitledDataPoint<>(schema.getFastSlot().getSlotName(), timestamp, fastCount);
this.activeTraceFastChartBuilder.addDataPoint(fastDataPoint);
}
int normalCount = activeTraceCounts.get(SlotType.NORMAL);
if (normalCount != UNCOLLECTED_DATA) {
TitledDataPoint<Long, Integer> normalDataPoint = new TitledDataPoint<>(schema.getNormalSlot().getSlotName(), timestamp, normalCount);
this.activeTraceNormalChartBuilder.addDataPoint(normalDataPoint);
}
int slowCount = activeTraceCounts.get(SlotType.SLOW);
if (slowCount != UNCOLLECTED_DATA) {
TitledDataPoint<Long, Integer> slowDataPoint = new TitledDataPoint<>(schema.getSlowSlot().getSlotName(), timestamp, slowCount);
this.activeTraceSlowChartBuilder.addDataPoint(slowDataPoint);
}
int verySlowCount = activeTraceCounts.get(SlotType.VERY_SLOW);
if (verySlowCount != UNCOLLECTED_DATA) {
TitledDataPoint<Long, Integer> verySlowDataPoint = new TitledDataPoint<>(schema.getVerySlowSlot().getSlotName(), timestamp, verySlowCount);
this.activeTraceVerySlowChartBuilder.addDataPoint(verySlowDataPoint);
}
}
}
use of com.navercorp.pinpoint.common.trace.HistogramSchema in project pinpoint by naver.
the class AgentTimeHistogram method createResponseTimeViewModel.
public List<ResponseTimeViewModel> createResponseTimeViewModel(List<TimeHistogram> timeHistogramList) {
final List<ResponseTimeViewModel> value = new ArrayList<>(5);
ServiceType serviceType = application.getServiceType();
HistogramSchema schema = serviceType.getHistogramSchema();
value.add(new ResponseTimeViewModel(schema.getFastSlot().getSlotName(), getColumnValue(SlotType.FAST, timeHistogramList)));
// value.add(new ResponseTimeViewModel(schema.getFastErrorSlot().getSlotName(), getColumnValue(SlotType.FAST_ERROR, timeHistogramList)));
value.add(new ResponseTimeViewModel(schema.getNormalSlot().getSlotName(), getColumnValue(SlotType.NORMAL, timeHistogramList)));
// value.add(new ResponseTimeViewModel(schema.getNormalErrorSlot().getSlotName(), getColumnValue(SlotType.NORMAL_ERROR, timeHistogramList)));
value.add(new ResponseTimeViewModel(schema.getSlowSlot().getSlotName(), getColumnValue(SlotType.SLOW, timeHistogramList)));
// value.add(new ResponseTimeViewModel(schema.getSlowErrorSlot().getSlotName(), getColumnValue(SlotType.SLOW_ERROR, timeHistogramList)));
value.add(new ResponseTimeViewModel(schema.getVerySlowSlot().getSlotName(), getColumnValue(SlotType.VERY_SLOW, timeHistogramList)));
// value.add(new ResponseTimeViewModel(schema.getVerySlowErrorSlot().getSlotName(), getColumnValue(SlotType.VERY_SLOW_ERROR, timeHistogramList)));
value.add(new ResponseTimeViewModel(schema.getErrorSlot().getSlotName(), getColumnValue(SlotType.ERROR, timeHistogramList)));
return value;
}
use of com.navercorp.pinpoint.common.trace.HistogramSchema in project pinpoint by naver.
the class HistogramTest method testAddResponseTime.
@Test
public void testAddResponseTime() {
HistogramSchema schema = ServiceType.STAND_ALONE.getHistogramSchema();
LongAdderHistogram histogram = new LongAdderHistogram(ServiceType.STAND_ALONE);
histogram.addResponseTime(1000, false);
histogram.addResponseTime(3000, false);
histogram.addResponseTime(3000, false);
histogram.addResponseTime(5000, false);
histogram.addResponseTime(5000, false);
histogram.addResponseTime(5000, false);
histogram.addResponseTime(6000, false);
histogram.addResponseTime(6000, false);
histogram.addResponseTime(6000, false);
histogram.addResponseTime(6000, false);
histogram.addResponseTime(schema.getFastSlot().getSlotTime(), true);
histogram.addResponseTime(schema.getFastSlot().getSlotTime(), true);
histogram.addResponseTime(schema.getFastSlot().getSlotTime(), true);
histogram.addResponseTime(schema.getFastSlot().getSlotTime(), true);
histogram.addResponseTime(schema.getFastSlot().getSlotTime(), true);
HistogramSnapshot snapshot = histogram.createSnapshot();
Assert.assertEquals(snapshot.getFastCount(), 1);
Assert.assertEquals(snapshot.getNormalCount(), 2);
Assert.assertEquals(snapshot.getSlowCount(), 3);
Assert.assertEquals(snapshot.getVerySlowCount(), 4);
Assert.assertEquals(snapshot.getFastErrorCount(), 5);
}
use of com.navercorp.pinpoint.common.trace.HistogramSchema in project pinpoint by naver.
the class HbaseMapStatisticsCalleeDao method update.
@Override
public void update(String calleeApplicationName, ServiceType calleeServiceType, String callerApplicationName, ServiceType callerServiceType, String callerHost, int elapsed, boolean isError) {
Objects.requireNonNull(calleeApplicationName, "calleeApplicationName");
Objects.requireNonNull(callerApplicationName, "callerApplicationName");
if (logger.isDebugEnabled()) {
logger.debug("[Callee] {} ({}) <- {} ({})[{}]", calleeApplicationName, calleeServiceType, callerApplicationName, callerServiceType, callerHost);
}
// there may be no endpoint in case of httpclient
callerHost = StringUtils.defaultString(callerHost);
// TODO callee, caller parameter normalization
if (ignoreStatFilter.filter(calleeServiceType, callerHost)) {
logger.debug("[Ignore-Callee] {} ({}) <- {} ({})[{}]", calleeApplicationName, calleeServiceType, callerApplicationName, callerServiceType, callerHost);
return;
}
// make row key. rowkey is me
final long acceptedTime = acceptedTimeService.getAcceptedTime();
final long rowTimeSlot = timeSlot.getTimeSlot(acceptedTime);
final RowKey calleeRowKey = new CallRowKey(calleeApplicationName, calleeServiceType.getCode(), rowTimeSlot);
final short callerSlotNumber = ApplicationMapStatisticsUtils.getSlotNumber(calleeServiceType, elapsed, isError);
HistogramSchema histogramSchema = calleeServiceType.getHistogramSchema();
final ColumnName callerColumnName = new CallerColumnName(callerServiceType.getCode(), callerApplicationName, callerHost, callerSlotNumber);
this.bulkWriter.increment(calleeRowKey, callerColumnName);
if (mapLinkConfiguration.isEnableAvg()) {
final ColumnName sumColumnName = new CallerColumnName(callerServiceType.getCode(), callerApplicationName, callerHost, histogramSchema.getSumStatSlot().getSlotTime());
this.bulkWriter.increment(calleeRowKey, sumColumnName, elapsed);
}
if (mapLinkConfiguration.isEnableMax()) {
final ColumnName maxColumnName = new CallerColumnName(callerServiceType.getCode(), callerApplicationName, callerHost, histogramSchema.getMaxStatSlot().getSlotTime());
this.bulkWriter.updateMax(calleeRowKey, maxColumnName, elapsed);
}
}
Aggregations