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 intprivate static booleanprivate static final Loggerprivate static final Objectprivate static final ZPageHandlerprivate static com.sun.net.httpserver.HttpServerprivate static final ZPageHandlerprivate static final intprivate static final ZPageHandlerprivate static final ZPageHandler -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidstatic ZPageHandlerReturns aZPageHandlerfor gRPC stats.static ZPageHandlerstatic ZPageHandlerReturns aZPageHandlerfor tracing config.static ZPageHandlerReturns aZPageHandlerfor tracing debug.static voidregisterAllToHttpServer(com.sun.net.httpserver.HttpServer server) Registers all pages to the givenHttpServer.static voidstartHttpServerAndRegisterAll(int port) Starts anHttpServerand registers all pages to it.private static voidstop()
-
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 aZPageHandlerfor 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,
RunningSpanStorewill be enabled automatically. Subsequent calls won't updateRunningSpanStoreagain.- Returns:
- a
ZPageHandlerfor tracing debug. - Since:
- 0.6
-
getTraceConfigzZPageHandler
Returns aZPageHandlerfor tracing config. The page displays information about all active configuration and allow changing the active configuration.- Returns:
- a
ZPageHandlerfor tracing config. - Since:
- 0.6
-
getRpczZpageHandler
Returns aZPageHandlerfor gRPC stats.It prints a summary table which contains rows for each gRPC method.
- Returns:
- a
ZPageHandlerfor gRPC stats. - Since:
- 0.12.0
-
getStatszZPageHandler
-
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 anHttpServerand 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()
-