Skip to content

Commit ecce729

Browse files
authored
feat(tracing): add bullmq integration and dsm support (#7123)
New support for APM tracing and DSM for bullmq. Supports context propagation and peer service tagging as well.
1 parent d0cc613 commit ecce729

27 files changed

Lines changed: 1120 additions & 6 deletions

File tree

.github/workflows/apm-integrations.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,22 @@ jobs:
152152
with:
153153
dd_api_key: ${{ secrets.DD_API_KEY }}
154154

155+
bullmq:
156+
runs-on: ubuntu-latest
157+
services:
158+
redis:
159+
image: redis:7.0-alpine
160+
ports:
161+
- 6379:6379
162+
env:
163+
PLUGINS: bullmq
164+
SERVICES: redis
165+
steps:
166+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
167+
- uses: ./.github/actions/plugins/test
168+
with:
169+
dd_api_key: ${{ secrets.DD_API_KEY }}
170+
155171
bunyan:
156172
runs-on: ubuntu-latest
157173
env:

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ services:
6868
ports:
6969
- "127.0.0.1:3306:3306"
7070
redis:
71-
image: redis:4.0-alpine
71+
image: redis:7.0-alpine
7272
ports:
7373
- "127.0.0.1:6379:6379"
7474
mongo:

docs/API.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ tracer.use('pg', {
2929
<h5 id="aws-sdk-tags"></h5>
3030
<h5 id="aws-sdk-config"></h5>
3131
<h5 id="azure-functions"></h5>
32+
<h5 id="bullmq"></h5>
3233
<h5 id="bunyan"></h5>
3334
<h5 id="confluentinc-kafka-javascript"></h5>
3435
<h5 id="couchbase"></h5>
@@ -111,6 +112,7 @@ tracer.use('pg', {
111112
* [aws-sdk](./interfaces/export_.plugins.aws_sdk.html)
112113
* [azure-functions](./interfaces/export_.plugins.azure_functions.html)
113114
* [bluebird](./interfaces/export_.plugins.bluebird.html)
115+
* [bullmq](./interfaces/export_.plugins.bullmq.html)
114116
* [couchbase](./interfaces/export_.plugins.couchbase.html)
115117
* [cucumber](./interfaces/export_.plugins.cucumber.html)
116118
* [bunyan](./interfaces/export_.plugins.bunyan.html)

docs/add-redirects.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ declare -a plugins=(
2323
"axios"
2424
"azure_functions"
2525
"azure_service_bus"
26+
"bullmq"
2627
"bunyan"
2728
"cassandra_driver"
2829
"child_process"

docs/test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ tracer.use('aws-sdk');
310310
tracer.use('aws-sdk', awsSdkOptions);
311311
tracer.use('azure-event-hubs')
312312
tracer.use('azure-functions');
313+
tracer.use('bullmq');
313314
tracer.use('bunyan');
314315
tracer.use('couchbase');
315316
tracer.use('cassandra-driver');

index.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ interface Plugins {
191191
"azure-event-hubs": tracer.plugins.azure_event_hubs;
192192
"azure-functions": tracer.plugins.azure_functions;
193193
"azure-service-bus": tracer.plugins.azure_service_bus;
194+
"bullmq": tracer.plugins.bullmq;
194195
"bunyan": tracer.plugins.bunyan;
195196
"cassandra-driver": tracer.plugins.cassandra_driver;
196197
"child_process": tracer.plugins.child_process;
@@ -1757,6 +1758,12 @@ declare namespace tracer {
17571758
* [logInjection](interfaces/traceroptions.html#logInjection) option is enabled
17581759
* on the tracer.
17591760
*/
1761+
/**
1762+
* This plugin automatically instruments the
1763+
* [bullmq](https://github.com/npmjs/package/bullmq) message queue library.
1764+
*/
1765+
interface bullmq extends Instrumentation {}
1766+
17601767
interface bunyan extends Integration {}
17611768

17621769
/**
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// AUTO-GENERATED by dd-compile
2+
// Orchestrion rewriter handles the actual instrumentation via JSON config.
3+
// This file registers the module hooks for the rewriter to process.
4+
5+
'use strict'
6+
7+
const { addHook, getHooks } = require('./helpers/instrument')
8+
9+
for (const hook of getHooks('bullmq')) {
10+
addHook(hook, exports => exports)
11+
}

packages/datadog-instrumentations/src/helpers/hooks.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ module.exports = {
4242
'aws-sdk': () => require('../aws-sdk'),
4343
bluebird: () => require('../bluebird'),
4444
'body-parser': () => require('../body-parser'),
45+
bullmq: () => require('../bullmq'),
4546
bunyan: () => require('../bunyan'),
4647
'cassandra-driver': () => require('../cassandra-driver'),
4748
child_process: () => require('../child_process'),
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
[
2+
{
3+
"module": {
4+
"name": "bullmq",
5+
"versionRange": ">=5.66.0",
6+
"filePath": "dist/cjs/classes/queue.js"
7+
},
8+
"functionQuery": {
9+
"methodName": "add",
10+
"className": "Queue",
11+
"kind": "Async"
12+
},
13+
"channelName": "Queue_add"
14+
},
15+
{
16+
"module": {
17+
"name": "bullmq",
18+
"versionRange": ">=5.66.0",
19+
"filePath": "dist/cjs/classes/queue.js"
20+
},
21+
"functionQuery": {
22+
"methodName": "addBulk",
23+
"className": "Queue",
24+
"kind": "Async"
25+
},
26+
"channelName": "Queue_addBulk"
27+
},
28+
{
29+
"module": {
30+
"name": "bullmq",
31+
"versionRange": ">=5.66.0",
32+
"filePath": "dist/cjs/classes/worker.js"
33+
},
34+
"functionQuery": {
35+
"methodName": "callProcessJob",
36+
"className": "Worker",
37+
"kind": "Async"
38+
},
39+
"channelName": "Worker_callProcessJob"
40+
},
41+
{
42+
"module": {
43+
"name": "bullmq",
44+
"versionRange": ">=5.66.0",
45+
"filePath": "dist/cjs/classes/flow-producer.js"
46+
},
47+
"functionQuery": {
48+
"methodName": "add",
49+
"className": "FlowProducer",
50+
"kind": "Async"
51+
},
52+
"channelName": "FlowProducer_add"
53+
},
54+
{
55+
"module": {
56+
"name": "bullmq",
57+
"versionRange": ">=5.66.0",
58+
"filePath": "dist/esm/classes/queue.js"
59+
},
60+
"functionQuery": {
61+
"methodName": "add",
62+
"className": "Queue",
63+
"kind": "Async"
64+
},
65+
"channelName": "Queue_add"
66+
},
67+
{
68+
"module": {
69+
"name": "bullmq",
70+
"versionRange": ">=5.66.0",
71+
"filePath": "dist/esm/classes/queue.js"
72+
},
73+
"functionQuery": {
74+
"methodName": "addBulk",
75+
"className": "Queue",
76+
"kind": "Async"
77+
},
78+
"channelName": "Queue_addBulk"
79+
},
80+
{
81+
"module": {
82+
"name": "bullmq",
83+
"versionRange": ">=5.66.0",
84+
"filePath": "dist/esm/classes/worker.js"
85+
},
86+
"functionQuery": {
87+
"methodName": "callProcessJob",
88+
"className": "Worker",
89+
"kind": "Async"
90+
},
91+
"channelName": "Worker_callProcessJob"
92+
},
93+
{
94+
"module": {
95+
"name": "bullmq",
96+
"versionRange": ">=5.66.0",
97+
"filePath": "dist/esm/classes/flow-producer.js"
98+
},
99+
"functionQuery": {
100+
"methodName": "add",
101+
"className": "FlowProducer",
102+
"kind": "Async"
103+
},
104+
"channelName": "FlowProducer_add"
105+
}
106+
]
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict'
22

33
module.exports = [
4-
...require('./langchain')
4+
...require('./langchain'),
5+
...require('./bullmq')
56
]

0 commit comments

Comments
 (0)