Files
klz-cables.com/.pnpm-store/v10/files/b4/3d73c5c9e4105e00e125519bdeb58f951870a58c5562ca2e7a57caec4ad5c8dd54aede2f1a745e897c9f451141745c061cfa42fe0ae2391c44ae602eb009e9
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

68 lines
2.1 KiB
Plaintext

import { DEBUG_BUILD } from '../../debug-build.js';
import { debug } from '../debug-logger.js';
/**
* Registry tracking which AI provider modules should skip instrumentation wrapping.
*
* This prevents duplicate spans when a higher-level integration (like LangChain)
* already instruments AI providers at a higher abstraction level.
*/
const SKIPPED_AI_PROVIDERS = new Set();
/**
* Mark AI provider modules to skip instrumentation wrapping.
*
* This prevents duplicate spans when a higher-level integration (like LangChain)
* already instruments AI providers at a higher abstraction level.
*
* @internal
* @param modules - Array of npm module names to skip (e.g., '@anthropic-ai/sdk', 'openai')
*
* @example
* ```typescript
* // In LangChain integration
* _INTERNAL_skipAiProviderWrapping(['@anthropic-ai/sdk', 'openai', '@google/generative-ai']);
* ```
*/
function _INTERNAL_skipAiProviderWrapping(modules) {
modules.forEach(module => {
SKIPPED_AI_PROVIDERS.add(module);
DEBUG_BUILD && debug.log(`AI provider "${module}" wrapping will be skipped`);
});
}
/**
* Check if an AI provider module should skip instrumentation wrapping.
*
* @internal
* @param module - The npm module name (e.g., '@anthropic-ai/sdk', 'openai')
* @returns true if wrapping should be skipped
*
* @example
* ```typescript
* // In AI provider instrumentation
* if (_INTERNAL_shouldSkipAiProviderWrapping('@anthropic-ai/sdk')) {
* return Reflect.construct(Original, args); // Don't instrument
* }
* ```
*/
function _INTERNAL_shouldSkipAiProviderWrapping(module) {
return SKIPPED_AI_PROVIDERS.has(module);
}
/**
* Clear all AI provider skip registrations.
*
* This is automatically called at the start of Sentry.init() to ensure a clean state
* between different client initializations.
*
* @internal
*/
function _INTERNAL_clearAiProviderSkips() {
SKIPPED_AI_PROVIDERS.clear();
DEBUG_BUILD && debug.log('Cleared AI provider skip registrations');
}
export { _INTERNAL_clearAiProviderSkips, _INTERNAL_shouldSkipAiProviderWrapping, _INTERNAL_skipAiProviderWrapping };
//# sourceMappingURL=providerSkip.js.map