Skip to content

Commit 7ac4718

Browse files
committed
feat: disable tracing
1 parent e06360d commit 7ac4718

2 files changed

Lines changed: 13 additions & 25 deletions

File tree

src/common/tracer.ts

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,22 @@ if (process.env.DATADOG_AGENT_URL) {
88
// TODO: Disable Redis tracing since that generates
99
// a lot of traces which for now are not relevant
1010
tracer.init({
11-
profiling: true,
11+
profiling: false,
1212
logInjection: true,
13-
runtimeMetrics: true,
13+
runtimeMetrics: false,
1414
clientIpEnabled: true,
1515
service,
1616
url: process.env.DATADOG_AGENT_URL,
1717
env: config.environment,
1818
});
1919

20-
tracer.use("hapi", {
21-
headers: ["x-api-key", "referer"],
22-
});
23-
24-
tracer.use("ioredis", {
25-
enabled: false,
26-
});
27-
28-
tracer.use("amqplib", {
29-
enabled: false,
30-
});
31-
32-
tracer.use("pg", {
33-
enabled: false,
34-
});
35-
36-
tracer.use("elasticsearch", {
37-
enabled: true,
38-
});
39-
40-
tracer.use("fetch", {
41-
enabled: false,
42-
});
20+
for (const disabledDatadogPluginTracing of config.disabledDatadogPluginsTracing) {
21+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
22+
// @ts-ignore
23+
tracer.use(disabledDatadogPluginTracing, {
24+
enabled: false,
25+
});
26+
}
4327
}
4428

4529
export default tracer;

src/config/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,8 @@ export const config = {
4242

4343
databaseUrl: String(process.env.DATABASE_URL),
4444
redisUrl: String(process.env.REDIS_URL),
45+
46+
disabledDatadogPluginsTracing: process.env.DISABLED_DATADOG_PLUGINS_TRACING
47+
? String(process.env.DISABLED_DATADOG_PLUGINS_TRACING).split(",")
48+
: "ioredis,amqplib,pg,fetch,kafkajs,elasticsearch,http,dns,net".split(","),
4549
};

0 commit comments

Comments
 (0)