Skip to content

Commit 0931446

Browse files
feat: Add support for instrumentation version annotations (#1179)
* feat: Add support for instrumentation version annotations * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * fix test * Update version * Change versioning tags Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 1830525 commit 0931446

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

.github/release-please.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ branches:
1010
handleGHRelease: true
1111
releaseType: java-backport
1212
branch: 3.7.x
13+
extraFiles:
14+
- src/main/java/com/google/cloud/logging/Instrumentation.java

google-cloud-logging/src/main/java/com/google/cloud/logging/Instrumentation.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ public final class Instrumentation {
3737
public static final String INSTRUMENTATION_NAME_KEY = "name";
3838
public static final String INSTRUMENTATION_VERSION_KEY = "version";
3939
public static final String JAVA_LIBRARY_NAME_PREFIX = "java";
40-
public static final String DEFAULT_INSTRUMENTATION_VERSION = "UNKNOWN";
40+
// {x-version-update-start:google-cloud-logging:current}
41+
public static final String DEFAULT_INSTRUMENTATION_VERSION = "1.0.0";
42+
// {x-version-update-end}
4143
public static final String INSTRUMENTATION_LOG_NAME = "diagnostic-log";
4244
public static final int MAX_DIAGNOSTIC_VALUE_LENGTH = 14;
4345
public static final int MAX_DIAGNOSTIC_ENTIES = 3;
@@ -220,8 +222,8 @@ static boolean setInstrumentationStatus(boolean value) {
220222
* Returns a library version associated with given class
221223
*
222224
* @param libraryClass {Class<?>} The class to be used to determine a library version
223-
* @return The version number string for given class or "UNKNOWN" if class library version cannot
224-
* be detected
225+
* @return The version number string for given class or DEFAULT_INSTRUMENTATION_VERSION if class
226+
* library version cannot be detected
225227
*/
226228
public static String getLibraryVersion(Class<?> libraryClass) {
227229
String libraryVersion = GaxProperties.getLibraryVersion(libraryClass);

google-cloud-logging/src/test/java/com/google/cloud/logging/InstrumentationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class InstrumentationTest {
4141
private static final LogEntry STRING_ENTRY = LogEntry.newBuilder(STRING_PAYLOAD).build();
4242
private static final String JAVA_OTHER_NAME = "java-other";
4343
private static final String JAVA_INVALID_NAME = "no-java-name";
44-
private static final String JAVA_OTHER_VERSION = "1.0.0";
44+
private static final String JAVA_OTHER_VERSION = "0.0.0";
4545

4646
@Test
4747
public void testInstrumentationGenerated() {

0 commit comments

Comments
 (0)