Skip to content

fix(ts): added filter into ts definition file#7368

Merged
BridgeAR merged 8 commits intomasterfrom
pabloerhard/fix-http-ts
Feb 5, 2026
Merged

fix(ts): added filter into ts definition file#7368
BridgeAR merged 8 commits intomasterfrom
pabloerhard/fix-http-ts

Conversation

@pabloerhard
Copy link
Copy Markdown
Contributor

Please make sure your changes are properly tested!

What does this PR do?

Added filter definition into index.d.ts, previously it was only defined for the web interface but it is used in multiple places, with out this TypeScript users get an error when trying to add the filter option.

Motivation

Additional Notes

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 28, 2026

Overall package size

Self size: 4.58 MB
Deduped: 5.42 MB
No deduping: 5.42 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 2.0.6 | 81.92 kB | 813.08 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@pabloerhard pabloerhard force-pushed the pabloerhard/fix-http-ts branch from 5dd600b to dd35ac7 Compare January 28, 2026 17:55
@pabloerhard pabloerhard changed the title added filter into ts definition file fix(ts): added filter into ts definition file Jan 28, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.41%. Comparing base (313fe22) to head (ed02931).
⚠️ Report is 11 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7368      +/-   ##
==========================================
- Coverage   80.41%   80.41%   -0.01%     
==========================================
  Files         732      732              
  Lines       31050    31072      +22     
==========================================
+ Hits        24970    24985      +15     
- Misses       6080     6087       +7     
Flag Coverage Δ
aiguard-macos 39.08% <ø> (-0.10%) ⬇️
aiguard-ubuntu 39.12% <ø> (-0.10%) ⬇️
aiguard-windows 38.97% <ø> (-0.10%) ⬇️
apm-capabilities-tracing-macos 48.86% <ø> (-0.03%) ⬇️
apm-capabilities-tracing-ubuntu 48.91% <ø> (+0.02%) ⬆️
apm-capabilities-tracing-windows 48.64% <ø> (+0.02%) ⬆️
apm-integrations-child-process 38.57% <ø> (-0.09%) ⬇️
apm-integrations-couchbase-18 37.33% <ø> (-0.09%) ⬇️
apm-integrations-couchbase-eol 37.96% <ø> (+0.06%) ⬆️
apm-integrations-oracledb 38.00% <ø> (-0.09%) ⬇️
appsec-express 55.36% <ø> (-0.08%) ⬇️
appsec-fastify 51.99% <ø> (-0.07%) ⬇️
appsec-graphql 52.32% <ø> (-0.07%) ⬇️
appsec-kafka 44.64% <ø> (-0.08%) ⬇️
appsec-ldapjs 44.31% <ø> (-0.08%) ⬇️
appsec-lodash 43.99% <ø> (-0.08%) ⬇️
appsec-macos 58.48% <ø> (-0.07%) ⬇️
appsec-mongodb-core 49.19% <ø> (-0.08%) ⬇️
appsec-mongoose 49.88% <ø> (-0.08%) ⬇️
appsec-mysql 51.26% <ø> (-0.07%) ⬇️
appsec-node-serialize 43.50% <ø> (-0.08%) ⬇️
appsec-passport 48.10% <ø> (-0.09%) ⬇️
appsec-postgres 51.05% <ø> (-0.07%) ⬇️
appsec-sourcing 42.84% <ø> (-0.08%) ⬇️
appsec-template 43.67% <ø> (-0.08%) ⬇️
appsec-ubuntu 58.50% <ø> (-0.07%) ⬇️
appsec-windows 58.36% <ø> (-0.07%) ⬇️
instrumentations-instrumentation-bluebird 32.25% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-body-parser 40.73% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-child_process 37.88% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-cookie-parser 34.51% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-express 34.85% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-express-mongo-sanitize 34.65% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-express-session 40.41% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-fs 31.85% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-generic-pool 29.81% <ø> (+0.01%) ⬆️
instrumentations-instrumentation-http 39.62% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-knex 32.25% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-mongoose 33.62% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-multer 40.47% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-mysql2 38.27% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-passport 40.77% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-passport-http 40.74% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-passport-local 40.74% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-pg 37.79% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-promise 32.18% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-promise-js 32.18% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-q 32.23% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-url 32.15% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-when 32.20% <ø> (-0.09%) ⬇️
llmobs-ai 41.41% <ø> (-0.23%) ⬇️
llmobs-anthropic 40.63% <ø> (-0.09%) ⬇️
llmobs-bedrock 39.51% <ø> (-0.08%) ⬇️
llmobs-google-genai 40.12% <ø> (-0.08%) ⬇️
llmobs-langchain 39.66% <ø> (-0.07%) ⬇️
llmobs-openai 44.48% <ø> (-0.06%) ⬇️
llmobs-vertex-ai 40.34% <ø> (-0.09%) ⬇️
platform-core 28.09% <ø> (ø)
platform-esbuild 31.49% <ø> (ø)
platform-instrumentations-misc 39.62% <ø> (ø)
platform-shimmer 34.83% <ø> (ø)
platform-unit-guardrails 30.37% <ø> (ø)
plugins-azure-event-hubs 22.64% <ø> (ø)
plugins-azure-service-bus 22.08% <ø> (ø)
plugins-bullmq 43.71% <ø> (+0.05%) ⬆️
plugins-cassandra 38.04% <ø> (-0.09%) ⬇️
plugins-cookie 23.69% <ø> (ø)
plugins-cookie-parser 23.50% <ø> (ø)
plugins-crypto 22.88% <ø> (ø)
plugins-dd-trace-api 38.42% <ø> (-0.07%) ⬇️
plugins-express-mongo-sanitize 23.67% <ø> (ø)
plugins-express-session 23.46% <ø> (ø)
plugins-fastify 42.53% <ø> (-0.09%) ⬇️
plugins-fetch 38.60% <ø> (-0.09%) ⬇️
plugins-fs 38.67% <ø> (-0.10%) ⬇️
plugins-generic-pool 22.68% <ø> (ø)
plugins-google-cloud-pubsub 45.71% <ø> (-0.11%) ⬇️
plugins-grpc 41.29% <ø> (-0.09%) ⬇️
plugins-handlebars 23.71% <ø> (ø)
plugins-hapi 40.43% <ø> (-0.09%) ⬇️
plugins-hono 40.63% <ø> (-0.23%) ⬇️
plugins-ioredis 38.47% <ø> (-0.09%) ⬇️
plugins-knex 23.51% <ø> (ø)
plugins-ldapjs 21.28% <ø> (ø)
plugins-light-my-request 23.15% <ø> (ø)
plugins-limitd-client 32.55% <ø> (-0.09%) ⬇️
plugins-lodash 22.74% <ø> (ø)
plugins-mariadb 39.61% <ø> (-0.09%) ⬇️
plugins-memcached 38.20% <ø> (-0.10%) ⬇️
plugins-microgateway-core 39.44% <ø> (-0.09%) ⬇️
plugins-moleculer 40.84% <ø> (-0.09%) ⬇️
plugins-mongodb 39.55% <ø> (-0.09%) ⬇️
plugins-mongodb-core 39.13% <ø> (-0.09%) ⬇️
plugins-mongoose 39.21% <ø> (-0.06%) ⬇️
plugins-multer 23.46% <ø> (ø)
plugins-mysql 39.23% <ø> (-0.13%) ⬇️
plugins-mysql2 39.31% <ø> (-0.09%) ⬇️
plugins-node-serialize 23.73% <ø> (ø)
plugins-opensearch 37.88% <ø> (-0.09%) ⬇️
plugins-passport-http 23.56% <ø> (ø)
plugins-postgres 35.71% <ø> (-0.08%) ⬇️
plugins-process 22.88% <ø> (ø)
plugins-pug 23.69% <ø> (ø)
plugins-redis 38.95% <ø> (+0.07%) ⬆️
plugins-router 43.24% <ø> (-0.09%) ⬇️
plugins-sequelize 22.27% <ø> (ø)
plugins-test-and-upstream-amqp10 38.39% <ø> (-0.09%) ⬇️
plugins-test-and-upstream-amqplib 43.90% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-apollo 39.32% <ø> (-0.08%) ⬇️
plugins-test-and-upstream-avsc 38.81% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-bunyan 33.86% <ø> (-0.09%) ⬇️
plugins-test-and-upstream-connect 41.05% <ø> (-0.09%) ⬇️
plugins-test-and-upstream-graphql 40.23% <ø> (-0.09%) ⬇️
plugins-test-and-upstream-koa 40.63% <ø> (-0.30%) ⬇️
plugins-test-and-upstream-protobufjs 39.05% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-rhea 44.15% <ø> (-0.13%) ⬇️
plugins-undici 39.40% <ø> (-0.09%) ⬇️
plugins-url 22.88% <ø> (ø)
plugins-valkey 38.13% <ø> (-0.09%) ⬇️
plugins-vm 22.88% <ø> (ø)
plugins-winston 34.27% <ø> (-0.09%) ⬇️
plugins-ws 42.21% <ø> (+1.36%) ⬆️
profiling-macos 40.06% <ø> (-0.09%) ⬇️
profiling-ubuntu 40.11% <ø> (-0.09%) ⬇️
profiling-windows 41.47% <ø> (-0.09%) ⬇️
serverless-azure-functions-client 22.38% <ø> (ø)
serverless-azure-functions-eventhubs 22.38% <ø> (ø)
serverless-azure-functions-servicebus 22.38% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pr-commenter
Copy link
Copy Markdown

pr-commenter bot commented Jan 28, 2026

Benchmarks

Benchmark execution time: 2026-02-05 17:12:59

Comparing candidate commit d329dae in PR branch pabloerhard/fix-http-ts with baseline commit 313fe22 in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 234 metrics, 26 unstable metrics.

@pabloerhard pabloerhard marked this pull request as ready for review January 28, 2026 18:11
@pabloerhard pabloerhard requested a review from a team as a code owner January 28, 2026 18:11
Copy link
Copy Markdown
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense! Could you also do the same for queryStringObfuscation and resourceRenamingEnabled where it applies and remove the web interface? We have to adjust the test in that case to ignore web.

Copy link
Copy Markdown
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we have a brief call for the final review? I believe a call makes it easier for me to know which options apply where without having to dig deep

*/
resourceRenamingEnabled?: boolean;
}
interface web extends HttpServer {}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we mention this plugin at all? It is more of an internal implementation detail. I did add it because I did want to show the options and it can be used, while it does not seem to be very helpful in this form.

Comment on lines +1575 to +1583
/**
* Custom filter function used to decide whether a URL/path is allowed.
* When provided, this takes precedence over allowlist/blocklist configuration.
* If not provided, allowlist/blocklist logic will be used instead.
*
* @param urlOrPath - The URL or path to filter
* @returns true to instrument the request, false to skip it
*/
filter?: (urlOrPath: string) => boolean;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this belongs to HttpClient

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

web extends HttpServer and web also uses filter

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unless we move forward with removing web completely then it does make sense to just leave it in HttpClient

Comment on lines +1638 to +1646
/**
* Whether (or how) to obfuscate querystring values in `http.url`.
*
* - `true`: obfuscate all values
* - `false`: disable obfuscation
* - `string`: regex string used to obfuscate matching values (empty string disables)
* - `RegExp`: regex used to obfuscate matching values
*/
queryStringObfuscation?: boolean | string | RegExp;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also applies to Http2Server

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We seem to miss tests that show how this would be used as end user. Please add these

/**
* Whether to enable resource renaming when the framework route is unavailable.
*/
resourceRenamingEnabled?: boolean;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also used in azure_functions

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am unsure if this is the correct place for an end user. Could you please write a kind of end user test?

Copy link
Copy Markdown
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am actually uncertain how these methods would be defined as user and if this is indeed correct or not. After looking into it I understand where they are used but not how they are defined as a user.

Thus, adding tests for that would be really great! Also with more than a single filter for different parts, if possible.

@pabloerhard pabloerhard requested a review from a team as a code owner February 4, 2026 23:27
@datadog-official

This comment has been minimized.

@pabloerhard pabloerhard force-pushed the pabloerhard/fix-http-ts branch from 98e19be to 445ced6 Compare February 4, 2026 23:58
Comment on lines +267 to +269
const promise = agent.assertSomeTraces(traces => {
assert.strictEqual(traces[0][0].resource, 'GET')
})
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not an ideal test since we only verify that any trace matches and that is definitely the case

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true


beforeEach(() => {
config = {
server: false,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead, could we add another filter and check if they conflict? I am uncertain if it is possible to define different filters.

And if they do, we should document that / add a comment here as well.

@pabloerhard pabloerhard force-pushed the pabloerhard/fix-http-ts branch from 02c6323 to d329dae Compare February 5, 2026 16:57
@BridgeAR BridgeAR merged commit 80571e0 into master Feb 5, 2026
637 of 638 checks passed
@BridgeAR BridgeAR deleted the pabloerhard/fix-http-ts branch February 5, 2026 18:53
dd-octo-sts bot pushed a commit that referenced this pull request Feb 5, 2026
* added filter into ts definition file

* moved queryStringObfuscation and resourceRenamingEnabled

* Added e2e tests for filter config in http http2 and redis

* added tests for resourceRenamingEnabled in http

* added tests for queryStringObfuscation

* added test to verify multiple filters don't conflict
@dd-octo-sts dd-octo-sts bot mentioned this pull request Feb 5, 2026
BridgeAR pushed a commit that referenced this pull request Feb 5, 2026
* added filter into ts definition file

* moved queryStringObfuscation and resourceRenamingEnabled

* Added e2e tests for filter config in http http2 and redis

* added tests for resourceRenamingEnabled in http

* added tests for queryStringObfuscation

* added test to verify multiple filters don't conflict
bm1549 pushed a commit that referenced this pull request Feb 10, 2026
* added filter into ts definition file

* moved queryStringObfuscation and resourceRenamingEnabled

* Added e2e tests for filter config in http http2 and redis

* added tests for resourceRenamingEnabled in http

* added tests for queryStringObfuscation

* added test to verify multiple filters don't conflict
BridgeAR pushed a commit that referenced this pull request Feb 22, 2026
* added filter into ts definition file

* moved queryStringObfuscation and resourceRenamingEnabled

* Added e2e tests for filter config in http http2 and redis

* added tests for resourceRenamingEnabled in http

* added tests for queryStringObfuscation

* added test to verify multiple filters don't conflict
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants