Skip to content

Commit

Permalink
update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
khanayan123 committed Oct 7, 2024
1 parent 04586cc commit 040d6bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
7 changes: 3 additions & 4 deletions packages/dd-trace/src/opentracing/tracer.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,13 @@ class DatadogTracer {
? getContext(options.childOf)
: getParent(options.references)

// as per spec, allow the setting of service name through tags
// as per spec, allow the setting of service name through options
const tags = {
'service.name': options?.tags?.service ? String(options.tags.service) : this._service
}

// edge case handling, if a user manually sets a service name different from the tracer's service name
// then we need to ensure that the version is set to undefined
// in every other scenario version should be set to the tracer's version
// As per unified service tagging spec if a span is created with a service name different from the global
// service name it will not inherit the global version value
if (options?.tags?.service && options?.tags?.service !== this._service) {
options.tags.version = undefined
}
Expand Down
3 changes: 2 additions & 1 deletion packages/dd-trace/test/opentracing/tracer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,8 @@ describe('Tracer', () => {
expect(span.addTags).to.have.been.calledWith(fields.tags)
})

it('If a user sets spans service name differs from the tracers, ensure the spans version is undefined.', () => {
it('If span is granted a service name that differs from the global service name' +
'ensure spans `version` tag is undefined.', () => {
config.tags = {
foo: 'tracer',
bar: 'tracer'
Expand Down

0 comments on commit 040d6bc

Please sign in to comment.