Skip to content

Commit fc7c9e6

Browse files
committed
Avoid false-positives in integrations guardrails
Previously, express v4 was always being reported as unsupported. This is because the integration for v5 targets a specific file that we don't instrument otherwise. For now, this change lets us prevent false positives by allowing for some false negatives.
1 parent c0550a0 commit fc7c9e6

File tree

1 file changed

+10
-1
lines changed
  • packages/datadog-instrumentations/src/helpers

1 file changed

+10
-1
lines changed

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

+10-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,16 @@ for (const packageName of names) {
107107
continue
108108
}
109109
if (typeof namesAndSuccesses[`${name}@${version}`] === 'undefined') {
110-
namesAndSuccesses[`${name}@${version}`] = false
110+
// TODO If `file` is present, we might elsewhere instrument the result of the module
111+
// for a version range that actually matches, so we can't assume that we're _not_
112+
// going to instrument that. However, the way the data model around instrumentation
113+
// works, we can't know either way just yet, so to avoid false positives, we'll just
114+
// ignore this if there is a `file` in the hook. The thing to do here is rework
115+
// everything so that we can be sure that there are _no_ instrumentations that it
116+
// could match.
117+
if (!file) {
118+
namesAndSuccesses[`${name}@${version}`] = false
119+
}
111120
}
112121

113122
if (matchVersion(version, versions)) {

0 commit comments

Comments
 (0)