feat: add query stripping for self telemetry - #125
Conversation
There was a problem hiding this comment.
Thanks, the change itself looks good and the default-mode test now covering the query string is a nice touch.
One suggestion on the config shape. Right now the switch has two values and one of them means "do nothing", so it is effectively a boolean. A flag would be simpler and would match the neighbouring appTelemetryChEnableSelfStats:
appTelemetryChSelfStatsStripQueryParams?: boolean;That also removes the StatsUrlMode public export, the README import, and the template-literal type.
If you are planning a third mode later (for example route using req.route.path, which is what the OTel HTTP metrics conventions actually recommend for low cardinality), then keeping an enum makes sense. In that case I would give it a more specific name than StatsUrlMode, e.g. SelfStatsRequestUrlMode, since it is exported at package level.
Two nits:
- README: "stores the original request URL" -> "sends", expresskit does not store anything.
- A short comment above the ternary noting that
pathmode intentionally skipsredactSensitiveQueryParams(nothing left to redact) would prevent someone "fixing" it later.
🤖 partly ai generated
933a3d2 to
54a068c
Compare
Replaced the enum with the |
Uh oh!
There was an error while loading. Please reload this page.