Package io.opencensus.contrib.zpages
Class ZPageHandlers
- java.lang.Object
-
- io.opencensus.contrib.zpages.ZPageHandlers
-
@ThreadSafe public final class ZPageHandlers extends java.lang.ObjectA 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
Fields Modifier and Type Field Description private static intBACKLOGprivate static booleanisRunningSpanStoreInitializedprivate static java.util.logging.Loggerloggerprivate static java.lang.Objectmonitorprivate static ZPageHandlerrpczZpageHandlerprivate static com.sun.net.httpserver.HttpServerserverprivate static ZPageHandlerstatszZPageHandlerprivate static intSTOP_DELAYprivate static ZPageHandlertraceConfigzZPageHandlerprivate static ZPageHandlertracezZPageHandler
-
Constructor Summary
Constructors Modifier Constructor Description privateZPageHandlers()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static voidenableRunningSpanStore()static ZPageHandlergetRpczZpageHandler()Returns aZPageHandlerfor gRPC stats.static ZPageHandlergetStatszZPageHandler()static ZPageHandlergetTraceConfigzZPageHandler()Returns aZPageHandlerfor tracing config.static ZPageHandlergetTracezZPageHandler()Returns 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 Detail
-
BACKLOG
private static final int BACKLOG
- See Also:
- Constant Field Values
-
STOP_DELAY
private static final int STOP_DELAY
- See Also:
- Constant Field Values
-
logger
private static final java.util.logging.Logger logger
-
tracezZPageHandler
private static final ZPageHandler tracezZPageHandler
-
traceConfigzZPageHandler
private static final ZPageHandler traceConfigzZPageHandler
-
rpczZpageHandler
private static final ZPageHandler rpczZpageHandler
-
statszZPageHandler
private static final ZPageHandler statszZPageHandler
-
monitor
private static final java.lang.Object monitor
-
isRunningSpanStoreInitialized
private static volatile boolean isRunningSpanStoreInitialized
-
server
@Nullable private static com.sun.net.httpserver.HttpServer server
-
-
Method Detail
-
getTracezZPageHandler
public static ZPageHandler 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
public static ZPageHandler 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
public static ZPageHandler 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
public static ZPageHandler getStatszZPageHandler()
Returns aZPageHandlerfor all registeredViews andMeasures.Only
Cumulativeviews are exported.Views are grouped by directories.- Returns:
- a
ZPageHandlerfor all registeredViews andMeasures. - 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
public static void startHttpServerAndRegisterAll(int port) throws java.io.IOExceptionStarts 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:
java.lang.IllegalStateException- if the server is already started.java.io.IOException- if the server cannot bind to the requested address.- Since:
- 0.6
-
stop
private static void stop()
-
enableRunningSpanStore
private static void enableRunningSpanStore()
-
-