Skip to content
This repository was archived by the owner on Mar 11, 2026. It is now read-only.

Commit c039022

Browse files
feat: Add support for instrumentation version annotations (#1370)
* 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 tests * Add exclude to owlbot.py * Add newline Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent bf4f824 commit c039022

4 files changed

Lines changed: 7 additions & 5 deletions

File tree

.github/release-please.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
handleGHRelease: true
22
releaseType: node
3+
extraFiles: ["src/utils/instrumentation.ts"]

owlbot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
".eslintignore",
2929
".prettierignore",
3030
"CONTRIBUTING.md",
31-
".github/auto-label.yaml"
31+
".github/auto-label.yaml",
32+
".github/release-please.yml"
3233
]
3334
)
3435

src/utils/instrumentation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const maxDiagnosticValueLen = 14;
3838
export const DIAGNOSTIC_INFO_KEY = 'logging.googleapis.com/diagnostic';
3939
export const INSTRUMENTATION_SOURCE_KEY = 'instrumentation_source';
4040
export const NODEJS_LIBRARY_NAME_PREFIX = 'nodejs';
41-
export const NODEJS_DEFAULT_LIBRARY_VERSION = 'unknown';
41+
export const NODEJS_DEFAULT_LIBRARY_VERSION = '1.0.0'; // {x-release-please-version}
4242
export const MAX_INSTRUMENTATION_COUNT = 3;
4343
export type InstrumentationInfo = {name: string; version: string};
4444

@@ -173,7 +173,7 @@ function truncateValue(value: object | string, maxLen: number) {
173173
// Ignore error since flow should continue
174174
}
175175
}
176-
// Return 'unknown' if version cannot be retrieved
176+
// Return NODEJS_DEFAULT_LIBRARY_VERSION if version cannot be retrieved
177177
if (typeof value !== 'string') {
178178
return NODEJS_DEFAULT_LIBRARY_VERSION;
179179
}

test/instrumentation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe('instrumentation_info', () => {
5353
);
5454
});
5555

56-
it('should set library version to unknown', () => {
56+
it('should set library version to NODEJS_DEFAULT_LIBRARY_VERSION', () => {
5757
const data = {some: 'value'};
5858
const entry = instrumentation.createDiagnosticEntry(
5959
undefined,
@@ -70,7 +70,7 @@ describe('instrumentation_info', () => {
7070
entry.data?.[instrumentation.DIAGNOSTIC_INFO_KEY]?.[
7171
instrumentation.INSTRUMENTATION_SOURCE_KEY
7272
]?.[0]?.[VERSION],
73-
'unknown'
73+
instrumentation.NODEJS_DEFAULT_LIBRARY_VERSION
7474
);
7575
});
7676

0 commit comments

Comments
 (0)