aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorBogdan Drutu <bdrutu@google.com>2017-08-16 18:56:27 -0700
committerGitHub <noreply@github.com>2017-08-16 18:56:27 -0700
commita77f1b63f3229caa850d17758dfe67c662538c9b (patch)
tree71fc02ecb5504f652bf43910a5c6fcc1394155d0 /examples
parent468ece14992f5ca91df4686c637ca8dcda48a26e (diff)
downloadplatform_external_opencensus-java-a77f1b63f3229caa850d17758dfe67c662538c9b.tar.gz
platform_external_opencensus-java-a77f1b63f3229caa850d17758dfe67c662538c9b.tar.bz2
platform_external_opencensus-java-a77f1b63f3229caa850d17758dfe67c662538c9b.zip
Add initial implementation of the tracez page. (#517)
* Add initial implementation of the tracez page. * Fix HTML when premature return. Add DOCTYPE and charset. * URLEncode the given spanName. * Build zpages only for java8. * Move Tester->ZPagesTester, add tests for query parsing. * Fix more comments.
Diffstat (limited to 'examples')
-rw-r--r--examples/build.gradle11
-rw-r--r--examples/src/main/java/io/opencensus/examples/zpages/ZPagesTester.java35
2 files changed, 45 insertions, 1 deletions
diff --git a/examples/build.gradle b/examples/build.gradle
index 5e45e846..2e31a145 100644
--- a/examples/build.gradle
+++ b/examples/build.gradle
@@ -8,7 +8,8 @@ tasks.withType(JavaCompile) {
dependencies {
compile project(':core'),
project(':opencensus-api'),
- project(':opencensus-trace-logging-exporter')
+ project(':opencensus-trace-logging-exporter'),
+ project(':opencensus-zpages')
runtime project(':core_impl_java'),
project(':opencensus-impl')
@@ -47,10 +48,18 @@ task multiSpansContextTracing(type: CreateStartScripts) {
classpath = jar.outputs.files + project.configurations.runtime
}
+task zPagesTester(type: CreateStartScripts) {
+ mainClassName = 'io.opencensus.examples.zpages.ZPagesTester'
+ applicationName = 'ZPagesTester'
+ outputDir = new File(project.buildDir, 'tmp')
+ classpath = jar.outputs.files + project.configurations.runtime
+}
+
applicationDistribution.into('bin') {
from(multiSpansTracing)
from(multiSpansScopedTracing)
from(multiSpansContextTracing)
from(statsRunner)
+ from(zPagesTester)
fileMode = 0755
} \ No newline at end of file
diff --git a/examples/src/main/java/io/opencensus/examples/zpages/ZPagesTester.java b/examples/src/main/java/io/opencensus/examples/zpages/ZPagesTester.java
new file mode 100644
index 00000000..1d59e3b4
--- /dev/null
+++ b/examples/src/main/java/io/opencensus/examples/zpages/ZPagesTester.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2017, Google Inc.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.opencensus.examples.zpages;
+
+import com.sun.net.httpserver.HttpServer;
+import io.opencensus.zpages.TracezHttpHandler;
+import java.net.InetSocketAddress;
+import java.util.logging.Logger;
+
+/**
+ * Testing only class for the UI.
+ */
+public class ZPagesTester {
+ private static final Logger logger = Logger.getLogger(ZPagesTester.class.getName());
+
+ /** Main method. */
+ public static void main(String[] args) throws Exception {
+ HttpServer server = HttpServer.create(new InetSocketAddress(8000), 10);
+ TracezHttpHandler.register(server);
+ server.start();
+ logger.info(server.getAddress().toString());
+ }
+
+}