Package io.opencensus.contrib.zpages
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 enum
private static final class
private static final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
private static final String
private static final String
private static final Map
<SampledSpanStore.LatencyBucketBoundaries, String> private static final String
private final RunningSpanStore
private static final String
private final SampledSpanStore
private static final Tracer
private static final String
private static final String
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
TracezZPageHandler
(RunningSpanStore runningSpanStore, SampledSpanStore sampledSpanStore) -
Method Summary
Modifier and TypeMethodDescriptionprivate static String
attributeValueToString
(AttributeValue attributeValue) private static Map
<SampledSpanStore.LatencyBucketBoundaries, String> private static <T> T
castNonNull
(T arg) (package private) static TracezZPageHandler
create
(RunningSpanStore runningSpanStore, SampledSpanStore sampledSpanStore) Constructs a newTracezZPageHandler
.private static long
durationToNanos
(Duration duration) void
emitHtml
(Map<String, String> queryMap, OutputStream outputStream) Emits the HTML generated page to theoutputStream
.private void
emitHtmlBody
(Map<String, String> queryMap, PrintWriter out) private static void
emitLegend
(PrintWriter out) private static void
emitSingleCell
(PrintWriter out, Formatter formatter, String spanName, int numSamples, TracezZPageHandler.RequestType type, int subtype) private static void
emitSingleSpan
(Formatter formatter, SpanData span) private static void
emitSpanNameAndCountPages
(Formatter formatter, String spanName, int returnedNum, TracezZPageHandler.RequestType type) private static void
emitSpans
(PrintWriter out, Formatter formatter, Collection<SpanData> spans) Emits the list of SampledRequets with a header.private static void
emitStyle
(PrintWriter out) private void
emitSummaryTable
(PrintWriter out, Formatter formatter) private static void
emitSummaryTableHeader
(PrintWriter out, Formatter formatter) Returns the URL path that should be used to register this page.private static String
latencyBucketBoundariesToString
(SampledSpanStore.LatencyBucketBoundaries latencyBucketBoundaries) private static String
renderAnnotation
(Annotation annotation) private static String
renderAttributes
(Map<String, AttributeValue> attributes) private static String
renderNetworkEvents
(NetworkEvent networkEvent) private static String
renderStatus
(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 theRunningSpanStore
to be used.sampledSpanStore
- the instance of theSampledSpanStore
to be used.- Returns:
- a new
TracezZPageHandler
.
-
getUrlPath
Description copied from class:ZPageHandler
Returns the URL path that should be used to register this page.- Specified by:
getUrlPath
in classZPageHandler
- Returns:
- the URL path that should be used to register this page.
-
emitStyle
-
emitHtml
Description copied from class:ZPageHandler
Emits the HTML generated page to theoutputStream
.- Specified by:
emitHtml
in 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
-