Skip to content

Commit

Permalink
Avoid false-positives in integrations guardrails
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bengl committed Jan 29, 2025
1 parent c0550a0 commit fc7c9e6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/datadog-instrumentations/src/helpers/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,16 @@ for (const packageName of names) {
continue
}
if (typeof namesAndSuccesses[`${name}@${version}`] === 'undefined') {
namesAndSuccesses[`${name}@${version}`] = false
// TODO If `file` is present, we might elsewhere instrument the result of the module
// for a version range that actually matches, so we can't assume that we're _not_
// going to instrument that. However, the way the data model around instrumentation
// works, we can't know either way just yet, so to avoid false positives, we'll just
// ignore this if there is a `file` in the hook. The thing to do here is rework
// everything so that we can be sure that there are _no_ instrumentations that it
// could match.
if (!file) {
namesAndSuccesses[`${name}@${version}`] = false
}
}

if (matchVersion(version, versions)) {
Expand Down

0 comments on commit fc7c9e6

Please sign in to comment.