{"version":3,"file":"DocumentLoadInstrumentation.cjs","names":["EmbraceInstrumentationBase","TRACE_PARENT_HEADER","getPerformanceNavigationEntries","propagation","ROOT_CONTEXT","PerformanceTimingNames","trace","context","ATTR_URL_FULL","KEY_EMB_TYPE","ATTR_USER_AGENT_ORIGINAL","ATTR_HTTP_RESPONSE_STATUS_CODE","ATTR_HTTP_RESPONSE_BODY_SIZE","ATTR_HTTP_RESPONSE_SIZE"],"sources":["../../../../src/instrumentations/document-load/DocumentLoadInstrumentation/DocumentLoadInstrumentation.ts"],"sourcesContent":["/*\n * Adapted from OpenTelemetry document-load instrumentation\n * https://github.com/open-telemetry/opentelemetry-js-contrib/tree/cc7eff47e2e7bad7678241b766753d5bd6dbc85f/packages/instrumentation-document-load\n *\n * Additional PerformanceResourceTiming attributes collected:\n * - entry_type, initiator_type\n * - decoded_body_size, http.response.body.size, http.response.size\n * - delivery_type (Chromium only)\n * - render_blocking_status (Chromium only)\n * - http.response.status_code (no Safari support)\n *\n * Custom diagnostic attributes added to identify resource loading issues:\n * - http.response.cors_opaque - CORS-restricted resource (opaque response)\n * - http.response.cache_revalidated - 304 Not Modified response\n * - http.request.incomplete - Request started but didn't complete (network error, aborted)\n * - http.request.prevented - Request never started (blocked by CSP, browser, extension)\n */\n\nimport type { Span } from '@opentelemetry/api';\nimport { context, propagation, ROOT_CONTEXT, trace } from '@opentelemetry/api';\nimport { TRACE_PARENT_HEADER } from '@opentelemetry/core';\nimport { safeExecuteInTheMiddle } from '@opentelemetry/instrumentation';\nimport type { PerformanceEntries } from '@opentelemetry/sdk-trace-web';\nimport {\n  addSpanNetworkEvent,\n  addSpanNetworkEvents,\n  hasKey,\n  PerformanceTimingNames,\n} from '@opentelemetry/sdk-trace-web';\nimport { ATTR_HTTP_RESPONSE_STATUS_CODE } from '@opentelemetry/semantic-conventions';\nimport {\n  ATTR_HTTP_RESPONSE_BODY_SIZE,\n  ATTR_HTTP_RESPONSE_SIZE,\n  ATTR_URL_FULL,\n  ATTR_USER_AGENT_ORIGINAL,\n} from '@opentelemetry/semantic-conventions/incubating';\nimport { EMB_TYPES, KEY_EMB_TYPE } from '../../../constants/index.ts';\nimport { EmbraceInstrumentationBase } from '../../EmbraceInstrumentationBase/index.ts';\nimport { AttributeNames } from './enums/AttributeNames.ts';\nimport type {\n  DocumentLoadCustomAttributeFunction,\n  DocumentLoadInstrumentationConfig,\n  ResourceFetchCustomAttributeFunction,\n} from './types.ts';\nimport {\n  addSpanPerformancePaintEvents,\n  getPerformanceNavigationEntries,\n} from './utils.ts';\n\n/**\n * Adds new browser features not yet in TypeScript's DOM lib (as of Oct 2025):\n * - deliveryType: Chromium only (experimental) https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/deliveryType\n * - renderBlockingStatus: Chromium only https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/renderBlockingStatus\n */\ntype EmbracePerformanceResourceTiming = PerformanceResourceTiming & {\n  deliveryType?: 'cache' | '';\n  renderBlockingStatus?: 'blocking' | 'non-blocking';\n};\n\n// PerformanceResourceTiming attribute names\nconst ATTR_HTTP_RESPONSE_DELIVERY_TYPE = 'http.response.delivery_type';\nconst ATTR_HTTP_RESPONSE_DECODED_BODY_SIZE = 'http.response.decoded_body_size';\nconst ATTR_HTTP_REQUEST_INITIATOR_TYPE = 'http.request.initiator_type';\nconst ATTR_HTTP_REQUEST_RENDER_BLOCKING_STATUS =\n  'http.request.render_blocking_status';\n\n// Diagnostic attribute names\nconst ATTR_HTTP_RESPONSE_CORS_OPAQUE = 'http.response.cors_opaque'; // CORS-restricted resource (opaque response)\nconst ATTR_HTTP_RESPONSE_CACHE_REVALIDATED = 'http.response.cache_revalidated'; // 304 Not Modified response\nconst ATTR_HTTP_REQUEST_INCOMPLETE = 'http.request.incomplete'; // Request started but didn't complete\nconst ATTR_HTTP_REQUEST_PREVENTED = 'http.request.prevented'; // Request never started (blocked)\n\nexport class DocumentLoadInstrumentation extends EmbraceInstrumentationBase<DocumentLoadInstrumentationConfig> {\n  private readonly _onDocumentLoaded: () => void;\n  private _performanceCollected = false;\n\n  public constructor({\n    diag,\n    perf,\n    enabled,\n    applyCustomAttributesOnSpan,\n    ignorePerformancePaintEvents = false,\n    ignoreNetworkEvents = false,\n  }: DocumentLoadInstrumentationConfig = {}) {\n    super({\n      instrumentationName: 'DocumentLoadInstrumentation',\n      instrumentationVersion: '1.0.0',\n      diag,\n      perf,\n      config: {\n        enabled,\n        applyCustomAttributesOnSpan,\n        ignorePerformancePaintEvents,\n        ignoreNetworkEvents,\n      },\n    });\n\n    this._onDocumentLoaded = () => {\n      // Timeout needed because performance metrics for loadEnd aren't available until after the load event\n      window.setTimeout(() => {\n        this._collectPerformance();\n      }, 0);\n    };\n\n    if (this._config.enabled) {\n      this.enable();\n    }\n  }\n\n  protected override init() {\n    this._diag.debug('Initializing document load instrumentation');\n    return undefined;\n  }\n\n  /**\n   * Adds spans for all resources\n   * @param rootSpan\n   */\n  private _addResourcesSpans(rootSpan: Span): void {\n    const resources: EmbracePerformanceResourceTiming[] =\n      performance.getEntriesByType('resource');\n    resources.forEach((resource) => {\n      this._initResourceSpan(resource, rootSpan);\n    });\n  }\n\n  /**\n   * Collects information about performance and creates appropriate spans\n   */\n  private _collectPerformance(): void {\n    if (this._performanceCollected) {\n      return;\n    }\n    this._performanceCollected = true;\n\n    const metaElement = Array.from(document.getElementsByTagName('meta')).find(\n      (e) => e.getAttribute('name') === TRACE_PARENT_HEADER,\n    );\n    const entries = getPerformanceNavigationEntries();\n    const traceparent = metaElement?.content || '';\n    context.with(propagation.extract(ROOT_CONTEXT, { traceparent }), () => {\n      const rootSpan = this._startSpan(\n        AttributeNames.DOCUMENT_LOAD,\n        PerformanceTimingNames.FETCH_START,\n        entries,\n      );\n      if (!rootSpan) {\n        return;\n      }\n      context.with(trace.setSpan(context.active(), rootSpan), () => {\n        const fetchSpan = this._startSpan(\n          AttributeNames.DOCUMENT_FETCH,\n          PerformanceTimingNames.FETCH_START,\n          entries,\n        );\n        if (fetchSpan) {\n          fetchSpan.setAttribute(ATTR_URL_FULL, location.href);\n          context.with(trace.setSpan(context.active(), fetchSpan), () => {\n            addSpanNetworkEvents(\n              fetchSpan,\n              entries,\n              this.getConfig().ignoreNetworkEvents,\n            );\n            this._addCustomAttributesOnSpan(\n              fetchSpan,\n              this.getConfig().applyCustomAttributesOnSpan?.documentFetch,\n            );\n            this._endSpan(\n              fetchSpan,\n              PerformanceTimingNames.RESPONSE_END,\n              entries,\n            );\n          });\n        }\n      });\n\n      rootSpan.setAttribute(KEY_EMB_TYPE, EMB_TYPES.DocumentLoad);\n      rootSpan.setAttribute(ATTR_URL_FULL, location.href);\n      rootSpan.setAttribute(ATTR_USER_AGENT_ORIGINAL, navigator.userAgent);\n\n      this._addResourcesSpans(rootSpan);\n\n      if (!this.getConfig().ignoreNetworkEvents) {\n        addSpanNetworkEvent(\n          rootSpan,\n          PerformanceTimingNames.FETCH_START,\n          entries,\n        );\n        addSpanNetworkEvent(\n          rootSpan,\n          PerformanceTimingNames.UNLOAD_EVENT_START,\n          entries,\n        );\n        addSpanNetworkEvent(\n          rootSpan,\n          PerformanceTimingNames.UNLOAD_EVENT_END,\n          entries,\n        );\n        addSpanNetworkEvent(\n          rootSpan,\n          PerformanceTimingNames.DOM_INTERACTIVE,\n          entries,\n        );\n        addSpanNetworkEvent(\n          rootSpan,\n          PerformanceTimingNames.DOM_CONTENT_LOADED_EVENT_START,\n          entries,\n        );\n        addSpanNetworkEvent(\n          rootSpan,\n          PerformanceTimingNames.DOM_CONTENT_LOADED_EVENT_END,\n          entries,\n        );\n        addSpanNetworkEvent(\n          rootSpan,\n          PerformanceTimingNames.DOM_COMPLETE,\n          entries,\n        );\n        addSpanNetworkEvent(\n          rootSpan,\n          PerformanceTimingNames.LOAD_EVENT_START,\n          entries,\n        );\n        addSpanNetworkEvent(\n          rootSpan,\n          PerformanceTimingNames.LOAD_EVENT_END,\n          entries,\n        );\n      }\n\n      if (!this.getConfig().ignorePerformancePaintEvents) {\n        addSpanPerformancePaintEvents(rootSpan);\n      }\n\n      this._addCustomAttributesOnSpan(\n        rootSpan,\n        this.getConfig().applyCustomAttributesOnSpan?.documentLoad,\n      );\n      this._endSpan(rootSpan, PerformanceTimingNames.LOAD_EVENT_END, entries);\n    });\n  }\n\n  /**\n   * Helper function for ending a span\n   * @param span\n   * @param performanceName name of performance entry for end time\n   * @param entries\n   */\n  private _endSpan(\n    span: Span | undefined,\n    performanceName: string,\n    entries: PerformanceEntries,\n  ) {\n    // Span can be undefined when entries are missing the required performance timing - no span will be created\n    if (span) {\n      if (\n        hasKey(entries, performanceName) &&\n        typeof entries[performanceName] === 'number'\n      ) {\n        span.end(entries[performanceName]);\n      } else {\n        span.end();\n      }\n    }\n  }\n\n  /**\n   * Creates and ends a span with network information about a resource added as timed events\n   * @param resource\n   * @param parentSpan\n   */\n  private _initResourceSpan(\n    resource: EmbracePerformanceResourceTiming,\n    parentSpan: Span,\n  ) {\n    const span = this._startSpan(\n      AttributeNames.RESOURCE_FETCH,\n      PerformanceTimingNames.FETCH_START,\n      resource,\n      parentSpan,\n    );\n    if (!span) {\n      return;\n    }\n\n    span.setAttribute(KEY_EMB_TYPE, EMB_TYPES.ResourceFetch);\n    span.setAttribute(ATTR_URL_FULL, resource.name);\n    addSpanNetworkEvents(span, resource, this.getConfig().ignoreNetworkEvents);\n\n    if (resource.deliveryType) {\n      span.setAttribute(\n        ATTR_HTTP_RESPONSE_DELIVERY_TYPE,\n        resource.deliveryType,\n      );\n    }\n\n    if (resource.initiatorType) {\n      span.setAttribute(\n        ATTR_HTTP_REQUEST_INITIATOR_TYPE,\n        resource.initiatorType,\n      );\n    }\n\n    if (resource.renderBlockingStatus) {\n      span.setAttribute(\n        ATTR_HTTP_REQUEST_RENDER_BLOCKING_STATUS,\n        resource.renderBlockingStatus,\n      );\n    }\n\n    if (resource.responseStatus) {\n      span.setAttribute(\n        ATTR_HTTP_RESPONSE_STATUS_CODE,\n        resource.responseStatus,\n      );\n    }\n\n    // Validate size fields exist and aren't negative\n    if (\n      typeof resource.encodedBodySize === 'number' &&\n      resource.encodedBodySize >= 0\n    ) {\n      span.setAttribute(ATTR_HTTP_RESPONSE_BODY_SIZE, resource.encodedBodySize);\n    }\n\n    if (\n      typeof resource.transferSize === 'number' &&\n      resource.transferSize >= 0\n    ) {\n      span.setAttribute(ATTR_HTTP_RESPONSE_SIZE, resource.transferSize);\n    }\n\n    if (\n      typeof resource.decodedBodySize === 'number' &&\n      resource.decodedBodySize >= 0\n    ) {\n      span.setAttribute(\n        ATTR_HTTP_RESPONSE_DECODED_BODY_SIZE,\n        resource.decodedBodySize,\n      );\n    }\n\n    this._addResourceDiagnosticAttributes(span, resource);\n\n    this._addCustomAttributesOnResourceSpan(\n      span,\n      resource,\n      this.getConfig().applyCustomAttributesOnSpan?.resourceFetch,\n    );\n    this._endSpan(span, PerformanceTimingNames.RESPONSE_END, resource);\n  }\n\n  /**\n   * Helper function for starting a span\n   * @param spanName name of span\n   * @param performanceName name of performance entry for time start\n   * @param entries\n   * @param parentSpan\n   */\n  private _startSpan(\n    spanName: string,\n    performanceName: string,\n    entries: PerformanceEntries,\n    parentSpan?: Span,\n  ): Span | undefined {\n    if (\n      hasKey(entries, performanceName) &&\n      typeof entries[performanceName] === 'number'\n    ) {\n      const span = this.tracer.startSpan(\n        spanName,\n        {\n          startTime: entries[performanceName],\n        },\n        parentSpan ? trace.setSpan(context.active(), parentSpan) : undefined,\n      );\n      return span;\n    }\n    return undefined;\n  }\n\n  /**\n   * Executes callback {_onDocumentLoaded} when the page is loaded\n   */\n  private _waitForPageLoad() {\n    if (window.document.readyState === 'complete') {\n      this._onDocumentLoaded();\n    } else {\n      window.addEventListener('load', this._onDocumentLoaded);\n    }\n  }\n\n  /**\n   * Adds custom attributes to span if configured\n   * Used for both documentFetch and documentLoad spans\n   */\n  private _addCustomAttributesOnSpan(\n    span: Span,\n    applyCustomAttributesOnSpan:\n      | DocumentLoadCustomAttributeFunction\n      | undefined,\n  ) {\n    if (applyCustomAttributesOnSpan) {\n      safeExecuteInTheMiddle(\n        () => {\n          applyCustomAttributesOnSpan(span);\n        },\n        (error) => {\n          if (!error) {\n            return;\n          }\n\n          this._diag.error('addCustomAttributesOnSpan', error);\n        },\n        true,\n      );\n    }\n  }\n\n  /**\n   * Adds custom attributes to resource span if configured\n   */\n  private _addCustomAttributesOnResourceSpan(\n    span: Span,\n    resource: EmbracePerformanceResourceTiming,\n    applyCustomAttributesOnSpan:\n      | ResourceFetchCustomAttributeFunction\n      | undefined,\n  ) {\n    if (applyCustomAttributesOnSpan) {\n      safeExecuteInTheMiddle(\n        () => {\n          applyCustomAttributesOnSpan(span, resource);\n        },\n        (error) => {\n          if (!error) {\n            return;\n          }\n\n          this._diag.error('addCustomAttributesOnResourceSpan', error);\n        },\n        true,\n      );\n    }\n  }\n\n  private _hasNoSizeData(resource: EmbracePerformanceResourceTiming): boolean {\n    const transferSize =\n      typeof resource.transferSize === 'number' ? resource.transferSize : 0;\n    const decodedBodySize =\n      typeof resource.decodedBodySize === 'number'\n        ? resource.decodedBodySize\n        : 0;\n    const encodedBodySize =\n      typeof resource.encodedBodySize === 'number'\n        ? resource.encodedBodySize\n        : 0;\n\n    return transferSize === 0 && decodedBodySize === 0 && encodedBodySize === 0;\n  }\n\n  private _hasTimingData(resource: EmbracePerformanceResourceTiming): boolean {\n    const fetchStart =\n      typeof resource.fetchStart === 'number' ? resource.fetchStart : 0;\n    const responseEnd =\n      typeof resource.responseEnd === 'number' ? resource.responseEnd : 0;\n\n    return fetchStart > 0 && responseEnd > 0;\n  }\n\n  private _isCorsRestricted(\n    resource: EmbracePerformanceResourceTiming,\n  ): boolean {\n    return this._hasNoSizeData(resource) && this._hasTimingData(resource);\n  }\n\n  private _isFetchIncomplete(\n    resource: EmbracePerformanceResourceTiming,\n  ): boolean {\n    const fetchStart =\n      typeof resource.fetchStart === 'number' ? resource.fetchStart : 0;\n    const responseEnd =\n      typeof resource.responseEnd === 'number' ? resource.responseEnd : 0;\n\n    return this._hasNoSizeData(resource) && fetchStart > 0 && responseEnd === 0;\n  }\n\n  private _isFetchPrevented(\n    resource: EmbracePerformanceResourceTiming,\n  ): boolean {\n    const fetchStart =\n      typeof resource.fetchStart === 'number' ? resource.fetchStart : 0;\n\n    return this._hasNoSizeData(resource) && fetchStart === 0;\n  }\n\n  /**\n   * Detect cache validation (304 Not Modified responses)\n   *\n   * 304 responses show transferSize of ~300 bytes (headers only, no body).\n   * Use deliveryType to distinguish from cache hits: 'cache' = no network, otherwise = 304.\n   *\n   * Spec: https://w3c.github.io/resource-timing/#dom-performanceresourcetiming-transfersize\n   */\n  private _isCacheValidated(\n    resource: EmbracePerformanceResourceTiming,\n  ): boolean {\n    const transferSize =\n      typeof resource.transferSize === 'number' ? resource.transferSize : 0;\n    const deliveryType =\n      typeof resource.deliveryType === 'string' ? resource.deliveryType : '';\n\n    return transferSize === 300 && deliveryType !== 'cache';\n  }\n\n  /**\n   * Add diagnostic attributes to identify resource loading issues\n   *\n   * Diagnostic attributes help identify why resources may have incomplete timing data:\n   * - CORS restrictions (opaque responses without Timing-Allow-Origin header)\n   * - Cache revalidation (304 Not Modified responses)\n   * - Request incomplete (started but didn't complete - network error, aborted)\n   * - Request prevented (never started - blocked by CSP, browser, extension)\n   */\n  private _addResourceDiagnosticAttributes(\n    span: Span,\n    resource: EmbracePerformanceResourceTiming,\n  ): void {\n    if (this._isCorsRestricted(resource)) {\n      span.setAttribute(ATTR_HTTP_RESPONSE_CORS_OPAQUE, true);\n    } else if (this._isFetchIncomplete(resource)) {\n      span.setAttribute(ATTR_HTTP_REQUEST_INCOMPLETE, true);\n    } else if (this._isFetchPrevented(resource)) {\n      span.setAttribute(ATTR_HTTP_REQUEST_PREVENTED, true);\n    }\n\n    if (this._isCacheValidated(resource)) {\n      span.setAttribute(ATTR_HTTP_RESPONSE_CACHE_REVALIDATED, true);\n    }\n  }\n\n  public enable(): void {\n    window.removeEventListener('load', this._onDocumentLoaded);\n    this._waitForPageLo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