Skip to content

Commit 7bcc6db

Browse files
committed
cleanup
1 parent 9a25ff8 commit 7bcc6db

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

packages/datadog-instrumentations/src/dns.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function wrap (prefix, fn, expectedArgs, rrtype) {
6868
startArgs.push(rrtype)
6969
}
7070

71-
const context = { args: startArgs }
71+
const context = { args: startArgs, hasAsyncEnd: true }
7272
startCh.publish(context)
7373

7474
arguments[arguments.length - 1] = function (error, result) {

packages/dd-trace/src/plugins/tracing.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ class TracingPlugin extends Plugin {
1212
this.operation = this.constructor.operation
1313

1414
this.addTraceSub('start', message => {
15-
if (message && typeof message === 'object') {
15+
// TODO hasAsyncEnd is temporary until all plugins are converted to have asyncEnd
16+
if (message && typeof message === 'object' && message.hasAsyncEnd) {
1617
message.parentStore = storage.getStore()
1718
}
1819
this.start(message)
@@ -28,12 +29,10 @@ class TracingPlugin extends Plugin {
2829

2930
this.addTraceSub('async_end', message => {
3031
this.asyncEnd(message)
31-
this.exit(message)
3232
})
3333

3434
this.addTraceSub('end', message => {
3535
this.end(message)
36-
this.exit(message)
3736
})
3837
}
3938

@@ -61,9 +60,12 @@ class TracingPlugin extends Plugin {
6160

6261
asyncEnd (...args) {
6362
this.finish(...args)
63+
this.exit(message)
6464
}
6565

66-
end () {} // implemented by individual plugins
66+
end () {
67+
this.exit(message)
68+
}
6769

6870
error (error) {
6971
if (error && typeof error === 'object' && error.error) {

0 commit comments

Comments
 (0)