Class TracezZPageHandler
java.lang.Object
io.opencensus.contrib.zpages.ZPageHandler
io.opencensus.contrib.zpages.TracezZPageHandler
HTML page formatter for tracing debug. The page displays information about all active spans and
all sampled spans based on latency and errors.
It prints a summary table which contains one row for each span name and data about number of active and sampled spans.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static enumprivate static final classprivate static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Map<SampledSpanStore.LatencyBucketBoundaries, String> private static final Stringprivate final RunningSpanStoreprivate static final Stringprivate final SampledSpanStoreprivate static final Tracerprivate static final Stringprivate static final String -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateTracezZPageHandler(RunningSpanStore runningSpanStore, SampledSpanStore sampledSpanStore) -
Method Summary
Modifier and TypeMethodDescriptionprivate static StringattributeValueToString(AttributeValue attributeValue) private static Map<SampledSpanStore.LatencyBucketBoundaries, String> private static <T> TcastNonNull(T arg) (package private) static TracezZPageHandlercreate(RunningSpanStore runningSpanStore, SampledSpanStore sampledSpanStore) Constructs a newTracezZPageHandler.private static longdurationToNanos(Duration duration) voidemitHtml(Map<String, String> queryMap, OutputStream outputStream) Emits the HTML generated page to theoutputStream.private voidemitHtmlBody(Map<String, String> queryMap, PrintWriter out) private static voidemitLegend(PrintWriter out) private static voidemitSingleCell(PrintWriter out, Formatter formatter, String spanName, int numSamples, TracezZPageHandler.RequestType type, int subtype) private static voidemitSingleSpan(Formatter formatter, SpanData span) private static voidemitSpanNameAndCountPages(Formatter formatter, String spanName, int returnedNum, TracezZPageHandler.RequestType type) private static voidemitSpans(PrintWriter out, Formatter formatter, Collection<SpanData> spans) Emits the list of SampledRequets with a header.private static voidemitStyle(PrintWriter out) private voidemitSummaryTable(PrintWriter out, Formatter formatter) private static voidemitSummaryTableHeader(PrintWriter out, Formatter formatter) Returns the URL path that should be used to register this page.private static StringlatencyBucketBoundariesToString(SampledSpanStore.LatencyBucketBoundaries latencyBucketBoundaries) private static StringrenderAnnotation(Annotation annotation) private static StringrenderAttributes(Map<String, AttributeValue> attributes) private static StringrenderNetworkEvents(NetworkEvent networkEvent) private static StringrenderStatus(Status status)
-
Field Details
-
TRACEZ_URL
- See Also:
-
tracer
-
ZEBRA_STRIPE_COLOR
- See Also:
-
SAMPLED_TRACE_ID_COLOR
- See Also:
-
NOT_SAMPLED_TRACE_ID_COLOR
- See Also:
-
HEADER_SPAN_NAME
- See Also:
-
HEADER_SAMPLES_TYPE
- See Also:
-
HEADER_SAMPLES_SUB_TYPE
- See Also:
-
LATENCY_BUCKET_BOUNDARIES_STRING_MAP
private static final Map<SampledSpanStore.LatencyBucketBoundaries, String> LATENCY_BUCKET_BOUNDARIES_STRING_MAP -
runningSpanStore
-
sampledSpanStore
-
returnToString
-
-
Constructor Details
-
TracezZPageHandler
private TracezZPageHandler(@Nullable RunningSpanStore runningSpanStore, @Nullable SampledSpanStore sampledSpanStore)
-
-
Method Details
-
create
static TracezZPageHandler create(@Nullable RunningSpanStore runningSpanStore, @Nullable SampledSpanStore sampledSpanStore) Constructs a newTracezZPageHandler.- Parameters:
runningSpanStore- the instance of theRunningSpanStoreto be used.sampledSpanStore- the instance of theSampledSpanStoreto be used.- Returns:
- a new
TracezZPageHandler.
-
getUrlPath
Description copied from class:ZPageHandlerReturns the URL path that should be used to register this page.- Specified by:
getUrlPathin classZPageHandler- Returns:
- the URL path that should be used to register this page.
-
emitStyle
-
emitHtml
Description copied from class:ZPageHandlerEmits the HTML generated page to theoutputStream.- Specified by:
emitHtmlin classZPageHandler- Parameters:
queryMap- the query components map.outputStream- the outputOutputStream.
-
emitHtmlBody
private void emitHtmlBody(Map<String, String> queryMap, PrintWriter out) throws UnsupportedEncodingException- Throws:
UnsupportedEncodingException
-
emitSpanNameAndCountPages
private static void emitSpanNameAndCountPages(Formatter formatter, String spanName, int returnedNum, TracezZPageHandler.RequestType type) -
emitSpans
Emits the list of SampledRequets with a header. -
emitSingleSpan
-
castNonNull
-
emitSummaryTable
private void emitSummaryTable(PrintWriter out, Formatter formatter) throws UnsupportedEncodingException - Throws:
UnsupportedEncodingException
-
emitSummaryTableHeader
-
emitSingleCell
private static void emitSingleCell(PrintWriter out, Formatter formatter, String spanName, int numSamples, TracezZPageHandler.RequestType type, int subtype) throws UnsupportedEncodingException - Throws:
UnsupportedEncodingException
-
emitLegend
-
buildLatencyBucketBoundariesStringMap
private static Map<SampledSpanStore.LatencyBucketBoundaries, String> buildLatencyBucketBoundariesStringMap() -
durationToNanos
-
latencyBucketBoundariesToString
private static String latencyBucketBoundariesToString(SampledSpanStore.LatencyBucketBoundaries latencyBucketBoundaries) -
renderNetworkEvents
-
renderAnnotation
-
renderStatus
-
renderAttributes
-
attributeValueToString
-