forked from newrelic/node-newrelic
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Provided ability to disable instrumentation for a 3rd party pac…
…kage
- Loading branch information
Showing
6 changed files
with
72 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright 2024 New Relic Corporation. All rights reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
'use strict' | ||
const { boolean } = require('./formatters') | ||
const instrumentedLibraries = require('../instrumentations')() | ||
const pkgNames = Object.keys(instrumentedLibraries) | ||
|
||
/** | ||
* Builds the stanza for config.instrumentation.* | ||
* It defaults every library to true and assigns a boolean | ||
* formatter for the environment variable conversion of the values | ||
*/ | ||
module.exports = pkgNames.reduce((config, pkg) => { | ||
config[pkg] = { enabled: { formatter: boolean, default: true } } | ||
return config | ||
}, {}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright 2022 New Relic Corporation. All rights reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
'use strict' | ||
|
||
const test = require('node:test') | ||
const assert = require('node:assert') | ||
|
||
test('should default the instrumentation stanza', () => { | ||
const { boolean } = require('../../../lib/config/formatters') | ||
const pkgs = require('../../../lib/config/build-instrumentation-config') | ||
const instrumentation = require('../../../lib/instrumentations')() | ||
const pkgNames = Object.keys(instrumentation) | ||
|
||
pkgNames.forEach((pkg) => { | ||
assert.deepEqual(pkgs[pkg], { enabled: { formatter: boolean, default: true } }) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters