Skip to content
This repository was archived by the owner on Apr 3, 2024. It is now read-only.

Commit f6985f7

Browse files
feat: GAE_DEPLOYMENT_ID used for minor version (#400)
The `GAE_DEPLOYMENT_ID` environment variable (with a fallback to `GAE_MINOR_VERSION`) will be used as the default value of `minorVersion_`. Note that the `GAE_DEPLOYMENT_ID` environment variable is now set on AppEngine Flex.
1 parent e19e514 commit f6985f7

File tree

3 files changed

+99
-108
lines changed

3 files changed

+99
-108
lines changed

package-lock.json

Lines changed: 72 additions & 63 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/agent/debuglet.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -254,12 +254,8 @@ export class Debuglet extends EventEmitter {
254254
serviceContext: {
255255
service: process.env.GAE_SERVICE || process.env.GAE_MODULE_NAME,
256256
version: process.env.GAE_VERSION || process.env.GAE_MODULE_VERSION,
257-
// Debug UI expects GAE_MINOR_VERSION to be available for AppEngine, but
258-
// AppEngine Flex doesn't have this environment variable. We provide a
259-
// fake value as a work-around, but only on Flex (GAE_SERVICE will be
260-
// defined on Flex).
261-
minorVersion_: process.env.GAE_MINOR_VERSION ||
262-
(process.env.GAE_SERVICE ? 'fake-minor-version' : undefined)
257+
minorVersion_:
258+
process.env.GAE_DEPLOYMENT_ID || process.env.GAE_MINOR_VERSION
263259
}
264260
};
265261

@@ -303,9 +299,9 @@ export class Debuglet extends EventEmitter {
303299
if (!that.config.allowRootAsWorkingDirectory &&
304300
path.join(workingDir, '..') === workingDir) {
305301
const message = 'The working directory is a root directory. Disabling ' +
306-
'to avoid a scan of the entire filesystem for JavaScript files. ' +
307-
'Use config \allowRootAsWorkingDirectory` if you really want to ' +
308-
'do this.';
302+
'to avoid a scan of the entire filesystem for JavaScript files. ' +
303+
'Use config \allowRootAsWorkingDirectory` if you really want to ' +
304+
'do this.';
309305
that.logger.error(message);
310306
that.emit('initError', new Error(message));
311307
return;
@@ -516,11 +512,11 @@ export class Debuglet extends EventEmitter {
516512
return metadata.isAvailable();
517513
}
518514

519-
static async getProjectIdFromMetadata() : Promise<string> {
515+
static async getProjectIdFromMetadata(): Promise<string> {
520516
return (await metadata.project('project-id')).data as string;
521517
}
522518

523-
static async getClusterNameFromMetadata() : Promise<string> {
519+
static async getClusterNameFromMetadata(): Promise<string> {
524520
return (await metadata.instance('attributes/cluster-name')).data as string;
525521
}
526522

0 commit comments

Comments
 (0)