Skip to content

Commit d1e2d5e

Browse files
cjr125cjr125
authored andcommitted
fix: removed this keyword from callbacks
1 parent 949e9d0 commit d1e2d5e

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

packages/rum-core/src/performance-monitoring/transaction-service.js

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -101,39 +101,31 @@ class TransactionService {
101101

102102
createOptions(options) {
103103
const config = this._config.config
104+
const logger = this._logger
104105
let presetOptions = {
105106
transactionSampleRate: config.transactionSampleRate
106107
}
107108
if (typeof config.transactionContextCallback === 'function') {
108-
const tCC = function () {
109+
presetOptions.transactionContextCallback = function () {
109110
let tags = {}
110111
try {
111112
tags = config.transactionContextCallback()
112113
} catch (err) {
113-
this._logger.error(
114-
'Failed to execute transaction context callback',
115-
err
116-
)
114+
logger.error('Failed to execute transaction context callback', err)
117115
}
118116
return tags
119117
}
120-
presetOptions.transactionContextCallback = tCC.bind({
121-
_logger: this._logger
122-
})
123118
}
124119
if (typeof config.spanContextCallback === 'function') {
125-
const sCC = function () {
120+
presetOptions.spanContextCallback = function () {
126121
let tags = {}
127122
try {
128123
tags = config.spanContextCallback()
129124
} catch (err) {
130-
this._logger.error('Failed to execute span context callback', err)
125+
logger.error('Failed to execute span context callback', err)
131126
}
132127
return tags
133128
}
134-
presetOptions.spanContextCallback = sCC.bind({
135-
_logger: this._logger
136-
})
137129
}
138130
let perfOptions = extend(presetOptions, options)
139131
if (perfOptions.managed) {

0 commit comments

Comments
 (0)