Skip to content

Commit ce14ccd

Browse files
amarzialiwconti27
andauthored
Add _dd.integration to spans to have a safe component tag (#5652)
* Add _dd.integration to spans to calculate internal stats * Align integration name used in the telemetry to meta[component] where possible * fix child process tests * fix typos * misc fixes to startSpan * Add mysql tests * fix next integration * assert integration name tag during integration tests * fix condition * fix aws-sdk instrumentation and test checks * lint * Fix http2 integration name * add integrationName to ciViz integrations * add suggestions * fix other tests --------- Co-authored-by: William Conti <william.conti@datadoghq.com>
1 parent 2348ed7 commit ce14ccd

File tree

55 files changed

+140
-25
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+140
-25
lines changed

packages/datadog-plugin-amqp10/test/index.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ describe('Plugin', () => {
9090
expect(span.meta).to.have.property('amqp.link.role', 'sender')
9191
expect(span.meta['amqp.link.name']).to.match(/^amq\.topic_[0-9a-f-]+$/)
9292
expect(span.meta).to.have.property('component', 'amqp10')
93+
expect(span.meta).to.have.property('_dd.integration', 'amqp10')
9394
expect(span.metrics).to.have.property('network.destination.port', 5673)
9495
expect(span.metrics).to.have.property('amqp.connection.port', 5673)
9596
expect(span.metrics).to.have.property('amqp.link.handle', 1)

packages/datadog-plugin-amqplib/test/index.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ describe('Plugin', () => {
7777
expect(span.meta).to.have.property('span.kind', 'client')
7878
expect(span.meta).to.have.property('out.host', 'localhost')
7979
expect(span.meta).to.have.property('component', 'amqplib')
80+
expect(span.meta).to.have.property('_dd.integration', 'amqplib')
8081
expect(span.metrics).to.have.property('network.destination.port', 5672)
8182
}, 2)
8283
.then(done)

packages/datadog-plugin-apollo/test/index.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ describe('Plugin', () => {
151151
expect(traces[0][0].meta).to.not.have.property('graphql.source')
152152
expect(traces[0][0].meta).to.have.property('graphql.operation.type', 'query')
153153
expect(traces[0][0].meta).to.have.property('component', 'apollo.gateway')
154+
expect(traces[0][0].meta).to.have.property('_dd.integration', 'apollo.gateway')
154155

155156
expect(traces[0][1]).to.have.property('name', 'apollo.gateway.validate')
156157
expect(traces[0][1]).to.have.property('service', expectedSchema.server.serviceName)

packages/datadog-plugin-aws-sdk/src/base.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@ class BaseAwsSdkPlugin extends ClientPlugin {
5656
}
5757
if (this.requestTags) this.requestTags.set(request, tags)
5858

59-
const span = this.tracer.startSpan(this.operationFromRequest(request), { childOf, tags })
59+
const span = this.tracer.startSpan(this.operationFromRequest(request),
60+
{
61+
childOf,
62+
tags,
63+
integrationName: 'aws-sdk'
64+
})
6065

6166
analyticsSampler.sample(span, this.config.measured)
6267

packages/datadog-plugin-aws-sdk/src/services/kinesis.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ class Kinesis extends BaseAwsSdkPlugin {
3838
tags: {
3939
...this.requestTags.get(request),
4040
'span.kind': 'server'
41-
}
41+
},
42+
integrationName: 'aws-sdk'
4243
}
4344
span = plugin.tracer.startSpan('aws.response', options)
4445
this.enter(span, store)

packages/datadog-plugin-aws-sdk/src/services/sqs.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ class Sqs extends BaseAwsSdkPlugin {
3030
tags: {
3131
...this.requestTags.get(request),
3232
'span.kind': 'server'
33-
}
33+
},
34+
integrationName: 'aws-sdk'
3435
}
3536
parsedMessageAttributes = contextExtraction.parsedAttributes
3637
span = this.tracer.startSpan('aws.response', options)

packages/datadog-plugin-child_process/test/index.spec.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ describe('Child process plugin', () => {
6161
'span.type': 'system',
6262
'cmd.exec': JSON.stringify(['ls', '-l'])
6363
},
64-
integrationName: 'system',
64+
integrationName: 'child_process',
6565
links: undefined
6666
}
6767
)
@@ -84,7 +84,7 @@ describe('Child process plugin', () => {
8484
'span.type': 'system',
8585
'cmd.shell': 'ls -l'
8686
},
87-
integrationName: 'system',
87+
integrationName: 'child_process',
8888
links: undefined
8989
}
9090
)
@@ -110,7 +110,7 @@ describe('Child process plugin', () => {
110110
'cmd.exec': JSON.stringify(['echo', arg, '']),
111111
'cmd.truncated': 'true'
112112
},
113-
integrationName: 'system',
113+
integrationName: 'child_process',
114114
links: undefined
115115
}
116116
)
@@ -136,7 +136,7 @@ describe('Child process plugin', () => {
136136
'cmd.shell': 'ls -l /h ',
137137
'cmd.truncated': 'true'
138138
},
139-
integrationName: 'system',
139+
integrationName: 'child_process',
140140
links: undefined
141141
}
142142
)
@@ -163,7 +163,7 @@ describe('Child process plugin', () => {
163163
'cmd.exec': JSON.stringify(['ls', '-l', '', '']),
164164
'cmd.truncated': 'true'
165165
},
166-
integrationName: 'system',
166+
integrationName: 'child_process',
167167
links: undefined
168168
}
169169
)
@@ -190,7 +190,7 @@ describe('Child process plugin', () => {
190190
'cmd.shell': 'ls -l /home -t',
191191
'cmd.truncated': 'true'
192192
},
193-
integrationName: 'system',
193+
integrationName: 'child_process',
194194
links: undefined
195195
}
196196
)

packages/datadog-plugin-connect/test/index.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ describe('Plugin', () => {
5959
expect(spans[0].meta).to.have.property('http.method', 'GET')
6060
expect(spans[0].meta).to.have.property('http.status_code', '200')
6161
expect(spans[0].meta).to.have.property('component', 'connect')
62+
expect(spans[0].meta).to.have.property('_dd.integration', 'connect')
6263
})
6364
.then(done)
6465
.catch(done)

packages/datadog-plugin-couchbase/test/index.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ describe('Plugin', () => {
8585
expect(span.meta).to.have.property('span.kind', 'client')
8686
expect(span.meta).to.have.property('couchbase.bucket.name', 'datadog-test')
8787
expect(span.meta).to.have.property('component', 'couchbase')
88+
expect(span.meta).to.have.property('_dd.integration', 'couchbase')
8889
})
8990
.then(done)
9091
.catch(done)

packages/datadog-plugin-cucumber/src/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ class CucumberPlugin extends CiPlugin {
184184
[COMPONENT]: this.constructor.id,
185185
...this.testEnvironmentMetadata,
186186
...testSuiteMetadata
187-
}
187+
},
188+
integrationName: this.constructor.id
188189
})
189190
this.testSuiteSpanByPath[testSuitePath] = testSuiteSpan
190191

@@ -295,7 +296,8 @@ class CucumberPlugin extends CiPlugin {
295296
[COMPONENT]: this.constructor.id,
296297
'cucumber.step': resource,
297298
[RESOURCE_NAME]: resource
298-
}
299+
},
300+
integrationName: this.constructor.id
299301
})
300302
ctx.parentStore = store
301303
ctx.currentStore = { ...store, span }

0 commit comments

Comments
 (0)