From 87e66eb71a1d1a85132af1d33dcc313a40f21acf Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Sat, 5 Nov 2022 00:56:09 +0100 Subject: [PATCH 1/3] chore(deps): update dependency jsdoc to v4 (#1371) Co-authored-by: losalex <90795544+losalex@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 51bc5a80..f4694840 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "codecov": "^3.6.5", "gts": "^3.1.0", "http2spy": "^2.0.0", - "jsdoc": "^3.6.3", + "jsdoc": "^4.0.0", "jsdoc-fresh": "^2.0.0", "jsdoc-region-tag": "^2.0.0", "linkinator": "^4.0.0", From 32b22b4c17376a51f413481b3e412a88c0f83f06 Mon Sep 17 00:00:00 2001 From: losalex <90795544+losalex@users.noreply.github.com> Date: Mon, 7 Nov 2022 13:54:40 -0800 Subject: [PATCH 2/3] fix: Switch instrumentation code to work with NODEJS_DEFAULT_LIBRARY_VERSION only (#1373) * fix: Switch instrumentation code to work with NODEJS_DEFAULT_LIBRARY_VERSION only * Fix comment --- src/utils/instrumentation.ts | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/src/utils/instrumentation.ts b/src/utils/instrumentation.ts index 4b21482b..5750d7cf 100644 --- a/src/utils/instrumentation.ts +++ b/src/utils/instrumentation.ts @@ -15,7 +15,6 @@ */ import arrify = require('arrify'); -import path = require('path'); import {Entry} from '../entry'; // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -29,15 +28,17 @@ global.instrumentationAdded = false; // The global variable to avoid records inspection once instrumentation already written to prevent perf impact global.shouldSkipInstrumentationCheck = false; -// The variable to hold cached library version -let libraryVersion: string; - // Max length for instrumentation library name and version values const maxDiagnosticValueLen = 14; export const DIAGNOSTIC_INFO_KEY = 'logging.googleapis.com/diagnostic'; export const INSTRUMENTATION_SOURCE_KEY = 'instrumentation_source'; export const NODEJS_LIBRARY_NAME_PREFIX = 'nodejs'; +/** + * Default library version to be used + * Using release-please annotations to update DEFAULT_INSTRUMENTATION_VERSION with latest version. + * See https://github.com/googleapis/release-please/blob/main/docs/customizing.md#updating-arbitrary-files + */ export const NODEJS_DEFAULT_LIBRARY_VERSION = '10.3.0'; // {x-release-please-version} export const MAX_INSTRUMENTATION_COUNT = 3; export type InstrumentationInfo = {name: string; version: string}; @@ -184,24 +185,11 @@ function truncateValue(value: object | string, maxLen: number) { } /** - * The helper function to retrieve current library version from 'package.json' file. Note that - * since we use {path.resolve}, the search for 'package.json' could be impacted by current working directory. + * The helper function to retrieve current library version from annotated NODEJS_DEFAULT_LIBRARY_VERSION * @returns {string} A current library version. */ export function getNodejsLibraryVersion() { - if (libraryVersion) { - return libraryVersion; - } - try { - libraryVersion = require(path.resolve( - __dirname, - '../../../', - 'package.json' - )).version; - } catch (err) { - libraryVersion = NODEJS_DEFAULT_LIBRARY_VERSION; - } - return libraryVersion; + return NODEJS_DEFAULT_LIBRARY_VERSION; } /** From 3c8d39b944c60dcd2d401df8d704f670f4e1432f Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 7 Nov 2022 16:09:49 -0800 Subject: [PATCH 3/3] chore(main): release 10.3.1 (#1375) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(main): release 10.3.1 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot --- CHANGELOG.md | 7 +++++++ package.json | 2 +- .../generated/v2/snippet_metadata.google.logging.v2.json | 2 +- samples/package.json | 2 +- src/utils/instrumentation.ts | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32a67c5a..c77af772 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ [1]: https://www.npmjs.com/package/nodejs-logging?activeTab=versions +## [10.3.1](https://github.com/googleapis/nodejs-logging/compare/v10.3.0...v10.3.1) (2022-11-07) + + +### Bug Fixes + +* Switch instrumentation code to work with NODEJS_DEFAULT_LIBRARY_VERSION only ([#1373](https://github.com/googleapis/nodejs-logging/issues/1373)) ([32b22b4](https://github.com/googleapis/nodejs-logging/commit/32b22b4c17376a51f413481b3e412a88c0f83f06)) + ## [10.3.0](https://github.com/googleapis/nodejs-logging/compare/v10.2.3...v10.3.0) (2022-11-04) diff --git a/package.json b/package.json index f4694840..878d7f90 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/logging", - "version": "10.3.0", + "version": "10.3.1", "description": "Cloud Logging Client Library for Node.js", "keywords": [ "google apis client", diff --git a/samples/generated/v2/snippet_metadata.google.logging.v2.json b/samples/generated/v2/snippet_metadata.google.logging.v2.json index 57ff7075..81eb2eff 100644 --- a/samples/generated/v2/snippet_metadata.google.logging.v2.json +++ b/samples/generated/v2/snippet_metadata.google.logging.v2.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-logging", - "version": "10.3.0", + "version": "10.3.1", "language": "TYPESCRIPT", "apis": [ { diff --git a/samples/package.json b/samples/package.json index 0aa22715..fa11277d 100644 --- a/samples/package.json +++ b/samples/package.json @@ -14,7 +14,7 @@ "test": "mocha --timeout 60000" }, "dependencies": { - "@google-cloud/logging": "^10.3.0", + "@google-cloud/logging": "^10.3.1", "@google-cloud/storage": "^6.0.0", "express": "^4.16.3", "fluent-logger": "^3.0.0", diff --git a/src/utils/instrumentation.ts b/src/utils/instrumentation.ts index 5750d7cf..896739ca 100644 --- a/src/utils/instrumentation.ts +++ b/src/utils/instrumentation.ts @@ -39,7 +39,7 @@ export const NODEJS_LIBRARY_NAME_PREFIX = 'nodejs'; * Using release-please annotations to update DEFAULT_INSTRUMENTATION_VERSION with latest version. * See https://github.com/googleapis/release-please/blob/main/docs/customizing.md#updating-arbitrary-files */ -export const NODEJS_DEFAULT_LIBRARY_VERSION = '10.3.0'; // {x-release-please-version} +export const NODEJS_DEFAULT_LIBRARY_VERSION = '10.3.1'; // {x-release-please-version} export const MAX_INSTRUMENTATION_COUNT = 3; export type InstrumentationInfo = {name: string; version: string};