Skip to content

Commit c352450

Browse files
aalemayhuclaude
andcommitted
refactor(ops): drop trailing-slash regex in instrumentedAxios
URL.pathname is already normalized by the URL parser, so the `/\/+$/` regex was doing nothing useful for endpoint labels. Removing it also clears Sonar S5852 (slow-regex hotspot) — the regex is linear, but reviewing it adds noise we don't need. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent bfed3e1 commit c352450

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

src/services/observability/instrumentedAxios.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ const isAllowedService = (service: string): service is ObservabilityService =>
1919
const stripQueryFromUrl = (url: string): string => {
2020
try {
2121
const parsed = new URL(url);
22-
return `${parsed.host}${parsed.pathname}`.replace(/\/+$/, (m) =>
23-
m.length > 1 ? '/' : m
24-
);
22+
return `${parsed.host}${parsed.pathname}`;
2523
} catch {
2624
const queryIndex = url.indexOf('?');
2725
return queryIndex >= 0 ? url.slice(0, queryIndex) : url;

0 commit comments

Comments
 (0)