/** * Returns descriptive reference for a span if one is provided. * * @param span * span * @return Reference more descriptive * @see Reference more descriptive */ public static String getDescriptiveReference(Span span) { String referenceType = span.getReferenceType(); if (References.CHILD_OF.equals(referenceType)) { return "Synchronous"; } else if (References.FOLLOWS_FROM.equals(referenceType)) { return "Non-Synchronous"; } return "N/A"; }
/** * Returns whether the given element is considered as asynchronous. It will return always * <code>false</code> if the type is not {@link TreeElementType#SPAN}. * * @param element * the element to check * @return <code>true</code> if the element is considered as asynchronous */ public static boolean isConsideredAsync(InvocationTreeElement element) { if (!element.isSpan()) { return false; } return References.FOLLOWS_FROM.equals(((Span) element.getDataElement()).getReferenceType()); } }
/** * Returns span image based on propagation and reference type. * * @param span * Span * @param resourceManager * resource manager * @return image */ public static Image getSpanImage(Span span, ResourceManager resourceManager) { Image propagationImage = getPropagationImage(span.getPropagationType()); if (!span.isCaller() && !References.FOLLOWS_FROM.equals(span.getReferenceType())) { return propagationImage; } else { return getOverlayedImage(propagationImage, resourceManager, 1, getReferenceImage(span.getReferenceType())); } }
if (null != span.getReferenceType()) { table.addContentRow("Reference:", null, new DetailsCellContent[] { new DetailsCellContent(ImageFormatter.getReferenceImage(span.getReferenceType()), TextFormatter.getDescriptiveReference(span)) });
/** * Calculates the duration starting from this invocation sequence data element. Includes span * duration as last resource if the span ident exists on the data. * * @param data * the <code>InvocationSequenceData</code> object. * @param spanService * Span service providing the additional span information if needed. * @return the duration starting from this invocation sequence data element. */ public static double calculateDuration(InvocationSequenceData data, ISpanService spanService) { if (InvocationSequenceDataHelper.hasTimerData(data)) { return data.getTimerData().getDuration(); } else if (InvocationSequenceDataHelper.hasSQLData(data)) { return data.getSqlStatementData().getDuration(); } else if ((null != spanService) && hasSpanIdent(data)) { Span span = spanService.get(data.getSpanIdent()); if ((span != null) && !References.FOLLOWS_FROM.equals(span.getReferenceType())) { return span.getDuration(); } } if (InvocationSequenceDataHelper.isRootElementInSequence(data)) { return data.getDuration(); } return -1.0d; }