use of com.navercorp.pinpoint.web.vo.callstacks.RecordSet in project pinpoint by naver.
the class TransactionInfoServiceImpl method createRecordSet.
@Override
public RecordSet createRecordSet(CallTreeIterator callTreeIterator, long focusTimestamp, String agentId, long spanId) {
if (callTreeIterator == null) {
throw new NullPointerException("callTreeIterator must not be null");
}
RecordSet recordSet = new RecordSet();
final List<SpanAlign> spanAlignList = callTreeIterator.values();
// finds and marks the viewPoint.base on focusTimestamp.
// focusTimestamp is needed to determine which span to use as reference when there are more than 2 spans making up a transaction.
// for cases where focus cannot be found due to an error, a separate marker is needed.
// TODO potential error - because server time is used, there may be more than 2 focusTime due to differences in server times.
SpanAlign viewPointSpanAlign = findViewPoint(spanAlignList, focusTimestamp, agentId, spanId);
// FIXME patched temporarily for cases where focusTimeSpanBo is not found. Need a more complete solution.
if (viewPointSpanAlign != null) {
recordSet.setAgentId(viewPointSpanAlign.getAgentId());
recordSet.setApplicationId(viewPointSpanAlign.getApplicationId());
final String applicationName = getRpcArgument(viewPointSpanAlign);
recordSet.setApplicationName(applicationName);
}
// find the startTime to use as reference
long startTime = getStartTime(spanAlignList);
recordSet.setStartTime(startTime);
// find the endTime to use as reference
long endTime = getEndTime(spanAlignList);
recordSet.setEndTime(endTime);
recordSet.setLoggingTransactionInfo(findIsLoggingTransactionInfo(spanAlignList));
final SpanAlignPopulate spanAlignPopulate = new SpanAlignPopulate();
List<Record> recordList = spanAlignPopulate.populateSpanRecord(callTreeIterator);
logger.debug("RecordList:{}", recordList);
if (viewPointSpanAlign != null) {
// mark the record to be used as focus
long beginTimeStamp = viewPointSpanAlign.getStartTime();
markFocusRecord(recordList, viewPointSpanAlign);
recordSet.setBeginTimestamp(beginTimeStamp);
}
recordSet.setRecordList(recordList);
return recordSet;
}
use of com.navercorp.pinpoint.web.vo.callstacks.RecordSet in project pinpoint by naver.
the class BusinessTransactionController method traceViewerData.
@GetMapping(value = "/traceViewerData")
public TraceViewerDataViewModel traceViewerData(@RequestParam("traceId") String traceIdParam, @RequestParam(value = "focusTimestamp", required = false, defaultValue = "0") long focusTimestamp, @RequestParam(value = "agentId", required = false) String agentId, @RequestParam(value = "spanId", required = false, defaultValue = "-1") long spanId) {
logger.debug("GET /traceViewerData params {traceId={}, focusTimestamp={}, agentId={}, spanId={}}", traceIdParam, focusTimestamp, agentId, spanId);
final TransactionId transactionId = TransactionIdUtils.parseTransactionId(traceIdParam);
final ColumnGetCount columnGetCount = ColumnGetCountFactory.create(callstackSelectSpansLimit);
// select spans
Predicate<SpanBo> spanMatchFilter = SpanFilters.spanFilter(spanId, agentId, focusTimestamp);
SpanResult spanResult = this.spanService.selectSpan(transactionId, spanMatchFilter, columnGetCount);
final CallTreeIterator callTreeIterator = spanResult.getCallTree();
RecordSet recordSet = this.transactionInfoService.createRecordSet(callTreeIterator, spanMatchFilter);
return new TraceViewerDataViewModel(recordSet);
}
use of com.navercorp.pinpoint.web.vo.callstacks.RecordSet in project pinpoint by naver.
the class BusinessTransactionController method transactionInfo.
/**
* info lookup for a selected transaction
*
* @param traceId
* @param focusTimestamp
* @return
*/
@GetMapping(value = "/transactionInfo")
public TransactionInfoViewModel transactionInfo(@RequestParam("traceId") String traceId, @RequestParam(value = "focusTimestamp", required = false, defaultValue = DEFAULT_FOCUS_TIMESTAMP) long focusTimestamp, @RequestParam(value = "agentId", required = false) String agentId, @RequestParam(value = "spanId", required = false, defaultValue = DEFAULT_SPANID) long spanId, @RequestParam(value = "v", required = false, defaultValue = "0") int viewVersion, @RequestParam(value = "useStatisticsAgentState", required = false, defaultValue = "false") boolean useStatisticsAgentState, @RequestParam(value = "useLoadHistogramFormat", required = false, defaultValue = "false") boolean useLoadHistogramFormat) {
logger.debug("GET /transactionInfo params {traceId={}, focusTimestamp={}, agentId={}, spanId={}, v={}}", traceId, focusTimestamp, agentId, spanId, viewVersion);
final TransactionId transactionId = TransactionIdUtils.parseTransactionId(traceId);
final ColumnGetCount columnGetCount = ColumnGetCountFactory.create(callstackSelectSpansLimit);
Predicate<SpanBo> spanMatchFilter = SpanFilters.spanFilter(spanId, agentId, focusTimestamp);
// select spans
final SpanResult spanResult = this.spanService.selectSpan(transactionId, spanMatchFilter, columnGetCount);
final CallTreeIterator callTreeIterator = spanResult.getCallTree();
// application map
FilteredMapServiceOption.Builder optionBuilder = new FilteredMapServiceOption.Builder(transactionId, viewVersion, columnGetCount);
final FilteredMapServiceOption option = optionBuilder.setUseStatisticsAgentState(useStatisticsAgentState).build();
ApplicationMap map = filteredMapService.selectApplicationMap(option);
RecordSet recordSet = this.transactionInfoService.createRecordSet(callTreeIterator, spanMatchFilter);
TransactionInfoViewModel result = new TransactionInfoViewModel(transactionId, spanId, map.getNodes(), map.getLinks(), recordSet, spanResult.getTraceState(), logConfiguration);
if (useLoadHistogramFormat) {
result.setTimeHistogramFormat(TimeHistogramFormat.V2);
}
return result;
}
use of com.navercorp.pinpoint.web.vo.callstacks.RecordSet in project pinpoint by naver.
the class BusinessTransactionController method transactionInfo.
/**
* info lookup for a selected transaction
*
* @param traceIdParam
* @param focusTimestamp
* @return
*/
@RequestMapping(value = "/transactionInfo", method = RequestMethod.GET)
@ResponseBody
public TransactionInfoViewModel transactionInfo(@RequestParam("traceId") String traceIdParam, @RequestParam(value = "focusTimestamp", required = false, defaultValue = "0") long focusTimestamp, @RequestParam(value = "agentId", required = false) String agentId, @RequestParam(value = "spanId", required = false, defaultValue = "-1") long spanId, @RequestParam(value = "v", required = false, defaultValue = "0") int viewVersion) {
logger.debug("GET /transactionInfo params {traceId={}, focusTimestamp={}, agentId={}, spanId={}, v={}}", traceIdParam, focusTimestamp, agentId, spanId, viewVersion);
final TransactionId transactionId = TransactionIdUtils.parseTransactionId(traceIdParam);
// select spans
final SpanResult spanResult = this.spanService.selectSpan(transactionId, focusTimestamp);
final CallTreeIterator callTreeIterator = spanResult.getCallTree();
// application map
ApplicationMap map = filteredMapService.selectApplicationMap(transactionId);
RecordSet recordSet = this.transactionInfoService.createRecordSet(callTreeIterator, focusTimestamp, agentId, spanId);
TransactionInfoViewModel result = new TransactionInfoViewModel(transactionId, map.getNodes(), map.getLinks(), recordSet, spanResult.getCompleteTypeString(), logLinkEnable, logButtonName, logPageUrl, disableButtonMessage);
return result;
}
use of com.navercorp.pinpoint.web.vo.callstacks.RecordSet in project pinpoint by naver.
the class TransactionInfoServiceImpl method createRecordSet.
@Override
public RecordSet createRecordSet(CallTreeIterator callTreeIterator, Predicate<SpanBo> viewPointFilter) {
Objects.requireNonNull(callTreeIterator, "callTreeIterator");
Objects.requireNonNull(viewPointFilter, "viewPointFilter");
RecordSet recordSet = new RecordSet();
final List<Align> alignList = callTreeIterator.values();
// finds and marks the viewPoint.base on focusTimestamp.
// focusTimestamp is needed to determine which span to use as reference when there are more than 2 spans making up a transaction.
// for cases where focus cannot be found due to an error, a separate marker is needed.
// TODO potential error - because server time is used, there may be more than 2 focusTime due to differences in server times.
Align viewPointAlign = findViewPoint(alignList, viewPointFilter);
// FIXME patched temporarily for cases where focusTimeSpanBo is not found. Need a more complete solution.
if (viewPointAlign != null) {
recordSet.setAgentId(viewPointAlign.getAgentId());
recordSet.setAgentName(viewPointAlign.getAgentName());
recordSet.setApplicationId(viewPointAlign.getApplicationId());
final String applicationName = getRpcArgument(viewPointAlign);
recordSet.setApplicationName(applicationName);
}
// find the startTime to use as reference
long startTime = getStartTime(alignList);
recordSet.setStartTime(startTime);
// find the endTime to use as reference
long endTime = getEndTime(alignList);
/*
* Workaround codes to prevent issues occurred
* when endTime is too far away from startTime
*/
long rootEndTime = getRootEndTime(alignList);
if (rootEndTime - startTime <= 0) {
recordSet.setEndTime(endTime);
} else if ((double) (rootEndTime - startTime) / (endTime - startTime) < 0.1) {
recordSet.setEndTime(rootEndTime);
} else {
recordSet.setEndTime(endTime);
}
recordSet.setLoggingTransactionInfo(findIsLoggingTransactionInfo(alignList));
final SpanAlignPopulate spanAlignPopulate = new SpanAlignPopulate();
List<Record> recordList = spanAlignPopulate.populateSpanRecord(callTreeIterator);
if (viewPointAlign != null) {
// mark the record to be used as focus
long beginTimeStamp = viewPointAlign.getStartTime();
markFocusRecord(recordList, viewPointAlign);
recordSet.setBeginTimestamp(beginTimeStamp);
}
recordSet.setRecordList(recordList);
return recordSet;
}
Aggregations