aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.gradle2
-rw-r--r--buildscripts/import-control.xml5
-rw-r--r--contrib/log_correlation/stackdriver/README.md3
-rw-r--r--contrib/log_correlation/stackdriver_demo/README.md9
-rw-r--r--contrib/log_correlation/stackdriver_demo/build.gradle36
-rw-r--r--contrib/log_correlation/stackdriver_demo/src/main/java/io/opencensus/contrib/logcorrelation/stackdriver/demo/OpenCensusTraceLoggingEnhancerDemo.java77
-rw-r--r--contrib/log_correlation/stackdriver_demo/src/main/resources/logback.xml16
-rw-r--r--settings.gradle3
8 files changed, 3 insertions, 148 deletions
diff --git a/build.gradle b/build.gradle
index 4ea99e64..e5bd13d4 100644
--- a/build.gradle
+++ b/build.gradle
@@ -181,7 +181,6 @@ subprojects {
findbugs_annotations: "com.google.code.findbugs:annotations:${findBugsVersion}",
google_auth: "com.google.auth:google-auth-library-credentials:${googleAuthVersion}",
google_cloud_logging: "com.google.cloud:google-cloud-logging:1.33.0",
- google_cloud_logging_logback: "com.google.cloud:google-cloud-logging-logback:0.48.0-alpha",
google_cloud_trace: "com.google.cloud:google-cloud-trace:${googleCloudVersion}",
zipkin_reporter: "io.zipkin.reporter2:zipkin-reporter:${zipkinReporterVersion}",
zipkin_urlconnection: "io.zipkin.reporter2:zipkin-sender-urlconnection:${zipkinReporterVersion}",
@@ -192,7 +191,6 @@ subprojects {
guava: "com.google.guava:guava:${guavaVersion}",
jsr305: "com.google.code.findbugs:jsr305:${findBugsVersion}",
signalfx_java: "com.signalfx.public:signalfx-java:${signalfxVersion}",
- slf4j: "org.slf4j:slf4j-api:1.7.25",
prometheus_simpleclient: "io.prometheus:simpleclient:${prometheusVersion}",
protobuf: "com.google.protobuf:protobuf-java:${protobufVersion}",
diff --git a/buildscripts/import-control.xml b/buildscripts/import-control.xml
index dfad9d58..9f168862 100644
--- a/buildscripts/import-control.xml
+++ b/buildscripts/import-control.xml
@@ -96,11 +96,6 @@ General guidelines on imports:
<subpackage name="logcorrelation.stackdriver">
<allow pkg="com.google.cloud"/>
<allow pkg="io.opencensus.trace"/>
- <subpackage name="demo">
- <allow pkg="io.opencensus.contrib.logcorrelation.stackdriver"/>
- <allow pkg="io.opencensus.exporter.trace.stackdriver"/>
- <allow pkg="org.slf4j"/>
- </subpackage>
</subpackage>
<subpackage name="zpages">
<allow pkg="com.sun.net.httpserver"/>
diff --git a/contrib/log_correlation/stackdriver/README.md b/contrib/log_correlation/stackdriver/README.md
index 0b43d8c2..5f4568da 100644
--- a/contrib/log_correlation/stackdriver/README.md
+++ b/contrib/log_correlation/stackdriver/README.md
@@ -4,3 +4,6 @@ This subproject is currently experimental. It provides a Stackdriver Logging Log
automatically adds tracing data to log entries. The LoggingEnhancer adds the trace ID, which allows
Stackdriver to display log entries associated with each trace or filter logs based on trace ID. It
currently also adds the span ID and sampling decision.
+
+TODO(sebright): Add a demo to https://github.com/census-ecosystem/opencensus-experiments and link to
+it.
diff --git a/contrib/log_correlation/stackdriver_demo/README.md b/contrib/log_correlation/stackdriver_demo/README.md
deleted file mode 100644
index ba922e0c..00000000
--- a/contrib/log_correlation/stackdriver_demo/README.md
+++ /dev/null
@@ -1,9 +0,0 @@
-# OpenCensus Stackdriver Log Correlation Demo
-
-An application that demonstrates log correlation in Stackdriver, using
-`opencensus-contrib-log-correlation-stackdriver`. The application contains SLF4J log statements and
-OpenCensus tracing instrumentation. It configures logging with a Logback XML configuration and
-exports logs using the
-[Stackdriver Logging Logback appender](https://cloud.google.com/logging/docs/setup/java#logback_appender).
-It also exports traces using `opencensus-exporter-trace-stackdriver`, so that Stackdriver can show
-the log entries associated with each trace.
diff --git a/contrib/log_correlation/stackdriver_demo/build.gradle b/contrib/log_correlation/stackdriver_demo/build.gradle
deleted file mode 100644
index ae6c9279..00000000
--- a/contrib/log_correlation/stackdriver_demo/build.gradle
+++ /dev/null
@@ -1,36 +0,0 @@
-description = 'OpenCensus Stackdriver Log Correlation Demo'
-
-apply plugin: 'java'
-
-[compileJava, compileTestJava].each() {
- it.sourceCompatibility = 1.7
- it.targetCompatibility = 1.7
-}
-
-dependencies {
- compile project(':opencensus-api'),
- project(':opencensus-contrib-log-correlation-stackdriver'),
- project(':opencensus-exporter-trace-stackdriver'),
- libraries.slf4j,
- libraries.google_cloud_logging_logback
-
- runtime project(':opencensus-impl-lite')
-
- signature "org.codehaus.mojo.signature:java18:+@signature"
-}
-
-apply plugin: 'application'
-
-startScripts.enabled = false
-
-task openCensusLogCorrelationStackdriverDemo(type: CreateStartScripts) {
- mainClassName = 'io.opencensus.contrib.logcorrelation.stackdriver.demo.OpenCensusTraceLoggingEnhancerDemo'
- applicationName = 'OpenCensusTraceLoggingEnhancerDemo'
- outputDir = new File(project.buildDir, 'tmp')
- classpath = jar.outputs.files + project.configurations.runtime
-}
-
-applicationDistribution.into('bin') {
- from(openCensusLogCorrelationStackdriverDemo)
- fileMode = 0755
-}
diff --git a/contrib/log_correlation/stackdriver_demo/src/main/java/io/opencensus/contrib/logcorrelation/stackdriver/demo/OpenCensusTraceLoggingEnhancerDemo.java b/contrib/log_correlation/stackdriver_demo/src/main/java/io/opencensus/contrib/logcorrelation/stackdriver/demo/OpenCensusTraceLoggingEnhancerDemo.java
deleted file mode 100644
index 3b7bef5f..00000000
--- a/contrib/log_correlation/stackdriver_demo/src/main/java/io/opencensus/contrib/logcorrelation/stackdriver/demo/OpenCensusTraceLoggingEnhancerDemo.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright 2018, OpenCensus Authors
- *
- * 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.contrib.logcorrelation.stackdriver.demo;
-
-import io.opencensus.common.Scope;
-import io.opencensus.contrib.logcorrelation.stackdriver.OpenCensusTraceLoggingEnhancer;
-import io.opencensus.exporter.trace.stackdriver.StackdriverTraceConfiguration;
-import io.opencensus.exporter.trace.stackdriver.StackdriverTraceExporter;
-import io.opencensus.trace.Sampler;
-import io.opencensus.trace.Tracer;
-import io.opencensus.trace.Tracing;
-import io.opencensus.trace.samplers.Samplers;
-import java.io.IOException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/** Demo for {@link OpenCensusTraceLoggingEnhancer}. */
-public final class OpenCensusTraceLoggingEnhancerDemo {
-
- // Use a high sampling probability to demonstrate tracing.
- private static final Sampler SAMPLER = Samplers.probabilitySampler(0.7);
-
- private static final Logger logger =
- LoggerFactory.getLogger(OpenCensusTraceLoggingEnhancerDemo.class.getName());
-
- private static final Tracer tracer = Tracing.getTracer();
-
- private OpenCensusTraceLoggingEnhancerDemo() {}
-
- /** Runs the demo. */
- public static void main(String[] args) throws IOException {
- StackdriverTraceExporter.createAndRegister(StackdriverTraceConfiguration.builder().build());
- try (Scope scope = tracer.spanBuilder("Demo.Main").setSampler(SAMPLER).startScopedSpan()) {
- pause();
- logger.warn("parent span log message 1");
- pause();
- doWork();
- pause();
- logger.info("parent span log message 2");
- pause();
- }
- Tracing.getExportComponent().shutdown();
- }
-
- private static void doWork() {
- try (Scope scope = tracer.spanBuilder("Demo.DoWork").startScopedSpan()) {
- pause();
- logger.info("child span log message 1");
- pause();
- logger.error("child span log message 2");
- pause();
- }
- }
-
- /** Sleeps for 500 ms to spread out the events on the trace. */
- private static void pause() {
- try {
- Thread.sleep(500);
- } catch (InterruptedException e) {
- // ignore
- }
- }
-}
diff --git a/contrib/log_correlation/stackdriver_demo/src/main/resources/logback.xml b/contrib/log_correlation/stackdriver_demo/src/main/resources/logback.xml
deleted file mode 100644
index 3c16ed8a..00000000
--- a/contrib/log_correlation/stackdriver_demo/src/main/resources/logback.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<!-- This configuration file is based on the example at
- https://github.com/GoogleCloudPlatform/google-cloud-java/tree/master/google-cloud-clients/google-cloud-contrib/google-cloud-logging-logback#usage -->
-<configuration>
- <appender name="CLOUD" class="com.google.cloud.logging.logback.LoggingAppender">
- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <level>INFO</level>
- </filter>
- <log>application.log</log>
- <enhancer>io.opencensus.contrib.logcorrelation.stackdriver.OpenCensusTraceLoggingEnhancer</enhancer>
- <flushLevel>WARN</flushLevel>
- </appender>
-
- <root level="info">
- <appender-ref ref="CLOUD" />
- </root>
-</configuration>
diff --git a/settings.gradle b/settings.gradle
index 6843355b..b8128f71 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -19,7 +19,6 @@ include ":opencensus-contrib-grpc-metrics"
include ":opencensus-contrib-grpc-util"
include ":opencensus-contrib-http-util"
include ":opencensus-contrib-log-correlation-stackdriver"
-include ":opencensus-contrib-log-correlation-stackdriver-demo"
include ":opencensus-contrib-monitored-resource-util"
// TODO(songya): uncomment this once classes were added to Metrics library.
//include ":opencensus-metrics"
@@ -37,8 +36,6 @@ project(':opencensus-contrib-grpc-util').projectDir = "$rootDir/contrib/grpc_uti
project(':opencensus-contrib-http-util').projectDir = "$rootDir/contrib/http_util" as File
project(':opencensus-contrib-log-correlation-stackdriver').projectDir =
"$rootDir/contrib/log_correlation/stackdriver" as File
-project(':opencensus-contrib-log-correlation-stackdriver-demo').projectDir =
- "$rootDir/contrib/log_correlation/stackdriver_demo" as File
project(':opencensus-contrib-monitored-resource-util').projectDir =
"$rootDir/contrib/monitored_resource_util" as File
project(':opencensus-exporter-trace-instana').projectDir =