Skip to content

Commit

Permalink
feat: making async_hooks tracing the default on Node 8+
Browse files Browse the repository at this point in the history
  • Loading branch information
kjin committed May 8, 2018
1 parent 1990e4a commit 82bc9f7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ export interface Config {
* Node binary version requirements are not met.
* - 'async-listener' uses an implementation of CLS on top of the
* `continuation-local-storage` module.
* - 'auto' behaves like 'async-hooks' on Node 8+ when the
* GCLOUD_TRACE_NEW_CONTEXT env variable is set, and 'async-listener'
* - 'auto' behaves like 'async-hooks' on Node 8+, and 'async-listener'
* otherwise.
* - 'none' disables CLS completely.
* The 'auto' mechanism is used by default if this configuration option is
Expand Down
3 changes: 1 addition & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ function initConfig(projectConfig: Forceable<Config>):

// If the CLS mechanism is set to auto-determined, decide now what it should
// be.
const ahAvailable = semver.satisfies(process.version, '>=8') &&
process.env.GCLOUD_TRACE_NEW_CONTEXT;
const ahAvailable = semver.satisfies(process.version, '>=8');
if (config.clsMechanism === 'auto') {
config.clsMechanism = ahAvailable ? 'async-hooks' : 'async-listener';
}
Expand Down

0 comments on commit 82bc9f7

Please sign in to comment.