Package io.opencensus.contrib.zpages
Class ZPageHandlers
java.lang.Object
io.opencensus.contrib.zpages.ZPageHandlers
A collection of HTML pages to display stats and trace data and allow library configuration
control.
Example usage with private HttpServer
:
public class Main {
public static void main(String[] args) throws Exception {
ZPageHandlers.startHttpServerAndRegisterAll(8000);
... // do work
}
}
Example usage with shared HttpServer
:
public class Main {
public static void main(String[] args) throws Exception {
HttpServer server = HttpServer.create(new InetSocketAddress(8000), 10);
ZPageHandlers.registerAllToHttpServer(server);
server.start();
... // do work
}
}
- Since:
- 0.6
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private static boolean
private static final Logger
private static final Object
private static final ZPageHandler
private static com.sun.net.httpserver.HttpServer
private static final ZPageHandler
private static final int
private static final ZPageHandler
private static final ZPageHandler
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
static ZPageHandler
Returns aZPageHandler
for gRPC stats.static ZPageHandler
static ZPageHandler
Returns aZPageHandler
for tracing config.static ZPageHandler
Returns aZPageHandler
for tracing debug.static void
registerAllToHttpServer
(com.sun.net.httpserver.HttpServer server) Registers all pages to the givenHttpServer
.static void
startHttpServerAndRegisterAll
(int port) Starts anHttpServer
and registers all pages to it.private static void
stop()
-
Field Details
-
BACKLOG
private static final int BACKLOG- See Also:
-
STOP_DELAY
private static final int STOP_DELAY- See Also:
-
logger
-
tracezZPageHandler
-
traceConfigzZPageHandler
-
rpczZpageHandler
-
statszZPageHandler
-
monitor
-
isRunningSpanStoreInitialized
private static volatile boolean isRunningSpanStoreInitialized -
server
-
-
Constructor Details
-
ZPageHandlers
private ZPageHandlers()
-
-
Method Details
-
getTracezZPageHandler
Returns aZPageHandler
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.
If no sampled spans based on latency and error codes are available for a given name, make sure that the span name is registered to the
SampledSpanStore
.When this method is called for the first time,
RunningSpanStore
will be enabled automatically. Subsequent calls won't updateRunningSpanStore
again.- Returns:
- a
ZPageHandler
for tracing debug. - Since:
- 0.6
-
getTraceConfigzZPageHandler
Returns aZPageHandler
for tracing config. The page displays information about all active configuration and allow changing the active configuration.- Returns:
- a
ZPageHandler
for tracing config. - Since:
- 0.6
-
getRpczZpageHandler
Returns aZPageHandler
for gRPC stats.It prints a summary table which contains rows for each gRPC method.
- Returns:
- a
ZPageHandler
for gRPC stats. - Since:
- 0.12.0
-
getStatszZPageHandler
Returns aZPageHandler
for all registeredView
s andMeasure
s.Only
Cumulative
views are exported.View
s are grouped by directories.- Returns:
- a
ZPageHandler
for all registeredView
s andMeasure
s. - Since:
- 0.12.0
-
registerAllToHttpServer
public static void registerAllToHttpServer(com.sun.net.httpserver.HttpServer server) Registers all pages to the givenHttpServer
.- Parameters:
server
- the server that exports the tracez page.- Since:
- 0.6
-
startHttpServerAndRegisterAll
Starts anHttpServer
and registers all pages to it. When the JVM shuts down the server is stopped.Users must call this function only once per process.
- Parameters:
port
- the port used to bind theHttpServer
.- Throws:
IllegalStateException
- if the server is already started.IOException
- if the server cannot bind to the requested address.- Since:
- 0.6
-
stop
private static void stop() -
enableRunningSpanStore
private static void enableRunningSpanStore()
-