Skip to content

Commit 676b420

Browse files
committed
fix(https): instrument https server as well
1 parent c623709 commit 676b420

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

lib/instrumentations/core/https.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
var Shimmer = require('../../utils/shimmer')
2+
var mustCollectStore = {}
3+
4+
module.exports = function (https, agent) {
5+
Shimmer.wrap(https.Server.prototype, 'https.Server.prototype', ['on', 'addListener'],
6+
function (addListener) {
7+
return function (type, listener) {
8+
if (type === 'request' && typeof listener === 'function') {
9+
return addListener.call(this, type,
10+
require('./http/server.js')(listener, agent, mustCollectStore))
11+
} else {
12+
return addListener.apply(this, arguments)
13+
}
14+
}
15+
})
16+
17+
agent.bindEmitter(https.Server.prototype)
18+
19+
return https
20+
}

lib/instrumentations/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ var INSTRUMENTED_LIBS = [
2424
]
2525

2626
var CORE_LIBS = [
27-
'http'
27+
'http',
28+
'https'
2829
]
2930

3031
function instrument (shortName, fileName, nodule, agent) {

lib/instrumentations/index.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe('The instrumentor module', function () {
88

99
instrumentor.create({
1010
config: {
11-
disableInstrumentations: ['mongodb', 'http']
11+
disableInstrumentations: ['mongodb', 'http', 'https']
1212
}
1313
})
1414

0 commit comments

Comments
 (0)