From 816dfda755e2697430c6ec81ae2a2098df7b7190 Mon Sep 17 00:00:00 2001 From: losalex Date: Thu, 3 Nov 2022 14:08:01 -0700 Subject: [PATCH 1/5] feat: Add support for instrumentation version annotations --- .github/release-please.yml | 2 ++ .../main/java/com/google/cloud/logging/Instrumentation.java | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/release-please.yml b/.github/release-please.yml index 5d9d5cc3f..1567d8eca 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -10,3 +10,5 @@ branches: handleGHRelease: true releaseType: java-backport branch: 3.7.x +extraFiles: + - src/main/java/com/google/cloud/logging/Instrumentation.java diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/Instrumentation.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/Instrumentation.java index f26d4003c..4c3e44bf6 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/Instrumentation.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/Instrumentation.java @@ -37,7 +37,7 @@ public final class Instrumentation { public static final String INSTRUMENTATION_NAME_KEY = "name"; public static final String INSTRUMENTATION_VERSION_KEY = "version"; public static final String JAVA_LIBRARY_NAME_PREFIX = "java"; - public static final String DEFAULT_INSTRUMENTATION_VERSION = "UNKNOWN"; + public static final String DEFAULT_INSTRUMENTATION_VERSION = "1.0.0"; // {x-release-please-version} public static final String INSTRUMENTATION_LOG_NAME = "diagnostic-log"; public static final int MAX_DIAGNOSTIC_VALUE_LENGTH = 14; public static final int MAX_DIAGNOSTIC_ENTIES = 3; @@ -220,7 +220,7 @@ static boolean setInstrumentationStatus(boolean value) { * Returns a library version associated with given class * * @param libraryClass {Class} The class to be used to determine a library version - * @return The version number string for given class or "UNKNOWN" if class library version cannot + * @return The version number string for given class or DEFAULT_INSTRUMENTATION_VERSION if class library version cannot * be detected */ public static String getLibraryVersion(Class libraryClass) { From b2ef91897e54366f5f4c67111628f03ebf27eca5 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 3 Nov 2022 21:11:17 +0000 Subject: [PATCH 2/5] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- README.md | 4 ++-- .../java/com/google/cloud/logging/Instrumentation.java | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d61e2423c..2b03b903f 100644 --- a/README.md +++ b/README.md @@ -58,13 +58,13 @@ implementation 'com.google.cloud:google-cloud-logging' If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-logging:3.12.0' +implementation 'com.google.cloud:google-cloud-logging:3.12.1' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-logging" % "3.12.0" +libraryDependencies += "com.google.cloud" % "google-cloud-logging" % "3.12.1" ``` ## Authentication diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/Instrumentation.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/Instrumentation.java index 4c3e44bf6..43aabd224 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/Instrumentation.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/Instrumentation.java @@ -37,7 +37,8 @@ public final class Instrumentation { public static final String INSTRUMENTATION_NAME_KEY = "name"; public static final String INSTRUMENTATION_VERSION_KEY = "version"; public static final String JAVA_LIBRARY_NAME_PREFIX = "java"; - public static final String DEFAULT_INSTRUMENTATION_VERSION = "1.0.0"; // {x-release-please-version} + public static final String DEFAULT_INSTRUMENTATION_VERSION = + "1.0.0"; // {x-release-please-version} public static final String INSTRUMENTATION_LOG_NAME = "diagnostic-log"; public static final int MAX_DIAGNOSTIC_VALUE_LENGTH = 14; public static final int MAX_DIAGNOSTIC_ENTIES = 3; @@ -220,8 +221,8 @@ static boolean setInstrumentationStatus(boolean value) { * Returns a library version associated with given class * * @param libraryClass {Class} The class to be used to determine a library version - * @return The version number string for given class or DEFAULT_INSTRUMENTATION_VERSION if class library version cannot - * be detected + * @return The version number string for given class or DEFAULT_INSTRUMENTATION_VERSION if class + * library version cannot be detected */ public static String getLibraryVersion(Class libraryClass) { String libraryVersion = GaxProperties.getLibraryVersion(libraryClass); From 3f230f22ca36cb361cd80c4bac4f4fabcec24f73 Mon Sep 17 00:00:00 2001 From: losalex Date: Thu, 3 Nov 2022 14:27:32 -0700 Subject: [PATCH 3/5] fix test --- .../test/java/com/google/cloud/logging/InstrumentationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google-cloud-logging/src/test/java/com/google/cloud/logging/InstrumentationTest.java b/google-cloud-logging/src/test/java/com/google/cloud/logging/InstrumentationTest.java index e1aa67f48..5fc4a1295 100644 --- a/google-cloud-logging/src/test/java/com/google/cloud/logging/InstrumentationTest.java +++ b/google-cloud-logging/src/test/java/com/google/cloud/logging/InstrumentationTest.java @@ -41,7 +41,7 @@ public class InstrumentationTest { private static final LogEntry STRING_ENTRY = LogEntry.newBuilder(STRING_PAYLOAD).build(); private static final String JAVA_OTHER_NAME = "java-other"; private static final String JAVA_INVALID_NAME = "no-java-name"; - private static final String JAVA_OTHER_VERSION = "1.0.0"; + private static final String JAVA_OTHER_VERSION = "0.0.0"; @Test public void testInstrumentationGenerated() { From ce286a544c53e0ce2060ad71eda7b125ffa8cce1 Mon Sep 17 00:00:00 2001 From: losalex Date: Thu, 3 Nov 2022 16:13:02 -0700 Subject: [PATCH 4/5] Update version --- .../src/main/java/com/google/cloud/logging/Instrumentation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/Instrumentation.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/Instrumentation.java index 43aabd224..d5d4d627f 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/Instrumentation.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/Instrumentation.java @@ -38,7 +38,7 @@ public final class Instrumentation { public static final String INSTRUMENTATION_VERSION_KEY = "version"; public static final String JAVA_LIBRARY_NAME_PREFIX = "java"; public static final String DEFAULT_INSTRUMENTATION_VERSION = - "1.0.0"; // {x-release-please-version} + "1.0.0"; // {x-version-update:google-cloud-logging:current} public static final String INSTRUMENTATION_LOG_NAME = "diagnostic-log"; public static final int MAX_DIAGNOSTIC_VALUE_LENGTH = 14; public static final int MAX_DIAGNOSTIC_ENTIES = 3; From 03729d497ba1971477dfd4fe14634ccf8b747aa1 Mon Sep 17 00:00:00 2001 From: losalex Date: Fri, 4 Nov 2022 09:23:01 -0700 Subject: [PATCH 5/5] Change versioning tags --- .../main/java/com/google/cloud/logging/Instrumentation.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/Instrumentation.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/Instrumentation.java index d5d4d627f..ff291ca6a 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/Instrumentation.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/Instrumentation.java @@ -37,8 +37,9 @@ public final class Instrumentation { public static final String INSTRUMENTATION_NAME_KEY = "name"; public static final String INSTRUMENTATION_VERSION_KEY = "version"; public static final String JAVA_LIBRARY_NAME_PREFIX = "java"; - public static final String DEFAULT_INSTRUMENTATION_VERSION = - "1.0.0"; // {x-version-update:google-cloud-logging:current} + // {x-version-update-start:google-cloud-logging:current} + public static final String DEFAULT_INSTRUMENTATION_VERSION = "1.0.0"; + // {x-version-update-end} public static final String INSTRUMENTATION_LOG_NAME = "diagnostic-log"; public static final int MAX_DIAGNOSTIC_VALUE_LENGTH = 14; public static final int MAX_DIAGNOSTIC_ENTIES = 3;