gpt4 book ai didi

io.opencensus.contrib.zpages.ZPageHandlers.startHttpServerAndRegisterAll()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 16:43:31 25 4
gpt4 key购买 nike

本文整理了Java中io.opencensus.contrib.zpages.ZPageHandlers.startHttpServerAndRegisterAll()方法的一些代码示例,展示了ZPageHandlers.startHttpServerAndRegisterAll()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZPageHandlers.startHttpServerAndRegisterAll()方法的具体详情如下:
包路径:io.opencensus.contrib.zpages.ZPageHandlers
类名称:ZPageHandlers
方法名:startHttpServerAndRegisterAll

ZPageHandlers.startHttpServerAndRegisterAll介绍

[英]Starts an 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.
[中]启动HttpServer并向其注册所有页面。当JVM关闭时,服务器停止。
每个进程用户只能调用此函数一次。

代码示例

代码示例来源:origin: GoogleCloudPlatform/java-docs-samples

ZPageHandlers.startHttpServerAndRegisterAll(8080);

代码示例来源:origin: GoogleCloudPlatform/cloud-bigtable-examples

public static void main(String[] args) throws IOException, InterruptedException {
 // Consult system properties to get project/instance
 String projectId = requiredProperty("bigtable.projectID");
 String instanceId = requiredProperty("bigtable.instanceID");
 // Force tracing for every request for demo purposes.  Use the default settings
 // in most cases.
 Tracing.getTraceConfig().updateActiveTraceParams(
   TraceParams.DEFAULT.toBuilder().setSampler(Samplers.probabilitySampler(1)).build());
 StackdriverTraceExporter.createAndRegister(
     StackdriverTraceConfiguration.builder()
       .setProjectId(projectId)
       .build());
 // Enable stats exporter to Stackdriver with a 5 second export time.
 // Production settings may vary.
 StackdriverStatsExporter.createAndRegister(
     StackdriverStatsConfiguration.builder()
        .setProjectId(projectId)
        .setExportInterval(Duration.create(5, 0))
        .build());
 RpcViews.registerAllViews();
 // HBase Bigtable specific setup for zpages
 HBaseTracingUtilities.setupTracingConfig();
 // Start a web server on port 8080 for tracing data
 ZPageHandlers.startHttpServerAndRegisterAll(8080);
 doHelloWorld(projectId, instanceId);
 System.out.println("Sleeping for 1 minute so that you can view http://localhost:8080/tracez");
 // Sleep for 1 minute.
 Thread.sleep(TimeUnit.MINUTES.toMillis(1));
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com