newrelic 8.0.0 → 8.4.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.
- package/NEWS.md +5023 -4922
- package/THIRD_PARTY_NOTICES.md +618 -209
- package/api.js +156 -219
- package/bin/test-naming-rules.js +57 -51
- package/bin/tracetractor +0 -1
- package/index.js +7 -14
- package/lib/agent.js +111 -114
- package/lib/aggregators/base-aggregator.js +1 -1
- package/lib/aggregators/event-aggregator.js +6 -6
- package/lib/attributes.js +13 -14
- package/lib/collector/api.js +44 -54
- package/lib/collector/facts.js +68 -66
- package/lib/collector/http-agents.js +36 -32
- package/lib/collector/key-parser.js +1 -1
- package/lib/collector/parse-response.js +1 -2
- package/lib/collector/remote-method.js +69 -61
- package/lib/collector/serverless.js +13 -18
- package/lib/collector/ssl/certificates.js +1056 -1056
- package/lib/config/attribute-filter.js +109 -101
- package/lib/config/default.js +35 -21
- package/lib/config/env.js +17 -12
- package/lib/config/harvest-config-validator.js +1 -1
- package/lib/config/hsm.js +1 -1
- package/lib/config/index.js +240 -234
- package/lib/config/lasp.js +3 -3
- package/lib/config/merge-server-config.js +8 -6
- package/lib/custom-events/custom-event-aggregator.js +1 -1
- package/lib/db/parse-sql.js +13 -16
- package/lib/db/parsed-statement.js +13 -19
- package/lib/db/query-parsers/sql.js +12 -15
- package/lib/db/query-sample.js +16 -12
- package/lib/db/query-trace-aggregator.js +16 -16
- package/lib/db/statement-matcher.js +5 -5
- package/lib/db/utils.js +2 -2
- package/lib/environment.js +210 -175
- package/lib/errors/error-collector.js +20 -33
- package/lib/errors/error-event-aggregator.js +1 -1
- package/lib/errors/error-trace-aggregator.js +3 -4
- package/lib/errors/helper.js +23 -32
- package/lib/errors/index.js +31 -43
- package/lib/feature_flags.js +3 -4
- package/lib/grpc/connection/states.js +6 -6
- package/lib/grpc/connection.js +35 -46
- package/lib/header-attributes.js +55 -59
- package/lib/header-processing.js +1 -1
- package/lib/instrumentation/amqplib.js +34 -43
- package/lib/instrumentation/bluebird.js +63 -22
- package/lib/instrumentation/cassandra-driver.js +8 -4
- package/lib/instrumentation/connect.js +7 -6
- package/lib/instrumentation/core/async_hooks.js +16 -9
- package/lib/instrumentation/core/child_process.js +20 -28
- package/lib/instrumentation/core/crypto.js +1 -7
- package/lib/instrumentation/core/dns.js +3 -7
- package/lib/instrumentation/core/domain.js +4 -10
- package/lib/instrumentation/core/fs.js +22 -37
- package/lib/instrumentation/core/globals.js +4 -8
- package/lib/instrumentation/core/http-outbound.js +20 -114
- package/lib/instrumentation/core/http.js +61 -128
- package/lib/instrumentation/core/inspector.js +7 -11
- package/lib/instrumentation/core/net.js +3 -1
- package/lib/instrumentation/core/timers.js +21 -28
- package/lib/instrumentation/core/zlib.js +3 -11
- package/lib/instrumentation/director.js +4 -4
- package/lib/instrumentation/express.js +12 -10
- package/lib/instrumentation/fastify/spec-builders.js +5 -0
- package/lib/instrumentation/fastify.js +37 -10
- package/lib/instrumentation/generic-pool.js +1 -1
- package/lib/instrumentation/hapi/hapi-17.js +20 -21
- package/lib/instrumentation/hapi/shared.js +1 -1
- package/lib/instrumentation/hapi.js +37 -37
- package/lib/instrumentation/ioredis.js +8 -9
- package/lib/instrumentation/memcached.js +41 -45
- package/lib/instrumentation/mongodb/common.js +221 -0
- package/lib/instrumentation/mongodb/constants.js +87 -0
- package/lib/instrumentation/mongodb/v2-mongo.js +110 -0
- package/lib/instrumentation/mongodb/v3-mongo.js +80 -0
- package/lib/instrumentation/mongodb/v4-mongo.js +90 -0
- package/lib/instrumentation/mongodb.js +20 -312
- package/lib/instrumentation/mysql.js +51 -44
- package/lib/instrumentation/oracle.js +24 -28
- package/lib/instrumentation/pg.js +34 -25
- package/lib/instrumentation/promise.js +65 -62
- package/lib/instrumentation/q.js +2 -2
- package/lib/instrumentation/redis.js +38 -38
- package/lib/instrumentation/restify.js +1 -1
- package/lib/instrumentation/vision.js +4 -4
- package/lib/instrumentation/when.js +12 -4
- package/lib/instrumentations.js +25 -25
- package/lib/logger.js +6 -6
- package/lib/metrics/index.js +50 -30
- package/lib/metrics/mapper.js +15 -15
- package/lib/metrics/metric-aggregator.js +5 -10
- package/lib/metrics/names.js +8 -7
- package/lib/metrics/normalizer/rule.js +14 -15
- package/lib/metrics/normalizer/tx_segment.js +33 -29
- package/lib/metrics/normalizer.js +51 -54
- package/lib/metrics/recorders/custom.js +8 -6
- package/lib/metrics/recorders/distributed-trace.js +3 -18
- package/lib/metrics/recorders/generic.js +6 -5
- package/lib/metrics/recorders/http.js +11 -13
- package/lib/metrics/recorders/http_external.js +8 -10
- package/lib/metrics/recorders/message-transaction.js +7 -18
- package/lib/metrics/recorders/other.js +7 -17
- package/lib/parse-proc-cpuinfo.js +26 -31
- package/lib/parse-proc-meminfo.js +5 -3
- package/lib/prioritized-attributes.js +14 -19
- package/lib/priority-queue.js +11 -11
- package/lib/proxy/grpc.js +1 -1
- package/lib/reservoir.js +12 -6
- package/lib/sampler.js +33 -34
- package/lib/serverless/api-gateway.js +3 -3
- package/lib/serverless/aws-lambda.js +28 -37
- package/lib/shim/conglomerate-shim.js +4 -4
- package/lib/shim/datastore-shim.js +61 -67
- package/lib/shim/index.js +10 -11
- package/lib/shim/message-shim.js +149 -151
- package/lib/shim/promise-shim.js +19 -14
- package/lib/shim/shim.js +131 -125
- package/lib/shim/specs/index.js +21 -22
- package/lib/shim/transaction-shim.js +52 -210
- package/lib/shim/webframework-shim.js +75 -85
- package/lib/shimmer.js +184 -166
- package/lib/spans/create-span-event-aggregator.js +11 -8
- package/lib/spans/span-context.js +4 -10
- package/lib/spans/span-event-aggregator.js +68 -13
- package/lib/spans/span-event.js +6 -8
- package/lib/spans/span-streamer.js +10 -18
- package/lib/spans/streaming-span-attributes.js +1 -1
- package/lib/spans/streaming-span-event-aggregator.js +1 -1
- package/lib/spans/streaming-span-event.js +4 -4
- package/lib/stats/apdex.js +7 -13
- package/lib/stats/index.js +14 -19
- package/lib/system-info.js +29 -25
- package/lib/timer.js +35 -21
- package/lib/transaction/dt-payload.js +1 -1
- package/lib/transaction/handle.js +19 -19
- package/lib/transaction/index.js +133 -151
- package/lib/transaction/name-state.js +18 -19
- package/lib/transaction/trace/aggregator.js +78 -73
- package/lib/transaction/trace/exclusive-time-calculator.js +9 -13
- package/lib/transaction/trace/index.js +37 -35
- package/lib/transaction/trace/segment.js +56 -73
- package/lib/transaction/tracecontext.js +38 -46
- package/lib/transaction/tracer/index.js +130 -91
- package/lib/transaction/transaction-event-aggregator.js +29 -31
- package/lib/uninstrumented.js +11 -12
- package/lib/util/arity.js +2 -2
- package/lib/util/attribute-types.js +1 -5
- package/lib/util/byte-limit.js +4 -5
- package/lib/util/cat.js +270 -33
- package/lib/util/codec.js +10 -6
- package/lib/util/copy.js +2 -2
- package/lib/util/deep-equal.js +51 -21
- package/lib/util/flatten.js +9 -6
- package/lib/util/hashes.js +16 -16
- package/lib/util/label-parser.js +22 -28
- package/lib/util/logger.js +53 -35
- package/lib/util/process-version.js +3 -3
- package/lib/util/properties.js +5 -5
- package/lib/util/sql/obfuscate.js +21 -31
- package/lib/util/stream-sink.js +5 -6
- package/lib/util/unwrapped-core.js +2 -2
- package/lib/util/urltils.js +26 -30
- package/lib/utilization/aws-info.js +8 -9
- package/lib/utilization/azure-info.js +37 -35
- package/lib/utilization/common.js +17 -16
- package/lib/utilization/docker-info.js +14 -16
- package/lib/utilization/gcp-info.js +38 -37
- package/lib/utilization/index.js +5 -5
- package/lib/utilization/kubernetes-info.js +2 -2
- package/lib/utilization/pcf-info.js +12 -12
- package/package.json +23 -6
- package/stub_api.js +16 -14
|
@@ -5,16 +5,16 @@
|
|
|
5
5
|
|
|
6
6
|
'use strict'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
const util = require('util')
|
|
9
|
+
const url = require('url')
|
|
10
|
+
const https = require('https')
|
|
11
|
+
const zlib = require('zlib')
|
|
12
|
+
const logger = require('../logger').child({ component: 'remote_method' })
|
|
13
|
+
const parse = require('./parse-response')
|
|
14
|
+
const stringify = require('json-stringify-safe')
|
|
15
|
+
const Sink = require('../util/stream-sink')
|
|
16
|
+
const agents = require('./http-agents')
|
|
17
|
+
const certificates = require('./ssl/certificates')
|
|
18
18
|
const isValidLength = require('../util/byte-limit').isValidLength
|
|
19
19
|
|
|
20
20
|
/*
|
|
@@ -50,8 +50,9 @@ RemoteMethod.prototype.updateEndpoint = function updateEndpoint(endpoint) {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
RemoteMethod.prototype.serialize = function serialize(payload, callback) {
|
|
53
|
+
let res
|
|
53
54
|
try {
|
|
54
|
-
|
|
55
|
+
res = stringify(payload)
|
|
55
56
|
} catch (error) {
|
|
56
57
|
logger.error(error, 'Unable to serialize payload for method %s.', this.name)
|
|
57
58
|
return process.nextTick(function onNextTick() {
|
|
@@ -76,13 +77,20 @@ RemoteMethod.prototype.invoke = function invoke(payload, nrHeaders, callback) {
|
|
|
76
77
|
nrHeaders = null
|
|
77
78
|
}
|
|
78
79
|
|
|
79
|
-
if (!payload)
|
|
80
|
+
if (!payload) {
|
|
81
|
+
payload = []
|
|
82
|
+
}
|
|
80
83
|
logger.trace('Invoking remote method %s', this.name)
|
|
81
84
|
|
|
82
|
-
this.serialize(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
this.serialize(
|
|
86
|
+
payload,
|
|
87
|
+
function onSerialize(err, serialized) {
|
|
88
|
+
if (err) {
|
|
89
|
+
return callback(err)
|
|
90
|
+
}
|
|
91
|
+
this._post(serialized, nrHeaders, callback)
|
|
92
|
+
}.bind(this)
|
|
93
|
+
)
|
|
86
94
|
}
|
|
87
95
|
|
|
88
96
|
/**
|
|
@@ -95,8 +103,8 @@ RemoteMethod.prototype.invoke = function invoke(payload, nrHeaders, callback) {
|
|
|
95
103
|
* @param {Function} callback What to do next. Gets passed any error.
|
|
96
104
|
*/
|
|
97
105
|
RemoteMethod.prototype._post = function _post(data, nrHeaders, callback) {
|
|
98
|
-
|
|
99
|
-
|
|
106
|
+
const method = this
|
|
107
|
+
const options = {
|
|
100
108
|
port: this.endpoint.port,
|
|
101
109
|
host: this.endpoint.host,
|
|
102
110
|
compressed: this._shouldCompress(data),
|
|
@@ -108,18 +116,14 @@ RemoteMethod.prototype._post = function _post(data, nrHeaders, callback) {
|
|
|
108
116
|
|
|
109
117
|
// Check trace enabled first since we're creating an object for this log message.
|
|
110
118
|
if (logger.traceEnabled()) {
|
|
111
|
-
logger.trace(
|
|
112
|
-
{data, compressed: options.compressed},
|
|
113
|
-
'Calling %s on collector API',
|
|
114
|
-
this.name
|
|
115
|
-
)
|
|
119
|
+
logger.trace({ data, compressed: options.compressed }, 'Calling %s on collector API', this.name)
|
|
116
120
|
}
|
|
117
121
|
|
|
118
122
|
if (options.compressed) {
|
|
119
123
|
// NOTE: gzip and deflate throw immediately in Node 14+ with an invalid argument
|
|
120
124
|
try {
|
|
121
|
-
|
|
122
|
-
|
|
125
|
+
const useGzip = this._config.compressed_content_encoding === 'gzip'
|
|
126
|
+
const compressor = useGzip ? zlib.gzip : zlib.deflate
|
|
123
127
|
compressor(data, function onCompress(err, compressed) {
|
|
124
128
|
if (err) {
|
|
125
129
|
logger.warn(err, 'Error compressing JSON for delivery. Not sending.')
|
|
@@ -150,10 +154,7 @@ RemoteMethod.prototype._post = function _post(data, nrHeaders, callback) {
|
|
|
150
154
|
// set up standard response handling
|
|
151
155
|
function onResponse(response) {
|
|
152
156
|
response.on('end', function onEnd() {
|
|
153
|
-
logger.debug(
|
|
154
|
-
'Finished receiving data back from the collector for %s.',
|
|
155
|
-
method.name
|
|
156
|
-
)
|
|
157
|
+
logger.debug('Finished receiving data back from the collector for %s.', method.name)
|
|
157
158
|
})
|
|
158
159
|
|
|
159
160
|
response.setEncoding('utf8')
|
|
@@ -175,19 +176,33 @@ RemoteMethod.prototype._post = function _post(data, nrHeaders, callback) {
|
|
|
175
176
|
* @param {object} options A dictionary of request parameters.
|
|
176
177
|
*/
|
|
177
178
|
RemoteMethod.prototype._safeRequest = function _safeRequest(options) {
|
|
178
|
-
if (!options)
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
if (!options.
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
if (!options.
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
179
|
+
if (!options) {
|
|
180
|
+
throw new Error('Must include options to make request!')
|
|
181
|
+
}
|
|
182
|
+
if (!options.host) {
|
|
183
|
+
throw new Error('Must include collector hostname!')
|
|
184
|
+
}
|
|
185
|
+
if (!options.port) {
|
|
186
|
+
throw new Error('Must include collector port!')
|
|
187
|
+
}
|
|
188
|
+
if (!options.onError) {
|
|
189
|
+
throw new Error('Must include error handler!')
|
|
190
|
+
}
|
|
191
|
+
if (!options.onResponse) {
|
|
192
|
+
throw new Error('Must include response handler!')
|
|
193
|
+
}
|
|
194
|
+
if (!options.body) {
|
|
195
|
+
throw new Error('Must include body to send to collector!')
|
|
196
|
+
}
|
|
197
|
+
if (!options.path) {
|
|
198
|
+
throw new Error('Must include URL to request!')
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const protocol = 'https'
|
|
202
|
+
const logConfig = this._config.logging
|
|
203
|
+
const auditLog = this._config.audit_log
|
|
189
204
|
const maxPayloadSize = this._config.max_payload_size_in_bytes
|
|
190
|
-
|
|
205
|
+
let level = 'trace'
|
|
191
206
|
|
|
192
207
|
if (!isValidLength(options.body, maxPayloadSize)) {
|
|
193
208
|
logger.warn(
|
|
@@ -209,10 +224,9 @@ RemoteMethod.prototype._safeRequest = function _safeRequest(options) {
|
|
|
209
224
|
}
|
|
210
225
|
}
|
|
211
226
|
|
|
212
|
-
const logBody =
|
|
213
|
-
Buffer.isBuffer(options.body) ? 'Buffer ' + options.body.length : options.body
|
|
227
|
+
const logBody = Buffer.isBuffer(options.body) ? 'Buffer ' + options.body.length : options.body
|
|
214
228
|
logger[level](
|
|
215
|
-
{body: logBody},
|
|
229
|
+
{ body: logBody },
|
|
216
230
|
'Posting to %s://%s:%s%s',
|
|
217
231
|
protocol,
|
|
218
232
|
options.host,
|
|
@@ -239,23 +253,19 @@ RemoteMethod.prototype._safeRequest = function _safeRequest(options) {
|
|
|
239
253
|
* ._post).
|
|
240
254
|
*/
|
|
241
255
|
RemoteMethod.prototype._request = function _request(options) {
|
|
242
|
-
|
|
256
|
+
const requestOptions = {
|
|
243
257
|
method: this._config.put_for_data_send ? 'PUT' : 'POST',
|
|
244
|
-
setHost: false,
|
|
245
|
-
host: options.host,
|
|
258
|
+
setHost: false, // See below
|
|
259
|
+
host: options.host, // Set explicitly in the headers
|
|
246
260
|
port: options.port,
|
|
247
261
|
path: options.path,
|
|
248
262
|
headers: this._headers(options),
|
|
249
263
|
agent: agents.keepAliveAgent(),
|
|
250
|
-
__NR__connection: true
|
|
264
|
+
__NR__connection: true // Who measures the metrics measurer?
|
|
251
265
|
}
|
|
252
|
-
|
|
266
|
+
let request
|
|
253
267
|
|
|
254
|
-
|
|
255
|
-
this._config.proxy ||
|
|
256
|
-
this._config.proxy_port ||
|
|
257
|
-
this._config.proxy_host
|
|
258
|
-
)
|
|
268
|
+
const isProxy = !!(this._config.proxy || this._config.proxy_port || this._config.proxy_host)
|
|
259
269
|
|
|
260
270
|
if (isProxy) {
|
|
261
271
|
// proxy
|
|
@@ -266,9 +276,7 @@ RemoteMethod.prototype._request = function _request(options) {
|
|
|
266
276
|
requestOptions.ca = this._config.certificates
|
|
267
277
|
|
|
268
278
|
if (this._config.feature_flag.certificate_bundle) {
|
|
269
|
-
logger.debug(
|
|
270
|
-
'Adding custom certificate to the cert bundle.'
|
|
271
|
-
)
|
|
279
|
+
logger.debug('Adding custom certificate to the cert bundle.')
|
|
272
280
|
|
|
273
281
|
const certWarningMessage = [
|
|
274
282
|
'Deprecation Warning: The certificate bundle included by New Relic will be ',
|
|
@@ -310,7 +318,7 @@ RemoteMethod.prototype._userAgent = function _userAgent() {
|
|
|
310
318
|
* @returns {string} The URL path to be POSTed to.
|
|
311
319
|
*/
|
|
312
320
|
RemoteMethod.prototype._path = function _path() {
|
|
313
|
-
|
|
321
|
+
const query = {
|
|
314
322
|
marshal_format: 'json',
|
|
315
323
|
protocol_version: this._protocolVersion,
|
|
316
324
|
license_key: this._config.license_key,
|
|
@@ -321,7 +329,7 @@ RemoteMethod.prototype._path = function _path() {
|
|
|
321
329
|
query[RUN_ID_NAME] = this._config.run_id
|
|
322
330
|
}
|
|
323
331
|
|
|
324
|
-
|
|
332
|
+
const formatted = url.format({
|
|
325
333
|
pathname: RAW_METHOD_PATH,
|
|
326
334
|
query: query
|
|
327
335
|
})
|
|
@@ -336,9 +344,9 @@ RemoteMethod.prototype._path = function _path() {
|
|
|
336
344
|
* @param {bool} options.compressed - The compression method used, if any.
|
|
337
345
|
*/
|
|
338
346
|
RemoteMethod.prototype._headers = function _headers(options) {
|
|
339
|
-
|
|
347
|
+
const agent = this._userAgent()
|
|
340
348
|
|
|
341
|
-
|
|
349
|
+
const headers = {
|
|
342
350
|
// select the virtual host on the server end
|
|
343
351
|
'Host': this.endpoint.host,
|
|
344
352
|
'User-Agent': agent,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
'use strict'
|
|
7
7
|
|
|
8
8
|
const CollectorResponse = require('./response')
|
|
9
|
-
const logger = require('../logger').child({component: 'serverless_collector'})
|
|
9
|
+
const logger = require('../logger').child({ component: 'serverless_collector' })
|
|
10
10
|
const zlib = require('zlib')
|
|
11
11
|
const fs = require('fs')
|
|
12
12
|
const stringify = require('json-stringify-safe')
|
|
@@ -17,6 +17,7 @@ const PAYLOAD_MARKER = 'NR_LAMBDA_MONITORING'
|
|
|
17
17
|
const path = require('path')
|
|
18
18
|
const defaultPipePath = path.resolve('/tmp', 'newrelic-telemetry')
|
|
19
19
|
|
|
20
|
+
/* eslint-disable camelcase */
|
|
20
21
|
class ServerlessCollector {
|
|
21
22
|
/**
|
|
22
23
|
* Constructs a new serverless collector instance with the give agent.
|
|
@@ -94,7 +95,7 @@ class ServerlessCollector {
|
|
|
94
95
|
this.payload.metric_data = payload
|
|
95
96
|
}
|
|
96
97
|
|
|
97
|
-
cb(null, {retainData: false})
|
|
98
|
+
cb(null, { retainData: false })
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
/**
|
|
@@ -108,7 +109,7 @@ class ServerlessCollector {
|
|
|
108
109
|
this.payload.error_data = payload
|
|
109
110
|
}
|
|
110
111
|
|
|
111
|
-
cb(null, {retainData: false})
|
|
112
|
+
cb(null, { retainData: false })
|
|
112
113
|
}
|
|
113
114
|
|
|
114
115
|
/**
|
|
@@ -122,7 +123,7 @@ class ServerlessCollector {
|
|
|
122
123
|
this.payload.error_event_data = payload
|
|
123
124
|
}
|
|
124
125
|
|
|
125
|
-
cb(null, {retainData: false})
|
|
126
|
+
cb(null, { retainData: false })
|
|
126
127
|
}
|
|
127
128
|
|
|
128
129
|
/**
|
|
@@ -135,7 +136,7 @@ class ServerlessCollector {
|
|
|
135
136
|
if (this.enabled) {
|
|
136
137
|
this.payload.transaction_sample_data = payload
|
|
137
138
|
}
|
|
138
|
-
cb(null, {retainData: false})
|
|
139
|
+
cb(null, { retainData: false })
|
|
139
140
|
}
|
|
140
141
|
|
|
141
142
|
/**
|
|
@@ -149,7 +150,7 @@ class ServerlessCollector {
|
|
|
149
150
|
this.payload.analytic_event_data = payload
|
|
150
151
|
}
|
|
151
152
|
|
|
152
|
-
cb(null, {retainData: false})
|
|
153
|
+
cb(null, { retainData: false })
|
|
153
154
|
}
|
|
154
155
|
|
|
155
156
|
/**
|
|
@@ -163,7 +164,7 @@ class ServerlessCollector {
|
|
|
163
164
|
this.payload.custom_event_data = payload
|
|
164
165
|
}
|
|
165
166
|
|
|
166
|
-
cb(null, {retainData: false})
|
|
167
|
+
cb(null, { retainData: false })
|
|
167
168
|
}
|
|
168
169
|
|
|
169
170
|
/**
|
|
@@ -176,7 +177,7 @@ class ServerlessCollector {
|
|
|
176
177
|
if (this.enabled) {
|
|
177
178
|
this.payload.sql_trace_data = payload
|
|
178
179
|
}
|
|
179
|
-
cb(null, {retainData: false})
|
|
180
|
+
cb(null, { retainData: false })
|
|
180
181
|
}
|
|
181
182
|
|
|
182
183
|
/**
|
|
@@ -189,7 +190,7 @@ class ServerlessCollector {
|
|
|
189
190
|
if (this.enabled) {
|
|
190
191
|
this.payload.span_event_data = payload
|
|
191
192
|
}
|
|
192
|
-
cb(null, {retainData: false})
|
|
193
|
+
cb(null, { retainData: false })
|
|
193
194
|
}
|
|
194
195
|
|
|
195
196
|
/**
|
|
@@ -266,10 +267,7 @@ class ServerlessCollector {
|
|
|
266
267
|
// Guarantees process.stdout will block, so long logs
|
|
267
268
|
// won't be truncated if process.exit() is called early.
|
|
268
269
|
const s = process.stdout
|
|
269
|
-
payloadLength > 65000 &&
|
|
270
|
-
s._handle &&
|
|
271
|
-
s._handle.setBlocking &&
|
|
272
|
-
s._handle.setBlocking(true)
|
|
270
|
+
payloadLength > 65000 && s._handle && s._handle.setBlocking && s._handle.setBlocking(true)
|
|
273
271
|
|
|
274
272
|
fs.writeSync(process.stdout.fd, serializedPayload)
|
|
275
273
|
} else {
|
|
@@ -286,11 +284,7 @@ class ServerlessCollector {
|
|
|
286
284
|
* @param {boolean} sync Whether to write to stdout synchronously.
|
|
287
285
|
*/
|
|
288
286
|
_doFlush(payload, sync = false) {
|
|
289
|
-
const serializedPayload = JSON.stringify([
|
|
290
|
-
PAYLOAD_VERSION,
|
|
291
|
-
PAYLOAD_MARKER,
|
|
292
|
-
payload
|
|
293
|
-
]) + '\n'
|
|
287
|
+
const serializedPayload = JSON.stringify([PAYLOAD_VERSION, PAYLOAD_MARKER, payload]) + '\n'
|
|
294
288
|
|
|
295
289
|
const didUsePipe = fs.existsSync(this.pipePath) && this.flushToPipeSync(serializedPayload)
|
|
296
290
|
|
|
@@ -301,3 +295,4 @@ class ServerlessCollector {
|
|
|
301
295
|
}
|
|
302
296
|
|
|
303
297
|
module.exports = ServerlessCollector
|
|
298
|
+
/* eslint-enable camelcase */
|