{"version":3,"file":"setupDefaultInstrumentations.cjs","names":["SpanSessionOnLoadInstrumentation","SpanSessionVisibilityInstrumentation","SpanSessionBrowserActivityInstrumentation","SpanSessionTimeoutInstrumentation","GlobalExceptionInstrumentation","ClicksInstrumentation","WebVitalsInstrumentation","LoafInstrumentation","UserTimingInstrumentation","ElementTimingInstrumentation","DocumentLoadInstrumentation","ServerTimingInstrumentation","EmbraceFetchInstrumentation","EmbraceXHRInstrumentation","EmptyRootInstrumentation","EmbraceInstrumentationBase"],"sources":["../../src/sdk/setupDefaultInstrumentations.ts"],"sourcesContent":["import type { Instrumentation } from '@opentelemetry/instrumentation';\nimport {\n  ClicksInstrumentation,\n  DocumentLoadInstrumentation,\n  ElementTimingInstrumentation,\n  EmbraceFetchInstrumentation,\n  EmbraceInstrumentationBase,\n  EmbraceXHRInstrumentation,\n  EmptyRootInstrumentation,\n  GlobalExceptionInstrumentation,\n  LoafInstrumentation,\n  ServerTimingInstrumentation,\n  SpanSessionBrowserActivityInstrumentation,\n  SpanSessionOnLoadInstrumentation,\n  SpanSessionTimeoutInstrumentation,\n  SpanSessionVisibilityInstrumentation,\n  UserTimingInstrumentation,\n  WebVitalsInstrumentation,\n} from '../instrumentations/index.ts';\nimport type {\n  DefaultInstrumentationConfig,\n  SetupDefaultInstrumentationsArgs,\n} from './types.ts';\n\nexport const setupDefaultInstrumentations = (\n  config: DefaultInstrumentationConfig = {},\n  {\n    featureManager,\n    logManager,\n    spanSessionManager,\n    embraceSpanProcessor,\n    pageManager,\n    limitManager,\n  }: SetupDefaultInstrumentationsArgs,\n): Instrumentation[] => {\n  /*\n    These instrumentations are core to managing the session lifecycle and so are not optional\n   */\n  const instrumentations: Instrumentation[] = [\n    new SpanSessionOnLoadInstrumentation(config['session-on-load']),\n    new SpanSessionVisibilityInstrumentation(\n      config['session-visibility'],\n      featureManager,\n      embraceSpanProcessor,\n    ),\n    new SpanSessionBrowserActivityInstrumentation(config['session-activity']),\n    new SpanSessionTimeoutInstrumentation(config['session-timeout']),\n  ];\n\n  if (!config.omit?.has('exception')) {\n    instrumentations.push(\n      new GlobalExceptionInstrumentation(config['exception']),\n    );\n  }\n\n  if (!config.omit?.has('click')) {\n    instrumentations.push(new ClicksInstrumentation(config['click']));\n  }\n\n  if (!config.omit?.has('web-vital')) {\n    instrumentations.push(\n      new WebVitalsInstrumentation({ ...config['web-vital'], pageManager }),\n    );\n  }\n\n  if (!config.omit?.has('loaf')) {\n    instrumentations.push(new LoafInstrumentation({ ...config['loaf'] }));\n  }\n\n  if (!config.omit?.has('user-timing')) {\n    instrumentations.push(new UserTimingInstrumentation(config['user-timing']));\n  }\n\n  if (!config.omit?.has('element-timing')) {\n    instrumentations.push(\n      new ElementTimingInstrumentation({\n        ...config['element-timing'],\n        limitManager,\n      }),\n    );\n  }\n\n  if (!config.omit?.has('document-load')) {\n    instrumentations.push(\n      new DocumentLoadInstrumentation(config['document-load']),\n    );\n  }\n\n  if (!config.omit?.has('server-timing')) {\n    instrumentations.push(\n      new ServerTimingInstrumentation({\n        ...config['server-timing'],\n        limitManager,\n      }),\n    );\n  }\n\n  if (!config.omit?.has('@opentelemetry/instrumentation-fetch')) {\n    instrumentations.push(\n      new EmbraceFetchInstrumentation({\n        ...config['@opentelemetry/instrumentation-fetch'],\n        ignoreUrls: [\n          ...(config['network']?.ignoreUrls ?? []),\n          ...(config['@opentelemetry/instrumentation-fetch']?.ignoreUrls ?? []),\n        ],\n      }),\n    );\n  }\n\n  if (!config.omit?.has('@opentelemetry/instrumentation-xml-http-request')) {\n    instrumentations.push(\n      new EmbraceXHRInstrumentation({\n        ...config['@opentelemetry/instrumentation-xml-http-request'],\n        ignoreUrls: [\n          ...(config['network']?.ignoreUrls ?? []),\n          ...(config['@opentelemetry/instrumentation-xml-http-request']\n            ?.ignoreUrls ?? []),\n        ],\n      }),\n    );\n  }\n\n  if (config['empty-root']) {\n    instrumentations.push(\n      new EmptyRootInstrumentation({ ...config['empty-root'] }),\n    );\n  }\n\n  for (const instrumentation of instrumentations) {\n    if (instrumentation instanceof EmbraceInstrumentationBase) {\n      if (spanSessionManager) {\n        instrumentation.setSessionManager(spanSessionManager);\n      }\n\n      if (logManager) {\n        instrumentation.setLogManager(logManager);\n      }\n\n      if (limitManager) {\n        instrumentation.setLimitManager(limitManager);\n      }\n    }\n  }\n\n  return instrumentations;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAwBA,MAAa,gCACX,SAAuC,EAAE,EACzC,EACE,gBACA,YACA,oBACA,sBACA,aACA,mBAEoB;CAItB,MAAM,mBAAsC;EAC1C,IAAIA,mGAAAA,iCAAiC,OAAO,mBAAmB;EAC/D,IAAIC,2GAAAA,qCACF,OAAO,uBACP,gBACA,qBACD;EACD,IAAIC,qHAAAA,0CAA0C,OAAO,oBAAoB;EACzE,IAAIC,qGAAAA,kCAAkC,OAAO,mBAAmB;EACjE;AAED,KAAI,CAAC,OAAO,MAAM,IAAI,YAAY,CAChC,kBAAiB,KACf,IAAIC,kGAAAA,+BAA+B,OAAO,aAAa,CACxD;AAGH,KAAI,CAAC,OAAO,MAAM,IAAI,QAAQ,CAC5B,kBAAiB,KAAK,IAAIC,4EAAAA,sBAAsB,OAAO,SAAS,CAAC;AAGnE,KAAI,CAAC,OAAO,MAAM,IAAI,YAAY,CAChC,kBAAiB,KACf,IAAIC,sFAAAA,yBAAyB;EAAE,GAAG,OAAO;EAAc;EAAa,CAAC,CACtE;AAGH,KAAI,CAAC,OAAO,MAAM,IAAI,OAAO,CAC3B,kBAAiB,KAAK,IAAIC,sEAAAA,oBAAoB,EAAE,GAAG,OAAO,SAAS,CAAC,CAAC;AAGvE,KAAI,CAAC,OAAO,MAAM,IAAI,cAAc,CAClC,kBAAiB,KAAK,IAAIC,yFAAAA,0BAA0B,OAAO,eAAe,CAAC;AAG7E,KAAI,CAAC,OAAO,MAAM,IAAI,iBAAiB,CACrC,kBAAiB,KACf,IAAIC,kGAAAA,6BAA6B;EAC/B,GAAG,OAAO;EACV;EACD,CAAC,CACH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