Skip to content

Commit b513be3

Browse files
committed
one half of a possible solution to avoid tracing if APM intake requests
The other half is this in elastic-apm-http-client: --- apm-nodejs-http-client/index.js 2021-06-09 15:57:41.000000000 -0700 +++ node_modules/elastic-apm-http-client/index.js 2021-08-09 15:15:37.000000000 -0700 @@ -205,9 +205,11 @@ switch (this._conf.serverUrl.protocol) { case 'http:': this._transport = http + this._uninstrumentedRequest = http.request[this._conf.originalSym] break case 'https:': this._transport = https + this._uninstrumentedRequest = https.request[this._conf.originalSym] break default: throw new Error('Unknown protocol ' + this._conf.serverUrl.protocol) @@ -794,7 +796,8 @@ } // Start the request and set its timeout. - const intakeReq = client._transport.request(client._conf.requestIntake) + console.warn('XXX making intake request', client._conf.requestIntake.path) + const intakeReq = client._uninstrumentedRequest(client._conf.requestIntake) if (Number.isFinite(client._conf.serverTimeout)) { intakeReq.setTimeout(client._conf.serverTimeout) }
1 parent e2586e6 commit b513be3

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

lib/config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ var truncate = require('unicode-byte-truncate')
1010
var logging = require('./logging')
1111
var version = require('../package').version
1212
var packageName = require('../package').name
13+
var symbols = require('./symbols')
1314

1415
const { WildcardMatcher } = require('./wildcard-matcher')
1516
const { CloudMetadata } = require('./cloud-metadata')
@@ -303,6 +304,7 @@ class Config {
303304
serverCaCert: loadServerCaCertFile(conf),
304305
rejectUnauthorized: conf.verifyServerCert,
305306
serverTimeout: conf.serverTimeout * 1000,
307+
originalSym: symbols.original,
306308

307309
// APM Agent Configuration via Kibana:
308310
centralConfig: conf.centralConfig,

lib/instrumentation/shimmer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ function wrap (nodule, name, wrapper) {
6666
var wrapped = wrapper(original, name)
6767

6868
wrapped[isWrappedSym] = true
69+
wrapped[symbols.original] = original // XXX circular ref leak!?
6970
wrapped[symbols.unwrap] = function elasticAPMUnwrap () {
7071
if (nodule[name] === wrapped) {
7172
nodule[name] = original

0 commit comments

Comments
 (0)