anonymization-module.ts 624 B

123456789101112131415161718192021
  1. import type { IncomingMessage } from 'node:http';
  2. /**
  3. * Interface for anonymization modules
  4. */
  5. export interface AnonymizationModule {
  6. /**
  7. * Check if this module can handle the given URL
  8. * @param url - The request URL
  9. * @returns true if this module should process the request
  10. */
  11. canHandle(url: string): boolean;
  12. /**
  13. * Process anonymization for the request
  14. * @param request - The HTTP request
  15. * @param url - The request URL
  16. * @returns Attributes to be set on the span, or null if no anonymization needed
  17. */
  18. handle(request: IncomingMessage, url: string): Record<string, string> | null;
  19. }