newrelic 5.9.1 → 5.13.1

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 (55) hide show
  1. package/.travis.yml +14 -20
  2. package/CONTRIBUTING.md +4 -4
  3. package/NEWS.md +141 -0
  4. package/api.js +4 -3
  5. package/bin/cassandra-setup.sh +8 -0
  6. package/bin/run-versioned-tests.sh +3 -1
  7. package/bin/travis-install-mongo.sh +10 -6
  8. package/bin/travis-setup.sh +3 -1
  9. package/lib/agent.js +380 -307
  10. package/lib/aggregators/base-aggregator.js +111 -0
  11. package/lib/aggregators/event-aggregator.js +148 -0
  12. package/lib/aggregators/trace-aggregator.js +11 -0
  13. package/lib/collector/api.js +133 -48
  14. package/lib/collector/facts.js +10 -1
  15. package/lib/collector/http-agents.js +43 -4
  16. package/lib/collector/remote-method.js +2 -13
  17. package/lib/collector/serverless.js +34 -53
  18. package/lib/config/default.js +14 -1
  19. package/lib/config/env.js +13 -1
  20. package/lib/config/harvest-config-validator.js +26 -0
  21. package/lib/config/index.js +316 -56
  22. package/lib/config/lasp.js +5 -5
  23. package/lib/config/merge-server-config.js +56 -0
  24. package/lib/custom-events/custom-event-aggregator.js +31 -0
  25. package/lib/db/parsed-statement.js +1 -1
  26. package/lib/db/query-sample.js +110 -0
  27. package/lib/db/query-trace-aggregator.js +139 -0
  28. package/lib/db/slow-query.js +34 -0
  29. package/lib/errors/{aggregator.js → error-collector.js} +196 -149
  30. package/lib/errors/error-event-aggregator.js +36 -0
  31. package/lib/errors/error-trace-aggregator.js +59 -0
  32. package/lib/errors/helper.js +137 -0
  33. package/lib/errors/index.js +25 -35
  34. package/lib/injector.js +161 -0
  35. package/lib/instrumentation/@hapi/hapi.js +3 -0
  36. package/lib/instrumentation/core/globals.js +6 -13
  37. package/lib/instrumentation/core/http-outbound.js +3 -1
  38. package/lib/instrumentations.js +1 -0
  39. package/lib/metrics/index.js +4 -4
  40. package/lib/metrics/metric-aggregator.js +176 -0
  41. package/lib/metrics/names.js +14 -1
  42. package/lib/serverless/aws-lambda.js +33 -1
  43. package/lib/shimmer.js +120 -4
  44. package/lib/spans/span-event-aggregator.js +72 -0
  45. package/lib/transaction/index.js +47 -2
  46. package/lib/transaction/trace/aggregator.js +246 -145
  47. package/lib/transaction/trace/index.js +4 -4
  48. package/lib/transaction/transaction-event-aggregator.js +149 -0
  49. package/lib/util/urltils.js +23 -0
  50. package/lib/utilization/common.js +11 -4
  51. package/package.json +13 -11
  52. package/lib/db/tracer.js +0 -237
  53. package/lib/event-aggregator.js +0 -94
  54. package/lib/harvest.js +0 -708
  55. package/lib/spans/aggregator.js +0 -39
package/.travis.yml CHANGED
@@ -1,44 +1,38 @@
1
1
  language: node_js
2
2
  node_js:
3
- - "6"
4
- - "7"
3
+ # - "6"
5
4
  - "8"
6
- - "9"
7
5
  - "10"
8
6
  env:
9
- - SUITE=smoke
10
- - SUITE=unit
11
- - SUITE=integration
12
- - SUITE=lint
13
- - SUITE=security
14
- - SUITE=versioned
7
+ global:
8
+ - MONGODB=2.6.11
9
+ matrix:
10
+ - SUITE=smoke
11
+ - SUITE=unit
12
+ - SUITE=integration
13
+ - SUITE=lint
14
+ - SUITE=security
15
+ - SUITE=versioned
15
16
  matrix:
16
17
  exclude:
17
18
  - node_js: "6"
18
19
  env: SUITE=security
19
20
  - node_js: "6"
20
21
  env: SUITE=lint
21
- - node_js: "7"
22
- env: SUITE=security
23
- - node_js: "7"
24
- env: SUITE=lint
25
22
  - node_js: "8"
26
23
  env: SUITE=security
27
24
  - node_js: "8"
28
25
  env: SUITE=lint
29
- - node_js: "9"
30
- env: SUITE=security
31
- - node_js: "9"
32
- env: SUITE=lint
33
- addons:
34
- postgresql: "9.3"
35
26
  services:
36
27
  - memcached
37
28
  - mysql
38
29
  - redis
39
- - cassandra
40
30
  - postgresql
41
31
  - rabbitmq
32
+ addons:
33
+ apt:
34
+ packages:
35
+ - rabbitmq-server
42
36
  before_install:
43
37
  - ./bin/travis-setup.sh
44
38
  install: if [ "$SUITE" != "smoke" ]; then npm ci; fi
package/CONTRIBUTING.md CHANGED
@@ -21,7 +21,7 @@ The agent includes a suite of unit and functional tests which should be used to
21
21
  verify your changes don't break existing functionality.
22
22
 
23
23
  Unit tests are stored in `test/`. They're written in
24
- [Mocha](http://visionmedia.github.io/mocha/), and have the extension
24
+ [Mocha](https://mochajs.org), and have the extension
25
25
  `.test.js`.
26
26
 
27
27
  Generic functional tests are stored in `test/integration/`. They're written in
@@ -48,9 +48,9 @@ To run the tests you need an openssl command-line binary, and some services:
48
48
 
49
49
  If you have these all running locally on the standard ports, then you are good
50
50
  to go. However, the suggested path is to use [Docker](http://www.docker.com).
51
- If you use OS X or Windows, use Docker Machine, which can be installed as a part of
52
- [Docker Toolbox](https://www.docker.com/docker-toolbox). Then, run `npm run services`
53
- to start docker containers for each of the above services.
51
+ If you use macOS or Windows, install [Docker Desktop]
52
+ (https://www.docker.com/products/docker-desktop). Then, run `npm run services`
53
+ to download and launch docker containers for each of the above services.
54
54
 
55
55
  If you have these services available on non-standard ports or elsewhere on your
56
56
  network, you can use the following environment variables to tell the tests where
package/NEWS.md CHANGED
@@ -1,3 +1,144 @@
1
+ ### 5.13.1 (2019-10-10):
2
+
3
+ * Added back generation of entity stats logging and uninstrumented support metric
4
+ generation on metric harvests.
5
+
6
+ * Removed legacy harvest code from main agent.
7
+
8
+ * Updated `https-proxy-agent` to v3 for security fix.
9
+
10
+ Shoutout to @asturur for the contribution.
11
+
12
+ * Added diagnostic code injector.
13
+
14
+ The agent may now be configured to make transaction state checks via code
15
+ injection. This may be turned on by setting `code_injector.diagnostics.enabled`
16
+ to `true`. While this option is enabled, code around async boundaries will be added
17
+ to track transactions, and log a message when they are not properly reinstated.
18
+
19
+ * Fixed bug where `API.shutdown()` would not properly harvest when configured to.
20
+
21
+ * `primary_application_id` now defaults to 'Unknown' in serverless mode to allow
22
+ Distributed Tracing to function correctly when `NEW_RELIC_PRIMARY_APPLICATION_ID`
23
+ is not defined.
24
+
25
+ * Upgraded `tap` to latest version
26
+
27
+ * Upgraded `mocha` to latest version.
28
+
29
+ * Adds `--exit` flag to mocha test runs to prevent infinite runs on CI.
30
+
31
+ * Fixed bug where multiple agent restarts would cause the number of 'stopped'
32
+ listeners to exceed limit.
33
+
34
+ * Fixed inconsistent async return from collector API.
35
+
36
+ This could result in an infinite loop due to attempting to merge before clearing.
37
+ *This bug should not have impacted normal agent runs but was uncovered for certain
38
+ test cases.*
39
+
40
+ * Fixed tests that leave work scheduled on the event loop.
41
+
42
+ * Fixed issue that could result in vendor utilization detection failure.
43
+ As a part of this fix, the request that hits the timeout will immediately abort
44
+ instead of hanging around for the default timeout.
45
+
46
+ ### 5.13.0 (2019-10-01):
47
+
48
+ * Same as 5.12.0
49
+
50
+ ### 5.12.0 (2019-10-01):
51
+
52
+ * Now supports Restify 7 and 8.
53
+
54
+ * Distributed Tracing is now enabled by default in serverless mode.
55
+
56
+ * Maximum event limits are now enforced by the server. This includes
57
+ a new maximum of 10000 transaction events per minute.
58
+
59
+ * Harvesting is now completed by individually scheduled harvesters per data type.
60
+
61
+ * Bumps tap version to move beyond handlebars audit warning.
62
+
63
+ * Bumps `restify` dev dependency past audit warning.
64
+
65
+ * HTTPS connections to New Relic now use a keep alive HTTP-Agent.
66
+
67
+ * Drops old odd-numbered node versions that are no longer supported by node from
68
+ travis testing.
69
+
70
+ * Fixed bug where segment reference on the outbound request was enumerable.
71
+
72
+ * Fixed bug where incorrect config information was sent to New Relic.
73
+
74
+ * Updated Mocha and Docker links in CONTRIBUTING.md.
75
+
76
+ * The agent will now end/serialize transactions in the event of an uncaught
77
+ exception while operating in serverless mode.
78
+
79
+ ### 5.11.0 (2019-07-29):
80
+
81
+ * Implements Expected and Ignored Errors functionality
82
+
83
+ * Bumps jsdoc and lodash dev dependency to avoid upstream vulnerability warning.
84
+
85
+ * Added support for scoped package name introduced in hapi v18 (@hapi/hapi).
86
+
87
+ This will provide functionality at parity with instrumentation for hapi v17. Any
88
+ new features may not yet be supported.
89
+
90
+ Huge shoutout to Aori Nevo (@aorinevo) for this contribution.
91
+
92
+ * Fixed bug where agent would count errors towards error metrics even if they were
93
+ dropped due to the error collector being disabled.
94
+
95
+ * The agent will now properly track cached paths to files in loaded modules on Node
96
+ versions >10.
97
+
98
+ As of Node v11, the path to a file in a module being loaded will only be resolved
99
+ on the first load; subsequent resolution of that file will use a cached value.
100
+ The agent records this resolved path and uses it for relative file look ups in
101
+ order to deep link into modules using `Shim#require`. Since the agent couldn't
102
+ reliably get at the path on the subsequent calls to require, it now replicates
103
+ the caching logic and hold onto the resolved path for a given file.
104
+
105
+ * Adds detailed logging through harvest/collector code to increase supportability.
106
+
107
+ ### 5.10.0 (2019-06-11):
108
+
109
+ * The agent now allows installation on node v11 and v12.
110
+
111
+ This change relaxes the engines restriction to include Node v11 and v12. This does
112
+ not constitute official support for those versions, and users on those versions
113
+ may run into subtle incompatibilities. For those users who are interested in
114
+ experimenting with the agent on v11 and v12, we are tracking relevant issues
115
+ here: https://github.com/newrelic/node-newrelic/issues/279.
116
+
117
+ * Lambda invocations ended with promises will now be recorded properly.
118
+
119
+ Previously, the lambda instrumentation was not intercepting the promise
120
+ resolution/rejection returned from a lambda handler. The instrumentation now
121
+ properly observes the promise, and ends the transaction when the promise has
122
+ finished.
123
+
124
+ * Lambda invocations will only attempt to end the related transaction a single time.
125
+
126
+ In the event of two lambda response events (e.g. callback called, and a promise
127
+ returned), the agent would attempt to end the transaction twice, producing an
128
+ extraneous empty payload. The agent now limits itself to a single end call for
129
+ a given transaction.
130
+
131
+ * The agent will now properly end transactions in the face of uncaught exceptions
132
+ while in serverless mode.
133
+
134
+ * Enables ability to migrate to Configurable Security Policies (CSP) on a per agent
135
+ basis for accounts already using High Security Mode (HSM).
136
+
137
+ When both HSM and CSP are enabled for an account, an agent (this version or later)
138
+ can successfully connect with either `high_security: true` or the appropriate
139
+ `security_policies_token` configured. `high_security` has been added as part of
140
+ the preconnect payload.
141
+
1
142
  ### 5.9.1 (2019-05-28):
2
143
 
3
144
  * moved third party notices to `THIRD_PARTY_NOTICES.md`
package/api.js CHANGED
@@ -1084,7 +1084,7 @@ API.prototype.recordCustomEvent = function recordCustomEvent(eventType, attribut
1084
1084
 
1085
1085
  var tx = this.agent.getTransaction()
1086
1086
  var priority = tx && tx.priority || Math.random()
1087
- this.agent.customEvents.add([instrinics, filteredAttributes], priority)
1087
+ this.agent.customEventAggregator.add([instrinics, filteredAttributes], priority)
1088
1088
  }
1089
1089
 
1090
1090
  /**
@@ -1405,8 +1405,9 @@ function _doShutdown(api, options, callback) {
1405
1405
  }
1406
1406
 
1407
1407
  agent.on('started', function shutdownHarvest() {
1408
- agent.harvest(afterHarvest)
1408
+ agent.forceHarvestAll(afterHarvest)
1409
1409
  })
1410
+
1410
1411
  agent.on('errored', function logShutdownError(error) {
1411
1412
  agent.stop(callback)
1412
1413
  if (error) {
@@ -1417,7 +1418,7 @@ function _doShutdown(api, options, callback) {
1417
1418
  }
1418
1419
  })
1419
1420
  } else if (options.collectPendingData) {
1420
- agent.harvest(afterHarvest)
1421
+ agent.forceHarvestAll(afterHarvest)
1421
1422
  } else {
1422
1423
  agent.stop(callback)
1423
1424
  }
@@ -0,0 +1,8 @@
1
+ #! /bin/bash
2
+
3
+ sudo apt-get install python openjdk-8-jre -y
4
+ echo "deb http://www.apache.org/dist/cassandra/debian 311x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
5
+ curl https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add -
6
+ sudo apt-get update
7
+ sudo apt-get install cassandra
8
+ sudo service cassandra start
@@ -18,4 +18,6 @@ if [[ "$1" != '' ]]; then
18
18
  fi
19
19
 
20
20
  export AGENT_PATH=`pwd`
21
- time ./node_modules/.bin/versioned-tests $VERSIONED_MODE -i 2 ${directories[@]}
21
+
22
+ # This is meant to be temporary. Remove once new major version with fixes rolled into agent.
23
+ time ./node_modules/.bin/versioned-tests $VERSIONED_MODE -i 2 --skip koa ${directories[@]}
@@ -1,9 +1,13 @@
1
1
  #!/bin/bash
2
2
 
3
- set -x # echo commands as executed
3
+ set -xev # -x echo commands as executed
4
+ # -e exit as soon as something goes wrong
5
+ # -v when considering whether to say something or not say something
6
+ # take the appraoch that provide as much information as possible
7
+ # which human beings something describe as being verbose
4
8
 
5
- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
6
- echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
7
- sudo apt-get update -qq
8
- sudo apt-get install -y mongodb-org
9
- mongod --version
9
+ wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-${MONGODB}.tgz -O /tmp/mongodb.tgz
10
+ mkdir -p /tmp/mongodb/data
11
+ tar -xf /tmp/mongodb.tgz -C /tmp/mongodb
12
+ /tmp/mongodb/mongodb-linux-x86_64-${MONGODB}/bin/mongod --version
13
+ /tmp/mongodb/mongodb-linux-x86_64-${MONGODB}/bin/mongod --dbpath /tmp/mongodb/data --bind_ip 127.0.0.1 --noauth &> /dev/null &
@@ -25,6 +25,8 @@ else
25
25
  fi
26
26
 
27
27
  if [ "$SUITE" = "versioned" ]; then
28
+ echo " --- installing cassandra --- "
29
+ ./bin/cassandra-setup.sh
28
30
 
29
31
  # GCC 5 is the lowest version of GCC we can use.
30
32
  if [ "$(get_version gcc)" == "4" ]; then
@@ -40,7 +42,7 @@ if [ "$SUITE" = "versioned" ]; then
40
42
  # MongoDB is always installed in integrations and versioned.
41
43
  echo " --- installing mongodb --- "
42
44
  add_toolchain
43
- ./bin/travis-install-mongo.sh > /dev/null
45
+ ./bin/travis-install-mongo.sh
44
46
 
45
47
  echo " --- done installing $SUITE requirements --- "
46
48
  else