Search in sources :

Example 1 with RecordSet

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;
}
Also used : SpanAlign(com.navercorp.pinpoint.web.calltree.span.SpanAlign) Record(com.navercorp.pinpoint.web.vo.callstacks.Record) RecordSet(com.navercorp.pinpoint.web.vo.callstacks.RecordSet)

Example 2 with 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);
}
Also used : ColumnGetCount(com.navercorp.pinpoint.common.hbase.bo.ColumnGetCount) TraceViewerDataViewModel(com.navercorp.pinpoint.web.view.TraceViewerDataViewModel) CallTreeIterator(com.navercorp.pinpoint.web.calltree.span.CallTreeIterator) SpanResult(com.navercorp.pinpoint.web.service.SpanResult) RecordSet(com.navercorp.pinpoint.web.vo.callstacks.RecordSet) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) TransactionId(com.navercorp.pinpoint.common.profiler.util.TransactionId) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 3 with 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;
}
Also used : ColumnGetCount(com.navercorp.pinpoint.common.hbase.bo.ColumnGetCount) ApplicationMap(com.navercorp.pinpoint.web.applicationmap.ApplicationMap) CallTreeIterator(com.navercorp.pinpoint.web.calltree.span.CallTreeIterator) SpanResult(com.navercorp.pinpoint.web.service.SpanResult) ServletUriComponentsBuilder(org.springframework.web.servlet.support.ServletUriComponentsBuilder) TransactionInfoViewModel(com.navercorp.pinpoint.web.view.TransactionInfoViewModel) RecordSet(com.navercorp.pinpoint.web.vo.callstacks.RecordSet) FilteredMapServiceOption(com.navercorp.pinpoint.web.service.FilteredMapServiceOption) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) TransactionId(com.navercorp.pinpoint.common.profiler.util.TransactionId) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 4 with 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 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;
}
Also used : ApplicationMap(com.navercorp.pinpoint.web.applicationmap.ApplicationMap) CallTreeIterator(com.navercorp.pinpoint.web.calltree.span.CallTreeIterator) SpanResult(com.navercorp.pinpoint.web.service.SpanResult) TransactionInfoViewModel(com.navercorp.pinpoint.web.view.TransactionInfoViewModel) RecordSet(com.navercorp.pinpoint.web.vo.callstacks.RecordSet) TransactionId(com.navercorp.pinpoint.common.util.TransactionId) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 5 with RecordSet

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;
}
Also used : Align(com.navercorp.pinpoint.web.calltree.span.Align) Record(com.navercorp.pinpoint.web.vo.callstacks.Record) RecordSet(com.navercorp.pinpoint.web.vo.callstacks.RecordSet)

Aggregations

RecordSet (com.navercorp.pinpoint.web.vo.callstacks.RecordSet)6 CallTreeIterator (com.navercorp.pinpoint.web.calltree.span.CallTreeIterator)4 SpanResult (com.navercorp.pinpoint.web.service.SpanResult)4 ColumnGetCount (com.navercorp.pinpoint.common.hbase.bo.ColumnGetCount)3 TransactionId (com.navercorp.pinpoint.common.profiler.util.TransactionId)3 SpanBo (com.navercorp.pinpoint.common.server.bo.SpanBo)3 GetMapping (org.springframework.web.bind.annotation.GetMapping)3 ApplicationMap (com.navercorp.pinpoint.web.applicationmap.ApplicationMap)2 TransactionInfoViewModel (com.navercorp.pinpoint.web.view.TransactionInfoViewModel)2 Record (com.navercorp.pinpoint.web.vo.callstacks.Record)2 TransactionId (com.navercorp.pinpoint.common.util.TransactionId)1 Align (com.navercorp.pinpoint.web.calltree.span.Align)1 SpanAlign (com.navercorp.pinpoint.web.calltree.span.SpanAlign)1 FilteredMapServiceOption (com.navercorp.pinpoint.web.service.FilteredMapServiceOption)1 TraceViewerDataViewModel (com.navercorp.pinpoint.web.view.TraceViewerDataViewModel)1 TransactionTimelineInfoViewModel (com.navercorp.pinpoint.web.view.TransactionTimelineInfoViewModel)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1 ServletUriComponentsBuilder (org.springframework.web.servlet.support.ServletUriComponentsBuilder)1