newrelic 7.1.2 → 7.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/NEWS.md +97 -0
  2. package/THIRD_PARTY_NOTICES.md +33 -2
  3. package/bin/test-naming-rules.js +4 -4
  4. package/index.js +4 -2
  5. package/lib/agent.js +4 -0
  6. package/lib/collector/api.js +45 -18
  7. package/lib/collector/facts.js +22 -8
  8. package/lib/collector/http-agents.js +20 -7
  9. package/lib/collector/remote-method.js +32 -9
  10. package/lib/config/index.js +48 -39
  11. package/lib/feature_flags.js +6 -2
  12. package/lib/grpc/connection.js +39 -15
  13. package/lib/instrumentation/core/async_hooks.js +101 -14
  14. package/lib/instrumentation/core/http.js +5 -0
  15. package/lib/instrumentation/core/timers.js +6 -1
  16. package/lib/metrics/names.js +7 -1
  17. package/lib/shim/shim.js +6 -1
  18. package/lib/spans/create-span-event-aggregator.js +1 -0
  19. package/lib/spans/span-event.js +6 -3
  20. package/lib/spans/streaming-span-event.js +6 -3
  21. package/lib/transaction/index.js +36 -0
  22. package/newrelic.js +1 -1
  23. package/package.json +19 -7
  24. package/CONTRIBUTING.md +0 -135
  25. package/Migration Guide.md +0 -271
  26. package/ROADMAP_Node.md +0 -24
  27. package/SECURITY.md +0 -5
  28. package/THIRD_PARTY_NOTICES_ADDENDUM.md +0 -213
  29. package/bin/ca-gen.js +0 -91
  30. package/bin/cassandra-setup.sh +0 -11
  31. package/bin/check-workflow-run.js +0 -74
  32. package/bin/clean.sh +0 -18
  33. package/bin/compare-bench-results.js +0 -172
  34. package/bin/create-release.js +0 -74
  35. package/bin/docker-env-vars.sh +0 -15
  36. package/bin/docker-services.sh +0 -49
  37. package/bin/generate-release-notes.js +0 -126
  38. package/bin/github.js +0 -119
  39. package/bin/publish-docs.sh +0 -16
  40. package/bin/run-bench.js +0 -137
  41. package/bin/run-versioned-tests.sh +0 -32
  42. package/bin/smoke.sh +0 -8
  43. package/bin/ssl.sh +0 -87
  44. package/bin/travis-install-gcc5.sh +0 -13
  45. package/bin/travis-install-mongo.sh +0 -16
  46. package/bin/travis-node.sh +0 -57
  47. package/bin/travis-setup.sh +0 -52
  48. package/bin/update-ca-bundle.sh +0 -20
  49. package/bin/update-cats.sh +0 -8
  50. package/bin/update-changelog-version.js +0 -68
  51. package/jsdoc-conf.json +0 -18
  52. package/third_party_manifest.json +0 -619
package/bin/run-bench.js DELETED
@@ -1,137 +0,0 @@
1
- /*
2
- * Copyright 2020 New Relic Corporation. All rights reserved.
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
-
6
- 'use strict'
7
-
8
- var a = require('async')
9
- var cp = require('child_process')
10
- var glob = require('glob')
11
- var path = require('path')
12
-
13
-
14
- var cwd = path.resolve(__dirname, '..')
15
- var benchpath = path.resolve(cwd, 'test/benchmark')
16
-
17
- var tests = []
18
- var globs = []
19
- var opts = Object.create(null)
20
-
21
- process.argv.slice(2).forEach(function forEachFileArg(file) {
22
- if (/^--/.test(file)) {
23
- opts[file.substr(2)] = true
24
- } else if (/[*]/.test(file)) {
25
- globs.push(path.join(benchpath, file))
26
- } else if (/\.bench\.js$/.test(file)) {
27
- tests.push(path.join(benchpath, file))
28
- } else {
29
- globs.push(
30
- path.join(benchpath, file, '*.bench.js'),
31
- path.join(benchpath, file + '*.bench.js'),
32
- path.join(benchpath, file, '**/*.bench.js')
33
- )
34
- }
35
- })
36
-
37
- if (tests.length === 0 && globs.length === 0) {
38
- globs.push(
39
- path.join(benchpath, '*.bench.js'),
40
- path.join(benchpath, '**/*.bench.js')
41
- )
42
- }
43
-
44
- class ConsolePrinter {
45
- /* eslint-disable no-console */
46
- addTest(name, child) {
47
- console.log(name)
48
- child.stdout.on('data', (d) => process.stdout.write(d))
49
- child.stderr.on('data', (d) => process.stderr.write(d))
50
- child.once('exit', () => console.log(''))
51
- }
52
-
53
- finish() {
54
- console.log('')
55
- }
56
- /* eslint-enable no-console */
57
- }
58
-
59
- class JSONPrinter {
60
- constructor() {
61
- this._tests = Object.create(null)
62
- }
63
-
64
- addTest(name, child) {
65
- let output = ''
66
- this._tests[name] = null
67
- child.stdout.on('data', (d) => output += d.toString())
68
- child.stdout.on('end', () => this._tests[name] = JSON.parse(output))
69
- child.stderr.on('data', (d) => process.stderr.write(d))
70
- }
71
-
72
- finish() {
73
- /* eslint-disable no-console */
74
- console.log(JSON.stringify(this._tests, null, 2))
75
- /* eslint-enable no-console */
76
- }
77
- }
78
-
79
- run()
80
-
81
- function run() {
82
- const printer = opts.json ? new JSONPrinter() : new ConsolePrinter()
83
-
84
- a.series([
85
- function resolveGlobs(cb) {
86
- if (!globs.length) {
87
- return cb()
88
- }
89
-
90
- a.map(globs, glob, function afterGlobbing(err, resolved) {
91
- if (err) {
92
- console.error('Failed to glob:', err)
93
- process.exitCode = -1
94
- return cb(err)
95
- }
96
- resolved.forEach(function mergeResolved(files) {
97
- files.forEach(function mergeFile(file) {
98
- if (tests.indexOf(file) === -1) {
99
- tests.push(file)
100
- }
101
- })
102
- })
103
- cb()
104
- })
105
- },
106
- function runBenchmarks(cb) {
107
- tests.sort()
108
- a.eachSeries(tests, function spawnEachFile(file, cb) {
109
- var test = path.relative(benchpath, file)
110
-
111
- var args = [file]
112
- if (opts.inspect) {
113
- args.unshift('--inspect-brk')
114
- }
115
- var child = cp.spawn('node', args, {cwd: cwd, stdio: 'pipe'})
116
- printer.addTest(test, child)
117
-
118
- child.on('error', cb)
119
- child.on('exit', function onChildExit(code) {
120
- if (code) {
121
- return cb(new Error('Benchmark exited with code ' + code))
122
- }
123
- cb()
124
- })
125
- }, function afterSpawnEachFile(err) {
126
- if (err) {
127
- console.error('Spawning failed:', err)
128
- process.exitCode = -2
129
- return cb(err)
130
- }
131
- cb()
132
- })
133
- }
134
- ], () => {
135
- printer.finish()
136
- })
137
- }
@@ -1,32 +0,0 @@
1
- #! /bin/bash
2
-
3
- # Copyright 2020 New Relic Corporation. All rights reserved.
4
- # SPDX-License-Identifier: Apache-2.0
5
-
6
- set -x
7
-
8
- VERSIONED_MODE="${VERSIONED_MODE:---major}"
9
- if [[ $TRAVIS_BRANCH == `git describe --tags --always HEAD` ]]; then
10
- VERSIONED_MODE=--minor
11
- fi
12
- # if [[ $TRAVIS_BRANCH == "master" ]]; then
13
- # VERSIONED_MODE=--minor
14
- # fi
15
-
16
- set -f
17
- directories=()
18
- if [[ "$1" != '' ]]; then
19
- directories=(
20
- "test/versioned/${1}"
21
- "node_modules/@newrelic/${1}/tests/versioned"
22
- )
23
- fi
24
-
25
- export AGENT_PATH=`pwd`
26
-
27
- # Don't run the aws-sdk tests if we don't have the keys set
28
- if [[ -z "$AWS_ACCESS_KEY_ID" ]]; then
29
- time ./node_modules/.bin/versioned-tests $VERSIONED_MODE -i 2 -s aws-sdk ${directories[@]}
30
- else
31
- time ./node_modules/.bin/versioned-tests $VERSIONED_MODE -i 2 ${directories[@]}
32
- fi
package/bin/smoke.sh DELETED
@@ -1,8 +0,0 @@
1
- #! /bin/sh
2
-
3
- # Copyright 2020 New Relic Corporation. All rights reserved.
4
- # SPDX-License-Identifier: Apache-2.0
5
-
6
- npm install --production --loglevel warn --no-package-lock
7
- npm --prefix test/smoke install --no-package-lock
8
- time node test/smoke/*.tap.js
package/bin/ssl.sh DELETED
@@ -1,87 +0,0 @@
1
- #! /bin/sh
2
-
3
- # Copyright 2020 New Relic Corporation. All rights reserved.
4
- # SPDX-License-Identifier: Apache-2.0
5
-
6
- # https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
7
- set -e # exit if any command fails
8
- set -x # be chatty and show the lines we're running
9
-
10
- # LibreSSL fails on the openssl ca step for reasons
11
- # that are mysterious and not understood, so let
12
- # bail early if we detect that's the case
13
- ENGINE_OPENSSL=`openssl version | awk '{print $(1)}'`
14
- if [ "$ENGINE_OPENSSL" = "LibreSSL" ]
15
- then
16
- echo "LibreSSL is not supported, please install a stock openssl and \n"
17
- echo "make sure that openssl binary is in your PATH"
18
- exit 1
19
- fi
20
-
21
- # CACONFIG is the only non-generated file
22
- CACONFIG="test/lib/test-ca.conf"
23
- SSLKEY="test/lib/test-key.key"
24
- CACERT="test/lib/ca-certificate.crt"
25
- CAINDEX="test/lib/ca-index"
26
- CASERIAL="test/lib/ca-serial"
27
- CERTIFICATE="test/lib/self-signed-test-certificate.crt"
28
-
29
- # USAGE: ./bin/ssl.sh clear
30
- # a sub command to remove all the generated files and start over
31
- if [ "$1" = "clear" ]
32
- then
33
- rm $SSLKEY
34
- rm $CACERT
35
- rm $CAINDEX
36
- rm $CASERIAL
37
- rm $CERTIFICATE
38
- exit 0
39
- fi
40
-
41
- # if there's already a certificate, then exit, but
42
- # exit with a success code so build continue
43
- if [ -e $CERTIFICATE ]; then
44
- exit 0;
45
- fi
46
-
47
- # generates an RSA key
48
- openssl genrsa -out $SSLKEY 1024
49
-
50
- # ca-index is the "certificate authority" database
51
- # and ca-serial is a file that openssl will read
52
- # "the next serial number for the ca-index entry"
53
- # from.
54
- touch $CAINDEX
55
- echo 000a > $CASERIAL
56
-
57
- # this generates a certificate for the
58
- # certificate authority
59
- openssl req \
60
- -new \
61
- -subj "/O=testsuite/OU=New Relic CA/CN=Node.js test CA" \
62
- -key $SSLKEY \
63
- -days 3650 \
64
- -x509 \
65
- -out $CACERT
66
-
67
- # this generates a "certificate signing request" file
68
- openssl req \
69
- -new \
70
- -subj "/O=testsuite/OU=Node.js agent team/CN=ssl.lvh.me" \
71
- -key $SSLKEY \
72
- -out server.csr
73
-
74
- # using the files generated above, this tells the
75
- # certificate authority about the request for a certificate,
76
- # which generates the self-signed-test-certificate.crt file.
77
- # This is the file used by the web server
78
- openssl ca \
79
- -batch \
80
- -cert $CACERT \
81
- -config $CACONFIG \
82
- -keyfile $SSLKEY \
83
- -in server.csr \
84
- -out $CERTIFICATE
85
-
86
- # remove the signing request now that we're done with it
87
- rm -f server.csr
@@ -1,13 +0,0 @@
1
- #! /bin/bash
2
-
3
- # Copyright 2020 New Relic Corporation. All rights reserved.
4
- # SPDX-License-Identifier: Apache-2.0
5
-
6
- set -x # echo commands as executed
7
-
8
- sudo apt-get install -qq gcc-5 g++-5
9
- sudo update-alternatives \
10
- --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 \
11
- --slave /usr/bin/g++ g++ /usr/bin/g++-5
12
- sudo update-alternatives --auto gcc
13
- export CXX="g++-5" CC="gcc-5"
@@ -1,16 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Copyright 2020 New Relic Corporation. All rights reserved.
4
- # SPDX-License-Identifier: Apache-2.0
5
-
6
- set -xev # -x echo commands as executed
7
- # -e exit as soon as something goes wrong
8
- # -v when considering whether to say something or not say something
9
- # take the appraoch that provide as much information as possible
10
- # which human beings something describe as being verbose
11
-
12
- wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-${MONGODB}.tgz -O /tmp/mongodb.tgz
13
- mkdir -p /tmp/mongodb/data
14
- tar -xf /tmp/mongodb.tgz -C /tmp/mongodb
15
- /tmp/mongodb/mongodb-linux-x86_64-${MONGODB}/bin/mongod --version
16
- /tmp/mongodb/mongodb-linux-x86_64-${MONGODB}/bin/mongod --dbpath /tmp/mongodb/data --bind_ip 127.0.0.1 --noauth &> /dev/null &
@@ -1,57 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Copyright 2020 New Relic Corporation. All rights reserved.
4
- # SPDX-License-Identifier: Apache-2.0
5
-
6
- # https://stackoverflow.com/questions/16989598/bash-comparing-version-numbers/24067243
7
- # tests version strings using `sort`'s -V option
8
- function version_gt() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; }
9
-
10
- sudo apt-get update
11
-
12
- # so dumb that we need python-software-properties
13
- # to get add-apt-repository
14
- sudo apt-get -y install build-essential libssl-dev curl python-software-properties time sudo
15
-
16
- # update gcc to something that will install pg-native module
17
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
18
- sudo apt-get -y update
19
- sudo apt-get -y install gcc-4.9 g++-4.9
20
- sudo rm /usr/bin/g++
21
- sudo rm /usr/bin/gcc
22
- sudo ln -s /usr/bin/g++-4.9 /usr/bin/g++
23
- sudo ln -s /usr/bin/gcc-4.9 /usr/bin/gcc
24
-
25
- # Where is ppa:ubuntu-toolchain-r/test?
26
- # sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
27
- # sudo apt-get -y update
28
- # sudo apt-get -y install libstdc++6-4.7-dev
29
-
30
- # only do for NODE 12 AND for old glibc
31
-
32
- GLIBC_VERSION_CHECK=`ldd --version | head -n 1 | awk '{print $NF}'`
33
-
34
- if [ -z $NR_NODE_VERSION ]; then
35
- echo "please define NR_NODE_VERSION in local env"
36
- exit 1
37
- fi
38
-
39
- version=$NR_NODE_VERSION
40
- major=${version/.*}
41
- echo $major
42
- if [ $major -gt 11 ] && version_gt 2.17 $GLIBC_VERSION_CHECK;then
43
- echo "Installing updated glibc\n"
44
- # can we get this from an actual repository?
45
- curl -LO 'http://launchpadlibrarian.net/130794928/libc6_2.17-0ubuntu4_amd64.deb'
46
- sudo dpkg -i libc6_2.17-0ubuntu4_amd64.deb
47
- else
48
- echo "Skipping glibc update\n"
49
- fi
50
-
51
- # install nvm
52
- curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bash
53
- export NVM_DIR="$HOME/.nvm"
54
- [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
55
- [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
56
-
57
- nvm install $NR_NODE_VERSION
@@ -1,52 +0,0 @@
1
- #! /bin/bash
2
-
3
- # Copyright 2020 New Relic Corporation. All rights reserved.
4
- # SPDX-License-Identifier: Apache-2.0
5
-
6
- function get_version {
7
- local num='[[:digit:]][[:digit:]]*' # Grep doesn't have `+` operator.
8
- local version=`$1 --version 2>/dev/null | grep -o "$num\.$num\.$num" | head -1`
9
- echo $version | grep -o "$num" | head -1
10
- }
11
-
12
- TOOLCHAIN_ADDED="false"
13
- function add_toolchain {
14
- if [ "$TOOLCHAIN_ADDED" == "false" ]; then
15
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
16
- sudo apt-get update -qq
17
- fi
18
- TOOLCHAIN_ADDED="true"
19
- }
20
-
21
- # npm 5 introduced 'ci' and 6 introduce 'audit', so just default to latest
22
- if (("$(get_version npm)" < "6" )); then
23
- echo " --- upgrading npm to 6 --- "
24
- npm install -g npm@6
25
- else
26
- echo " --- not upgrading npm ($(npm --version)) --- "
27
- fi
28
-
29
- if [ "$SUITE" = "versioned" ]; then
30
- echo " --- installing cassandra --- "
31
- ./bin/cassandra-setup.sh
32
-
33
- # GCC 5 is the lowest version of GCC we can use.
34
- if [ "$(get_version gcc)" == "4" ]; then
35
- echo " --- upgrading GCC --- "
36
- add_toolchain
37
- ./bin/travis-install-gcc5.sh > /dev/null
38
- else
39
- echo " --- not upgrading GCC ($(gcc --version)) --- "
40
- fi
41
-
42
- echo " --- installing $SUITE requirements --- "
43
-
44
- # MongoDB is always installed in integrations and versioned.
45
- echo " --- installing mongodb --- "
46
- add_toolchain
47
- ./bin/travis-install-mongo.sh
48
-
49
- echo " --- done installing $SUITE requirements --- "
50
- else
51
- echo " --- no $SUITE installation requirements --- "
52
- fi
@@ -1,20 +0,0 @@
1
- #!/bin/sh
2
-
3
- # Copyright 2020 New Relic Corporation. All rights reserved.
4
- # SPDX-License-Identifier: Apache-2.0
5
-
6
- set -e
7
-
8
- start_dir=`pwd`
9
-
10
- # needs to be checked out in the parent directory of the agent
11
- # (https://github.com/newrelic/SSL_CA_cert_bundle only available to NR staff)
12
- ca_store="../SSL_CA_cert_bundle"
13
- bundle_generator="./bin/ca-gen.js"
14
-
15
- if [ -d $ca_store ]; then
16
- cd $ca_store
17
- git pull --rebase origin master
18
- cd $start_dir
19
- node $bundle_generator
20
- fi
@@ -1,8 +0,0 @@
1
- #! /bin/sh
2
-
3
- # Copyright 2020 New Relic Corporation. All rights reserved.
4
- # SPDX-License-Identifier: Apache-2.0
5
-
6
- rm -rf test/lib/cross_agent_tests
7
- git clone git@source.datanerd.us:newrelic/cross_agent_tests.git test/lib/cross_agent_tests
8
- rm -rf test/lib/cross_agent_tests/.git
@@ -1,68 +0,0 @@
1
- 'use strict'
2
-
3
- /**
4
- * Executed as a part of the "version" step of npm version.
5
- * Updates the placeholder release note header with the incremented version
6
- * from running npm version
7
- */
8
-
9
- const fs = require('fs')
10
- const packageInfo = require('../package.json')
11
-
12
- const FILE_NAME = 'NEWS.md'
13
- const NEXT_VERSION_HEADER = '### vNext (TBD):'
14
-
15
- const SUCCESS_MSG = '*** [SUCCESS] ***'
16
- const FAIL_MSG = '! [FAILURE] !'
17
-
18
- updateChangelogVersion()
19
-
20
- async function updateChangelogVersion() {
21
- try {
22
- await updateHeader(FILE_NAME)
23
-
24
- console.log(SUCCESS_MSG)
25
- } catch (err) {
26
- console.log(FAIL_MSG)
27
- console.error(err)
28
-
29
- process.exit(1)
30
- }
31
- }
32
-
33
- function updateHeader(file) {
34
- const promise = new Promise((resolve, reject) => {
35
- fs.readFile(file, 'utf8', (err, data) => {
36
- if (err) {
37
- return reject(err)
38
- }
39
-
40
- // toISOString() will always return UTC time
41
- const todayFormatted = new Date().toISOString().split('T')[0]
42
- const version = `v${packageInfo.version}`
43
- const newChangelogHeader = `### ${version} (${todayFormatted})`
44
-
45
- console.log('Updating vNext header to: ', newChangelogHeader)
46
-
47
- if (!data.startsWith(NEXT_VERSION_HEADER)) {
48
- const err = new Error(`Failed to find next version header in form: '${NEXT_VERSION_HEADER}'`)
49
- return reject(err)
50
- }
51
-
52
- const modified = data.replace(
53
- NEXT_VERSION_HEADER,
54
- newChangelogHeader
55
- )
56
-
57
- fs.writeFile(file, modified, 'utf8', (err) => {
58
- if (err) {
59
- return reject (err)
60
- }
61
-
62
- console.log(SUCCESS_MSG)
63
- })
64
- })
65
- })
66
-
67
- return promise
68
- }
package/jsdoc-conf.json DELETED
@@ -1,18 +0,0 @@
1
- {
2
- "opts": {
3
- "destination": "out/",
4
- "readme": "./README.md",
5
- "template": "./node_modules/minami"
6
- },
7
- "source": {
8
- "exclude": ["node_modules", "test"],
9
- "includePattern": ".+\\.js(doc)?$"
10
- },
11
- "plugins": [
12
- "plugins/markdown"
13
- ],
14
- "templates": {
15
- "cleverLinks": true,
16
- "showInheritedInNav": false
17
- }
18
- }