Skip to content

Commit

Permalink
feat: Add support for instrumentation version annotations (#1179)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
losalex and gcf-owl-bot[bot] committed Nov 4, 2022
1 parent 1830525 commit 0931446
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .github/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ branches:
handleGHRelease: true
releaseType: java-backport
branch: 3.7.x
extraFiles:
- src/main/java/com/google/cloud/logging/Instrumentation.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +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 = "UNKNOWN";
// {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;
Expand Down Expand Up @@ -220,8 +222,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 "UNKNOWN" 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 0931446

Please sign in to comment.