(instance, tracer)
| 502 | * @returns {(hookName: string) => HookInterceptor<EXPECTED_ANY, EXPECTED_ANY>} interceptor |
| 503 | */ |
| 504 | const makeInterceptorFor = (instance, tracer) => (hookName) => ({ |
| 505 | /** |
| 506 | * Returns modified full tap. |
| 507 | * @param {FullTap} tapInfo tap info |
| 508 | * @returns {FullTap} modified full tap |
| 509 | */ |
| 510 | register: (tapInfo) => { |
| 511 | const { name, type, fn: internalFn } = tapInfo; |
| 512 | const newFn = |
| 513 | // Don't tap our own hooks to ensure stream can close cleanly |
| 514 | name === PLUGIN_NAME |
| 515 | ? internalFn |
| 516 | : makeNewProfiledTapFn(hookName, tracer, { |
| 517 | name, |
| 518 | type, |
| 519 | fn: /** @type {PluginFunction} */ (internalFn) |
| 520 | }); |
| 521 | return { ...tapInfo, fn: newFn }; |
| 522 | } |
| 523 | }); |
| 524 | |
| 525 | /** |
| 526 | * Creates new profiled tap fn. |
no test coverage detected