Skip to content

Commit

Permalink
don't compute service name unless necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordi Bertran de Balanda committed May 16, 2023
1 parent 3717598 commit 7a93311
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
13 changes: 5 additions & 8 deletions packages/dd-trace/src/plugins/consumer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@ class ConsumerPlugin extends InboundPlugin {
static get type () { return 'messaging' }

startSpan (options) {
const spanDefaults = {
service: this.config.service || this.serviceName(),
kind: this.constructor.kind
if (!options.service) {
options.service = this.config.service || this.serviceName()
}
if (!options.kind) {
options.kind = this.constructor.kind
}
Object.keys(spanDefaults).forEach(
key => {
if (!options[key]) options[key] = spanDefaults[key]
}
)
return super.startSpan(this.operationName(), options)
}
}
Expand Down
4 changes: 3 additions & 1 deletion packages/dd-trace/src/plugins/producer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ class ProducerPlugin extends OutboundPlugin {

startSpan (options) {
const spanDefaults = {
service: this.config.service || this.serviceName(),
kind: this.constructor.kind
}
if (!options.service) {
options.service = this.config.service || this.serviceName()
}
Object.keys(spanDefaults).forEach(
key => {
if (!options[key]) options[key] = spanDefaults[key]
Expand Down

0 comments on commit 7a93311

Please sign in to comment.