newrelic 6.4.0 → 6.6.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 (44) hide show
  1. package/.eslintignore +1 -1
  2. package/{.eslintrc → .eslintrc.js} +2 -1
  3. package/.travis.yml +5 -6
  4. package/NEWS.md +105 -1
  5. package/THIRD_PARTY_NOTICES.md +420 -0
  6. package/api.js +72 -1
  7. package/index.js +3 -3
  8. package/lib/agent.js +22 -8
  9. package/lib/aggregators/base-aggregator.js +1 -1
  10. package/lib/attributes.js +15 -6
  11. package/lib/collector/serverless.js +8 -0
  12. package/lib/config/default.js +23 -1
  13. package/lib/config/env.js +7 -1
  14. package/lib/config/hsm.js +6 -1
  15. package/lib/config/index.js +36 -8
  16. package/lib/config/lasp.js +16 -1
  17. package/lib/errors/error-collector.js +51 -90
  18. package/lib/errors/helper.js +13 -13
  19. package/lib/errors/index.js +36 -18
  20. package/lib/grpc/connection/states.js +9 -0
  21. package/lib/grpc/connection.js +344 -0
  22. package/lib/grpc/endpoints/infinite-tracing/v1.proto +29 -0
  23. package/lib/header-processing.js +75 -0
  24. package/lib/instrumentation/core/child_process.js +12 -0
  25. package/lib/instrumentation/core/http-outbound.js +4 -0
  26. package/lib/instrumentation/core/http.js +98 -145
  27. package/lib/instrumentation/hapi/hapi-17.js +10 -3
  28. package/lib/metrics/names.js +12 -1
  29. package/lib/proxy/grpc.js +15 -0
  30. package/lib/serverless/aws-lambda.js +2 -0
  31. package/lib/spans/create-span-event-aggregator.js +112 -0
  32. package/lib/spans/map-to-streaming-type.js +44 -0
  33. package/lib/spans/span-event-aggregator.js +5 -0
  34. package/lib/spans/span-event.js +22 -9
  35. package/lib/spans/span-streamer.js +109 -0
  36. package/lib/spans/streaming-span-attributes.js +59 -0
  37. package/lib/spans/streaming-span-event-aggregator.js +98 -0
  38. package/lib/spans/streaming-span-event.js +261 -0
  39. package/lib/transaction/index.js +36 -20
  40. package/lib/transaction/trace/index.js +13 -10
  41. package/lib/transaction/trace/segment.js +12 -1
  42. package/lib/transaction/tracecontext.js +4 -0
  43. package/package.json +10 -10
  44. package/stub_api.js +5 -0
@@ -6,7 +6,7 @@ const Timer = require('../../timer')
6
6
  const urltils = require('../../util/urltils')
7
7
  const hashes = require('../../util/hashes')
8
8
 
9
- const Attributes = require('../../attributes')
9
+ const {Attributes, MAXIMUM_CUSTOM_ATTRIBUTES} = require('../../attributes')
10
10
  const ExclusiveCalculator = require('./exclusive-time-calculator')
11
11
 
12
12
  const NAMES = require('../../metrics/names')
@@ -52,6 +52,7 @@ function TraceSegment(transaction, name, recorder) {
52
52
  }
53
53
 
54
54
  this.attributes = new Attributes(ATTRIBUTE_SCOPE)
55
+ this.customAttributes = new Attributes(ATTRIBUTE_SCOPE, MAXIMUM_CUSTOM_ATTRIBUTES)
55
56
 
56
57
  this.children = []
57
58
 
@@ -90,6 +91,16 @@ TraceSegment.prototype.getAttributes = function getAttributes() {
90
91
  return this.attributes.get(DESTINATIONS.TRANS_SEGMENT)
91
92
  }
92
93
 
94
+ TraceSegment.prototype.addCustomSpanAttribute =
95
+ function addCustomSpanAttribute(key, value, truncateExempt = false) {
96
+ this.customAttributes.addAttribute(
97
+ DESTINATIONS.SPAN_EVENT,
98
+ key,
99
+ value,
100
+ truncateExempt
101
+ )
102
+ }
103
+
93
104
  TraceSegment.prototype.getSpanId = function getSpanId() {
94
105
  const conf = this.transaction.agent.config
95
106
  const enabled = conf.span_events.enabled && conf.distributed_tracing.enabled
@@ -408,6 +408,10 @@ class TraceContext {
408
408
  const listMemberParts = listMember.split('=')
409
409
  if (listMemberParts.length !== 2) {
410
410
  tsd.traceStateValid = false
411
+ logger.debug('Unable to parse tracestate list members.')
412
+ this.transaction.agent
413
+ .recordSupportability('TraceContext/TraceState/Parse/Exception/ListMember')
414
+
411
415
  return tsd
412
416
  }
413
417
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newrelic",
3
- "version": "6.4.0",
3
+ "version": "6.6.0",
4
4
  "author": "New Relic Node.js agent team <nodejs@newrelic.com>",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "contributors": [
@@ -96,7 +96,7 @@
96
96
  ],
97
97
  "homepage": "http://github.com/newrelic/node-newrelic",
98
98
  "engines": {
99
- "node": ">=8.0.0 <13.0.0",
99
+ "node": ">=8.0.0",
100
100
  "npm": ">=3.0.0"
101
101
  },
102
102
  "directories": {
@@ -113,13 +113,12 @@
113
113
  "lint": "eslint ./*.js lib test",
114
114
  "public-docs": "npm ci && jsdoc -c ./jsdoc-conf.json --tutorials examples/shim api.js lib/shim/ lib/transaction/handle.js && cp examples/shim/*.png out/",
115
115
  "publish-docs": "./bin/publish-docs.sh",
116
- "security": "npm audit",
117
116
  "services": "./bin/docker-services.sh",
118
117
  "smoke": "npm run clean && ./bin/smoke.sh",
119
118
  "ssl": "./bin/ssl.sh",
120
119
  "sub-install": "node test/bin/install_sub_deps",
121
120
  "test": "npm run integration && npm run unit",
122
- "unit": "rm -f newrelic_agent.log && mocha -r nock -c test/unit --recursive --exit",
121
+ "unit": "rm -f newrelic_agent.log && time tap --test-regex='(\\/|^test\\/unit\\/.*\\.test\\.js)$' --timeout=120 --no-coverage",
123
122
  "update-cross-agent-tests": "./bin/update-cats.sh",
124
123
  "versioned-tests": "./bin/run-versioned-tests.sh",
125
124
  "versioned": "npm run prepare-test && time ./bin/run-versioned-tests.sh"
@@ -128,15 +127,17 @@
128
127
  "newrelic-naming-rules": "./bin/test-naming-rules.js"
129
128
  },
130
129
  "dependencies": {
130
+ "@grpc/grpc-js": "^0.6.15",
131
+ "@grpc/proto-loader": "^0.5.3",
131
132
  "@newrelic/aws-sdk": "^1.1.1",
132
133
  "@newrelic/koa": "^3.0.0",
133
- "@newrelic/superagent": "^2.0.0",
134
+ "@newrelic/superagent": "^2.0.1",
134
135
  "@tyriar/fibonacci-heap": "^2.0.7",
135
136
  "async": "^2.1.4",
136
137
  "concat-stream": "^2.0.0",
137
138
  "escodegen": "^1.11.1",
138
139
  "esprima": "^4.0.1",
139
- "https-proxy-agent": "^3.0.0",
140
+ "https-proxy-agent": "^4.0.0",
140
141
  "json-stringify-safe": "^5.0.0",
141
142
  "readable-stream": "^3.1.1",
142
143
  "semver": "^5.3.0"
@@ -152,7 +153,7 @@
152
153
  "benchmark": "^2.1.4",
153
154
  "bluebird": "^3.4.7",
154
155
  "chai": "^4.1.2",
155
- "eslint": "^5.13.0",
156
+ "eslint": "^6.8.0",
156
157
  "express": "*",
157
158
  "generic-pool": "^3.6.1",
158
159
  "glob": "^7.1.2",
@@ -161,10 +162,9 @@
161
162
  "lodash": "^4.17.14",
162
163
  "memcached": ">=0.2.8",
163
164
  "minami": "^1.1.1",
164
- "mocha": "^6.2.1",
165
165
  "mongodb": "^3.3.3",
166
166
  "mysql": "*",
167
- "nock": "9.1.9",
167
+ "nock": "11.8.0",
168
168
  "proxyquire": "^1.8.0",
169
169
  "q": "*",
170
170
  "redis": "^1.0.0",
@@ -173,7 +173,7 @@
173
173
  "rimraf": "^2.6.3",
174
174
  "should": "*",
175
175
  "sinon": "^4.5.0",
176
- "tap": "^14.10.1",
176
+ "tap": "^14.10.6",
177
177
  "temp": "^0.8.1",
178
178
  "through": "^2.3.6",
179
179
  "when": "*"
package/stub_api.js CHANGED
@@ -36,6 +36,7 @@ Stub.prototype.getTransaction = getTransaction
36
36
  Stub.prototype.getBrowserTimingHeader = getBrowserTimingHeader
37
37
  Stub.prototype.shutdown = shutdown
38
38
  Stub.prototype.setLambdaHandler = setLambdaHandler
39
+ Stub.prototype.getLinkingMetadata = getLinkingMetadata
39
40
  Stub.prototype.getTraceMetadata = getTraceMetadata
40
41
 
41
42
  // This code gets injected into HTML templates
@@ -62,6 +63,10 @@ function startSegment(name, record, handler, callback) {
62
63
  return null
63
64
  }
64
65
 
66
+ function getLinkingMetadata() {
67
+ return {}
68
+ }
69
+
65
70
  function getTraceMetadata() {
66
71
  return {
67
72
  traceId: '',