aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--RELEASING.md1
-rw-r--r--api/src/main/java/io/opencensus/common/OpenCensusLibraryInformation.java29
-rw-r--r--exporters/trace_stackdriver/src/main/java/io/opencensus/exporter/trace/stackdriver/StackdriverV1ExporterHandler.java6
3 files changed, 36 insertions, 0 deletions
diff --git a/RELEASING.md b/RELEASING.md
index 8f858f18..21531b31 100644
--- a/RELEASING.md
+++ b/RELEASING.md
@@ -64,6 +64,7 @@ token](https://help.github.com/articles/creating-a-personal-access-token-for-the
$ MAJOR=0 MINOR=4 PATCH=0 # Set appropriately for new release
$ VERSION_FILES=(
build.gradle
+ api/src/main/java/io/opencensus/common/OpenCensusLibraryInformation.java
)
$ git checkout -b v$MAJOR.$MINOR.x master
$ git push upstream v$MAJOR.$MINOR.x
diff --git a/api/src/main/java/io/opencensus/common/OpenCensusLibraryInformation.java b/api/src/main/java/io/opencensus/common/OpenCensusLibraryInformation.java
new file mode 100644
index 00000000..e2548651
--- /dev/null
+++ b/api/src/main/java/io/opencensus/common/OpenCensusLibraryInformation.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2016-17, 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.common;
+
+/**
+ * Class holder for all common constants (such as the version) for the OpenCensus Java library.
+ */
+@ExperimentalApi
+public final class OpenCensusLibraryInformation {
+
+ /**
+ * The current version of the OpenCensus Java library.
+ */
+ public static final String VERSION = "0.8.0-SNAPSHOT"; // CURRENT_OPENCENSUS_VERSION
+}
diff --git a/exporters/trace_stackdriver/src/main/java/io/opencensus/exporter/trace/stackdriver/StackdriverV1ExporterHandler.java b/exporters/trace_stackdriver/src/main/java/io/opencensus/exporter/trace/stackdriver/StackdriverV1ExporterHandler.java
index c25072ad..5b195873 100644
--- a/exporters/trace_stackdriver/src/main/java/io/opencensus/exporter/trace/stackdriver/StackdriverV1ExporterHandler.java
+++ b/exporters/trace_stackdriver/src/main/java/io/opencensus/exporter/trace/stackdriver/StackdriverV1ExporterHandler.java
@@ -30,6 +30,7 @@ import com.google.devtools.cloudtrace.v1.Traces;
import io.opencensus.common.Duration;
import io.opencensus.common.Function;
import io.opencensus.common.Functions;
+import io.opencensus.common.OpenCensusLibraryInformation;
import io.opencensus.common.Timestamp;
import io.opencensus.trace.Annotation;
import io.opencensus.trace.AttributeValue;
@@ -58,6 +59,9 @@ final class StackdriverV1ExporterHandler extends SpanExporter.Handler {
private static final String STATUS_DESCRIPTION = "g.co/status/description";
private static final String ANNOTATION_LABEL = "ANNOTATION-";
private static final String NETWORK_EVENT_LABEL = "NETWORK-";
+ private static final String AGENT_LABEL_KEY = "g.co/agent";
+ private static final String AGENT_LABEL_VALUE =
+ "opencensus-java [" + OpenCensusLibraryInformation.VERSION + "]";
private final String projectId;
private final TraceServiceClient traceServiceClient;
@@ -124,6 +128,8 @@ final class StackdriverV1ExporterHandler extends SpanExporter.Handler {
spanBuilder.putLabels(STATUS_DESCRIPTION, spanData.getStatus().getDescription());
}
+ spanBuilder.putLabels(AGENT_LABEL_KEY, AGENT_LABEL_VALUE);
+
Trace.Builder traceBuilder =
Trace.newBuilder()
.setProjectId(projectId)