@zintrust/trace 0.5.5 → 0.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/config.js +2 -0
  2. package/dist/dashboard/ui.js +4 -4
  3. package/dist/types.d.ts +1 -0
  4. package/dist/utils/requestFilter.d.ts +7 -2
  5. package/dist/utils/requestFilter.js +30 -4
  6. package/dist/watchers/AuthWatcher.js +4 -1
  7. package/dist/watchers/BatchWatcher.js +4 -1
  8. package/dist/watchers/CacheWatcher.js +4 -1
  9. package/dist/watchers/CommandWatcher.js +4 -1
  10. package/dist/watchers/DumpWatcher.js +4 -1
  11. package/dist/watchers/EventWatcher.js +4 -1
  12. package/dist/watchers/ExceptionWatcher.js +5 -2
  13. package/dist/watchers/GateWatcher.js +4 -1
  14. package/dist/watchers/HttpClientWatcher.js +4 -1
  15. package/dist/watchers/HttpWatcher.js +1 -1
  16. package/dist/watchers/JobWatcher.js +4 -1
  17. package/dist/watchers/LogWatcher.js +1 -1
  18. package/dist/watchers/MailWatcher.js +4 -1
  19. package/dist/watchers/MiddlewareWatcher.js +4 -1
  20. package/dist/watchers/ModelWatcher.js +4 -1
  21. package/dist/watchers/NotificationWatcher.js +4 -1
  22. package/dist/watchers/QueryWatcher.js +1 -1
  23. package/dist/watchers/RedisWatcher.js +4 -1
  24. package/dist/watchers/ScheduleWatcher.js +4 -1
  25. package/dist/watchers/ViewWatcher.js +4 -1
  26. package/package.json +2 -2
  27. package/src/config.ts +2 -0
  28. package/src/dashboard/ui.ts +4 -4
  29. package/src/types.ts +1 -0
  30. package/src/utils/requestFilter.ts +57 -11
  31. package/src/watchers/AuthWatcher.ts +4 -1
  32. package/src/watchers/BatchWatcher.ts +4 -1
  33. package/src/watchers/CacheWatcher.ts +4 -1
  34. package/src/watchers/CommandWatcher.ts +4 -1
  35. package/src/watchers/DumpWatcher.ts +4 -1
  36. package/src/watchers/EventWatcher.ts +4 -1
  37. package/src/watchers/ExceptionWatcher.ts +5 -2
  38. package/src/watchers/GateWatcher.ts +4 -1
  39. package/src/watchers/HttpClientWatcher.ts +4 -1
  40. package/src/watchers/HttpWatcher.ts +1 -1
  41. package/src/watchers/JobWatcher.ts +4 -1
  42. package/src/watchers/LogWatcher.ts +2 -1
  43. package/src/watchers/MailWatcher.ts +4 -1
  44. package/src/watchers/MiddlewareWatcher.ts +4 -1
  45. package/src/watchers/ModelWatcher.ts +4 -1
  46. package/src/watchers/NotificationWatcher.ts +4 -1
  47. package/src/watchers/QueryWatcher.ts +1 -1
  48. package/src/watchers/RedisWatcher.ts +4 -1
  49. package/src/watchers/ScheduleWatcher.ts +4 -1
  50. package/src/watchers/ViewWatcher.ts +4 -1
@@ -8,6 +8,7 @@ import { RequestFilter } from '../utils/requestFilter';
8
8
  let _storage: ITraceWatcherConfig['storage'] | null = null;
9
9
  let _redactionFields: string[] = [];
10
10
  let _ignoreRoutes: string[] = [];
11
+ let _ignorePath: string[] = [];
11
12
 
12
13
  const emit = (
13
14
  notification: string,
@@ -17,7 +18,7 @@ const emit = (
17
18
  payload?: unknown
18
19
  ): void => {
19
20
  if (!_storage) return;
20
- if (RequestFilter.shouldIgnoreCurrentRequest(_ignoreRoutes)) return;
21
+ if (RequestFilter.shouldIgnoreCurrentRequest(_ignoreRoutes, _ignorePath)) return;
21
22
  const content: NotificationContent = {
22
23
  notification,
23
24
  channels,
@@ -48,10 +49,12 @@ export const NotificationWatcher: ITraceWatcher & { emit: typeof emit } = Object
48
49
  _storage = storage;
49
50
  _redactionFields = [...config.redaction.keys, ...config.redaction.body];
50
51
  _ignoreRoutes = config.ignoreRoutes;
52
+ _ignorePath = config.ignorePath;
51
53
  return () => {
52
54
  _storage = null;
53
55
  _redactionFields = [];
54
56
  _ignoreRoutes = [];
57
+ _ignorePath = [];
55
58
  };
56
59
  },
57
60
  });
@@ -33,7 +33,7 @@ const isTraceStorageQuery = (sql: string): boolean => {
33
33
 
34
34
  const emit = (query: string, params: unknown[], duration: number, connection = 'default'): void => {
35
35
  if (_storage === null || _config === null) return;
36
- if (RequestFilter.shouldIgnoreCurrentRequest(_config.ignoreRoutes)) return;
36
+ if (RequestFilter.shouldIgnoreCurrentRequest(_config.ignoreRoutes, _config.ignorePath)) return;
37
37
  if (isTraceStorageQuery(query)) return;
38
38
 
39
39
  const batchId = TraceContext.getBatchId();
@@ -6,11 +6,12 @@ import { RequestFilter } from '../utils/requestFilter';
6
6
 
7
7
  let _storage: ITraceWatcherConfig['storage'] | null = null;
8
8
  let _ignoreRoutes: string[] = [];
9
+ let _ignorePath: string[] = [];
9
10
 
10
11
  /** Emit a redis command trace. Key/value payload is intentionally omitted for security. */
11
12
  const emit = (command: string, duration: number): void => {
12
13
  if (!_storage) return;
13
- if (RequestFilter.shouldIgnoreCurrentRequest(_ignoreRoutes)) return;
14
+ if (RequestFilter.shouldIgnoreCurrentRequest(_ignoreRoutes, _ignorePath)) return;
14
15
  const content: RedisContent = { command, duration, hostname: TraceContext.getHostname() };
15
16
  _storage
16
17
  .writeEntry({
@@ -31,9 +32,11 @@ export const RedisWatcher: ITraceWatcher & { emit: typeof emit } = Object.freeze
31
32
  if (config.watchers.redis === false) return () => undefined;
32
33
  _storage = storage;
33
34
  _ignoreRoutes = config.ignoreRoutes;
35
+ _ignorePath = config.ignorePath;
34
36
  return () => {
35
37
  _storage = null;
36
38
  _ignoreRoutes = [];
39
+ _ignorePath = [];
37
40
  };
38
41
  },
39
42
  });
@@ -8,6 +8,7 @@ import { RequestFilter } from '../utils/requestFilter';
8
8
 
9
9
  let _storage: ITraceWatcherConfig['storage'] | null = null;
10
10
  let _ignoreRoutes: string[] = [];
11
+ let _ignorePath: string[] = [];
11
12
 
12
13
  const emit = (
13
14
  name: string,
@@ -17,7 +18,7 @@ const emit = (
17
18
  output?: string
18
19
  ): void => {
19
20
  if (!_storage) return;
20
- if (RequestFilter.shouldIgnoreCurrentRequest(_ignoreRoutes)) return;
21
+ if (RequestFilter.shouldIgnoreCurrentRequest(_ignoreRoutes, _ignorePath)) return;
21
22
  const content: ScheduleContent = {
22
23
  name,
23
24
  expression,
@@ -46,9 +47,11 @@ export const ScheduleWatcher: ITraceWatcher & { emit: typeof emit } = Object.fre
46
47
  if (config.watchers.schedule === false) return () => undefined;
47
48
  _storage = storage;
48
49
  _ignoreRoutes = config.ignoreRoutes;
50
+ _ignorePath = config.ignorePath;
49
51
  return () => {
50
52
  _storage = null;
51
53
  _ignoreRoutes = [];
54
+ _ignorePath = [];
52
55
  };
53
56
  },
54
57
  });
@@ -5,10 +5,11 @@ import { RequestFilter } from '../utils/requestFilter';
5
5
 
6
6
  let _storage: ITraceWatcherConfig['storage'] | null = null;
7
7
  let _ignoreRoutes: string[] = [];
8
+ let _ignorePath: string[] = [];
8
9
 
9
10
  const emit = (template: string, duration: number): void => {
10
11
  if (!_storage) return;
11
- if (RequestFilter.shouldIgnoreCurrentRequest(_ignoreRoutes)) return;
12
+ if (RequestFilter.shouldIgnoreCurrentRequest(_ignoreRoutes, _ignorePath)) return;
12
13
  const content: ViewContent = { template, duration, hostname: TraceContext.getHostname() };
13
14
  _storage
14
15
  .writeEntry({
@@ -29,9 +30,11 @@ export const ViewWatcher: ITraceWatcher & { emit: typeof emit } = Object.freeze(
29
30
  if (config.watchers.view === false) return () => undefined;
30
31
  _storage = storage;
31
32
  _ignoreRoutes = config.ignoreRoutes;
33
+ _ignorePath = config.ignorePath;
32
34
  return () => {
33
35
  _storage = null;
34
36
  _ignoreRoutes = [];
37
+ _ignorePath = [];
35
38
  };
36
39
  },
37
40
  });