Skip to content

Commit

Permalink
fix: child_process: default to tracer service name (#4417)
Browse files Browse the repository at this point in the history
  • Loading branch information
tlhunter authored and juan-fernandez committed Jul 10, 2024
1 parent b142f4d commit 49ba6f8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/datadog-plugin-child_process/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class ChildProcessPlugin extends TracingPlugin {
}

this.startSpan('command_execution', {
service: this.config.service,
service: this.config.service || this._tracerConfig.service,
resource: (shell === true) ? 'sh' : cmdFields[0],
type: 'system',
meta
Expand Down
16 changes: 10 additions & 6 deletions packages/datadog-plugin-child_process/test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ describe('Child process plugin', () => {
tracerStub = {
startSpan: sinon.stub()
}

configStub = {
service: 'test-service'
}
})

afterEach(() => {
Expand All @@ -52,7 +56,7 @@ describe('Child process plugin', () => {
childOf: undefined,
tags: {
component: 'subprocess',
'service.name': undefined,
'service.name': 'test-service',
'resource.name': 'ls',
'span.kind': undefined,
'span.type': 'system',
Expand All @@ -74,7 +78,7 @@ describe('Child process plugin', () => {
childOf: undefined,
tags: {
component: 'subprocess',
'service.name': undefined,
'service.name': 'test-service',
'resource.name': 'sh',
'span.kind': undefined,
'span.type': 'system',
Expand All @@ -98,7 +102,7 @@ describe('Child process plugin', () => {
childOf: undefined,
tags: {
component: 'subprocess',
'service.name': undefined,
'service.name': 'test-service',
'resource.name': 'echo',
'span.kind': undefined,
'span.type': 'system',
Expand All @@ -123,7 +127,7 @@ describe('Child process plugin', () => {
childOf: undefined,
tags: {
component: 'subprocess',
'service.name': undefined,
'service.name': 'test-service',
'resource.name': 'sh',
'span.kind': undefined,
'span.type': 'system',
Expand All @@ -149,7 +153,7 @@ describe('Child process plugin', () => {
childOf: undefined,
tags: {
component: 'subprocess',
'service.name': undefined,
'service.name': 'test-service',
'resource.name': 'ls',
'span.kind': undefined,
'span.type': 'system',
Expand All @@ -175,7 +179,7 @@ describe('Child process plugin', () => {
childOf: undefined,
tags: {
component: 'subprocess',
'service.name': undefined,
'service.name': 'test-service',
'resource.name': 'sh',
'span.kind': undefined,
'span.type': 'system',
Expand Down

0 comments on commit 49ba6f8

Please sign in to comment.