Skip to content

Commit

Permalink
cleanup instrum
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-id committed Jan 17, 2025
1 parent a022df5 commit e487811
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions packages/datadog-instrumentations/src/express-session.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
'use strict'

const { addHook } = require('./helpers/instrument')
const shimmer = require('../../datadog-shimmer')
const { channel } = require('./helpers/instrument')
const { channel, addHook } = require('./helpers/instrument')

const sessionMiddlewareFinishCh = channel('datadog:express-session:middleware:finish')

Expand All @@ -17,7 +16,7 @@ function wrapSessionMiddleware (sessionMiddleware) {

if (abortController.signal.aborted) return
}

return next.apply(this, arguments)
}
})
Expand All @@ -36,17 +35,7 @@ function wrapSession (session) {

addHook({
name: 'express-session',
versions: ['>=0.3.0'] // TODO
versions: ['>=1.0.1']
}, session => {
return shimmer.wrapFunction(session, wrapSession)
})


return shimmer.wrapFunction(session, function wrapSession {
const queryMiddleware = query.apply(this, arguments)

return shimmer.wrapFunction(queryMiddleware, queryMiddleware => function (req, res, next) {
arguments[2] = publishQueryParsedAndNext(req, res, next)
return queryMiddleware.apply(this, arguments)
})
})

0 comments on commit e487811

Please sign in to comment.