Przeglądaj źródła

fix: ensure attributes are set only if the URL is modified in page-listing anonymization

Yuki Takei 9 miesięcy temu
rodzic
commit
b72b4fb6b3

+ 6 - 3
apps/app/src/features/opentelemetry/server/anonymization/handlers/page-listing-api-handler.ts

@@ -36,9 +36,12 @@ export const pageListingApiModule: AnonymizationModule = {
       || url.includes('/_api/v3/page-listing/info')
       || url.includes('/_api/v3/page-listing/info')
     ) {
     ) {
       const anonymizedUrl = anonymizeQueryParams(url, ['path']);
       const anonymizedUrl = anonymizeQueryParams(url, ['path']);
-      attributes[ATTR_HTTP_TARGET] = anonymizedUrl;
-      hasAnonymization = true;
-      logger.debug(`Anonymized page-listing URL: ${url} -> ${anonymizedUrl}`);
+      // Only set attributes if the URL was actually modified
+      if (anonymizedUrl !== url) {
+        attributes[ATTR_HTTP_TARGET] = anonymizedUrl;
+        hasAnonymization = true;
+        logger.debug(`Anonymized page-listing URL: ${url} -> ${anonymizedUrl}`);
+      }
     }
     }
 
 
     return hasAnonymization ? attributes : null;
     return hasAnonymization ? attributes : null;