diff --git a/build.gradle b/build.gradle index ccc0ee2..01cf6e1 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ apply plugin: "net.ltgt.errorprone" apply plugin: "signing" group = "io.orijtech.integrations" -version = "0.0.2" // CURRENT_OCJDBC_VERSION +version = "0.0.4" // CURRENT_OCJDBC_VERSION sourceCompatibility = 1.8 targetCompatibility = 1.8 @@ -38,7 +38,7 @@ buildscript { } } -def opencensusVersion = '0.16.1' +def opencensusVersion = '0.21.0' def errorProneVersion = '2.3.1' def findBugsJsr305Version = '3.0.2' diff --git a/src/main/java/io/opencensus/integration/jdbc/Observability.java b/src/main/java/io/opencensus/integration/jdbc/Observability.java index d589058..ebdd464 100644 --- a/src/main/java/io/opencensus/integration/jdbc/Observability.java +++ b/src/main/java/io/opencensus/integration/jdbc/Observability.java @@ -27,6 +27,8 @@ import io.opencensus.tags.TagContext; import io.opencensus.tags.TagContextBuilder; import io.opencensus.tags.TagKey; +import io.opencensus.tags.TagMetadata; +import io.opencensus.tags.TagMetadata.TagTtl; import io.opencensus.tags.TagValue; import io.opencensus.tags.Tagger; import io.opencensus.tags.Tags; @@ -107,6 +109,8 @@ private Observability() {} 500000.0))); static final Aggregation COUNT = Aggregation.Count.create(); + static final TagMetadata TAG_METADATA_TTL_UNLIMITED = + TagMetadata.create(TagTtl.UNLIMITED_PROPAGATION); static final View SQL_CLIENT_LATENCY_VIEW = View.create( @@ -190,13 +194,15 @@ void end() { // Finally record the latency of the entire call, // as well as "status": "OK" for non-error calls. TagContextBuilder tagContextBuilder = tagger.currentBuilder(); - tagContextBuilder.put(JAVA_SQL_METHOD, TagValue.create(this.method)); + tagContextBuilder.put( + JAVA_SQL_METHOD, TagValue.create(this.method), TAG_METADATA_TTL_UNLIMITED); if (recordedError == null) { - tagContextBuilder.put(JAVA_SQL_STATUS, VALUE_OK); + tagContextBuilder.put(JAVA_SQL_STATUS, VALUE_OK, TAG_METADATA_TTL_UNLIMITED); } else { - tagContextBuilder.put(JAVA_SQL_ERROR, TagValue.create(recordedError)); - tagContextBuilder.put(JAVA_SQL_STATUS, VALUE_ERROR); + tagContextBuilder.put( + JAVA_SQL_ERROR, TagValue.create(recordedError), TAG_METADATA_TTL_UNLIMITED); + tagContextBuilder.put(JAVA_SQL_STATUS, VALUE_ERROR, TAG_METADATA_TTL_UNLIMITED); } long totalTimeNs = System.nanoTime() - this.startTimeNs;