UNPKG

@embrace-io/web-sdk

Version:
69 lines (68 loc) 5.33 kB
import { EmbraceInstrumentationBase } from "../instrumentations/EmbraceInstrumentationBase/EmbraceInstrumentationBase.js"; import { DocumentLoadInstrumentation } from "../instrumentations/document-load/DocumentLoadInstrumentation/DocumentLoadInstrumentation.js"; import { EmptyRootInstrumentation } from "../instrumentations/empty-root/EmptyRootInstrumentation/EmptyRootInstrumentation.js"; import { ClicksInstrumentation } from "../instrumentations/clicks/ClicksInstrumentation/ClicksInstrumentation.js"; import { ElementTimingInstrumentation } from "../instrumentations/element-timing/ElementTimingInstrumentation/ElementTimingInstrumentation.js"; import { GlobalExceptionInstrumentation } from "../instrumentations/exceptions/GlobalExceptionInstrumentation/GlobalExceptionInstrumentation.js"; import { FirstInteractionInstrumentation } from "../instrumentations/first-interaction/FirstInteractionInstrumentation/FirstInteractionInstrumentation.js"; import { LoafInstrumentation } from "../instrumentations/loaf/LoafInstrumentation/LoafInstrumentation.js"; import { MaxScrollDepthInstrumentation } from "../instrumentations/max-scroll-depth/MaxScrollDepthInstrumentation/MaxScrollDepthInstrumentation.js"; import { NavigationInstrumentation } from "../instrumentations/navigation/NavigationInstrumentation/NavigationInstrumentation.js"; import { RageClickInstrumentation } from "../instrumentations/rage-click/RageClickInstrumentation/RageClickInstrumentation.js"; import { ServerTimingInstrumentation } from "../instrumentations/server-timing/ServerTimingInstrumentation/ServerTimingInstrumentation.js"; import { SoftNavigationPerformanceInstrumentation } from "../instrumentations/soft-navigation-performance/SoftNavigationPerformanceInstrumentation/SoftNavigationPerformanceInstrumentation.js"; import { UserTimingInstrumentation } from "../instrumentations/user-timing/UserTimingInstrumentation/UserTimingInstrumentation.js"; import { WebVitalsInstrumentation } from "../instrumentations/web-vitals/WebVitalsInstrumentation/WebVitalsInstrumentation.js"; import { FetchInstrumentation } from "@opentelemetry/instrumentation-fetch"; import { XMLHttpRequestInstrumentation } from "@opentelemetry/instrumentation-xml-http-request"; //#region src/sdk/setupDefaultInstrumentations.ts const setupDefaultInstrumentations = (config = {}, { logManager, userSessionManager, pageManager, limitManager, signalBuffer }) => { const instrumentations = []; if (!config.omit?.has("exception")) instrumentations.push(new GlobalExceptionInstrumentation(config["exception"])); if (!config.omit?.has("click")) instrumentations.push(new ClicksInstrumentation(config["click"])); if (!config.omit?.has("rage-click")) instrumentations.push(new RageClickInstrumentation(config["rage-click"])); if (!config.omit?.has("max-scroll-depth")) instrumentations.push(new MaxScrollDepthInstrumentation(config["max-scroll-depth"])); if (!config.omit?.has("first-interaction")) instrumentations.push(new FirstInteractionInstrumentation(config["first-interaction"])); if (!config.omit?.has("web-vital")) instrumentations.push(new WebVitalsInstrumentation({ ...config["web-vital"], pageManager })); if (!config.omit?.has("loaf")) instrumentations.push(new LoafInstrumentation({ ...config["loaf"] })); if (!config.omit?.has("user-timing")) instrumentations.push(new UserTimingInstrumentation(config["user-timing"])); if (!config.omit?.has("element-timing")) instrumentations.push(new ElementTimingInstrumentation({ limitManager, ...config["element-timing"] })); if (!config.omit?.has("soft-navigation-performance")) instrumentations.push(new SoftNavigationPerformanceInstrumentation({ limitManager, signalBuffer, ...config["soft-navigation-performance"] })); if (!config.omit?.has("document-load")) instrumentations.push(new DocumentLoadInstrumentation(config["document-load"])); instrumentations.push(new NavigationInstrumentation({ pageManager, ...config["navigation"] })); if (!config.omit?.has("server-timing")) instrumentations.push(new ServerTimingInstrumentation({ limitManager, ...config["server-timing"] })); if (!config.omit?.has("@opentelemetry/instrumentation-fetch")) instrumentations.push(new FetchInstrumentation({ ...config["@opentelemetry/instrumentation-fetch"], ignoreUrls: [...config["network"]?.ignoreUrls ?? [], ...config["@opentelemetry/instrumentation-fetch"]?.ignoreUrls ?? []] })); if (!config.omit?.has("@opentelemetry/instrumentation-xml-http-request")) instrumentations.push(new XMLHttpRequestInstrumentation({ ...config["@opentelemetry/instrumentation-xml-http-request"], ignoreUrls: [...config["network"]?.ignoreUrls ?? [], ...config["@opentelemetry/instrumentation-xml-http-request"]?.ignoreUrls ?? []] })); if (config["empty-root"]) instrumentations.push(new EmptyRootInstrumentation({ ...config["empty-root"] })); for (const instrumentation of instrumentations) if (instrumentation instanceof EmbraceInstrumentationBase) { if (userSessionManager) instrumentation.setUserSessionManager(userSessionManager); if (logManager) instrumentation.setLogManager(logManager); if (limitManager) instrumentation.setLimitManager(limitManager); } return instrumentations; }; //#endregion export { setupDefaultInstrumentations }; //# sourceMappingURL=setupDefaultInstrumentations.js.map