@ThreadSafe public final class ZPageHandlers extends Object
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
}
}
Modifier and Type | Method and Description |
---|---|
static ZPageHandler |
getRpczZpageHandler()
Returns a
ZPageHandler for gRPC stats. |
static ZPageHandler |
getStatszZPageHandler()
Returns a
ZPageHandler for all registered View s and Measure s. |
static ZPageHandler |
getTraceConfigzZPageHandler()
Returns a
ZPageHandler for tracing config. |
static ZPageHandler |
getTracezZPageHandler()
Returns a
ZPageHandler for tracing debug. |
static void |
registerAllToHttpServer(com.sun.net.httpserver.HttpServer server)
Registers all pages to the given
HttpServer . |
static void |
startHttpServerAndRegisterAll(int port)
Starts an
HttpServer and registers all pages to it. |
public static ZPageHandler getTracezZPageHandler()
ZPageHandler
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 update RunningSpanStore
again.
ZPageHandler
for tracing debug.public static ZPageHandler getTraceConfigzZPageHandler()
ZPageHandler
for tracing config. The page displays information about all
active configuration and allow changing the active configuration.ZPageHandler
for tracing config.public static ZPageHandler getRpczZpageHandler()
ZPageHandler
for gRPC stats.
It prints a summary table which contains rows for each gRPC method.
ZPageHandler
for gRPC stats.public static ZPageHandler getStatszZPageHandler()
ZPageHandler
for all registered View
s and Measure
s.
Only Cumulative
views are exported. View
s are grouped by directories.
ZPageHandler
for all registered View
s and Measure
s.public static void registerAllToHttpServer(com.sun.net.httpserver.HttpServer server)
HttpServer
.server
- the server that exports the tracez page.public static void startHttpServerAndRegisterAll(int port) throws IOException
HttpServer
and registers all pages to it. When the JVM shuts down the server
is stopped.
Users must call this function only once per process.
port
- the port used to bind the HttpServer
.IllegalStateException
- if the server is already started.IOException
- if the server cannot bind to the requested address.