Skip to content

feat: add query stripping for self telemetry - #125

Merged
resure merged 1 commit into
mainfrom
feat/self-stats-request-url-mode
Sep 14, 2026
Merged

resure merged 1 commit into
mainfrom
feat/self-stats-request-url-mode

Conversation

@goshander

@goshander goshander commented Sep 8, 2026

Copy link
Copy Markdown
Member

@resure resure left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 path mode intentionally skips redactSensitiveQueryParams (nothing left to redact) would prevent someone "fixing" it later.

🤖 partly ai generated

@goshander
goshander force-pushed the feat/self-stats-request-url-mode branch from 933a3d2 to 54a068c Compare September 9, 2026 16:21
@goshander goshander changed the title feat: add request URL mode for self telemetry feat: add query stripping for self telemetry Sep 9, 2026
@goshander

Copy link
Copy Markdown
Member Author

Thanks, the change itself looks good and the default-mode test now covering the query string is a nice touch.

Replaced the enum with the appTelemetryChSelfStatsStripQueryParams boolean flag, removed the public export
Updated the README, and added a comment explaining why redaction is skipped after stripping the query string.

@goshander
goshander requested a review from resure September 11, 2026 11:57
@resure
resure merged commit 38a0ea3 into main Sep 14, 2026
10 checks passed
@resure
resure deleted the feat/self-stats-request-url-mode branch September 14, 2026 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants