rittenhop-dev/versions/5.94.2/node_modules/@sentry/node/esm/integrations/http.js.map

1 line
60 KiB
Plaintext
Raw Normal View History

2024-09-23 19:40:12 -04:00
{"version":3,"file":"http.js","sources":["../../../src/integrations/http.ts"],"sourcesContent":["/* eslint-disable max-lines */\nimport type * as http from 'http';\nimport type * as https from 'https';\nimport type { Hub } from '@sentry/core';\nimport { defineIntegration, getIsolationScope, hasTracingEnabled } from '@sentry/core';\nimport {\n addBreadcrumb,\n getActiveSpan,\n getClient,\n getCurrentHub,\n getCurrentScope,\n getDynamicSamplingContextFromClient,\n getDynamicSamplingContextFromSpan,\n isSentryRequestUrl,\n setHttpStatus,\n spanToJSON,\n spanToTraceHeader,\n} from '@sentry/core';\nimport type {\n ClientOptions,\n EventProcessor,\n Integration,\n IntegrationFn,\n IntegrationFnResult,\n SanitizedRequestData,\n TracePropagationTargets,\n} from '@sentry/types';\nimport {\n LRUMap,\n dropUndefinedKeys,\n dynamicSamplingContextToSentryBaggageHeader,\n fill,\n generateSentryTraceHeader,\n logger,\n stringMatchesSomePattern,\n} from '@sentry/utils';\n\nimport type { NodeClient } from '../client';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { NODE_VERSION } from '../nodeVersion';\nimport type { NodeClientOptions } from '../types';\nimport type { RequestMethod, RequestMethodArgs, RequestOptions } from './utils/http';\nimport { cleanSpanDescription, extractRawUrl, extractUrl, normalizeRequestArgs } from './utils/http';\n\ninterface TracingOptions {\n /**\n * List of strings/regex controlling to which outgoing requests\n * the SDK will attach tracing headers.\n *\n * By default the SDK will attach those headers to all outgoing\n * requests. If this option is provided, the SDK will match the\n * request URL of outgoing requests against the items in this\n * array, and only attach tracing headers if a match was found.\n *\n * @deprecated Use top level `tracePropagationTargets` option instead.\n * This option will be removed in v8.\n *\n * ```\n * Sentry.init({\n * tracePropagationTargets: ['api.site.com'],\n * })\n */\n tracePropagationTargets?: TracePropagationTargets;\n\n /**\n * Function determining whether or not to create spans to track outgoing requests to the given URL.\n * By default, spans will be created for all outgoing requests.\n */\n shouldCreateSpanForRequest?: (url: string) => boolean;\n\n /**\n * This option is just for compatibility with v7.\n * In v8, this will be the default behavior.\n */\n enableIfHasTracingEnabled?: boolean;\n}\n\ninterface HttpOptions {\n /**\n * Whether breadcrumbs should be recorded for requests\n * Defaults to true\n */\n breadcrumbs?: boolean;\n\n /**\n * Whether tracing spans should be created for requests\n * Defaults to false\n */\n tracing?: TracingOptions | boolean;\n}\n\n/* These are the newer options for `httpIntegration`. */\ninterface HttpIntegrationOptions {\n /**\n * Whether breadcrumbs should be recorded for requests\n * Defaults to true.\n */\n breadcrumbs?: boolean;\n\n /**\n * Whether tracing spans should be created for requests\n * If not set, this will be enabled/disabled based on if tracing is enabled.\n */\n tracing?: boolean;\n\n /**\n * Function determining whether or not to create spans to track outgoing requests to the given URL.\n * By default, spans will be created for all outgoing requests.\n */\n shouldCreateSpanForRequest?: (url: string) => boolean;\n}\n\nconst _httpIntegration = ((options: HttpIntegrationOptions = {}) => {\n const { breadcrumbs, tracing, shouldCreateSpanForRequest } = options;\n\n const convertedOptions: HttpOptions = {\n breadcrumbs,\n tracing:\n tracing === false\n ? false\n : dropUndefinedKeys({\n // If tracing is forced to `true`, we don't want to set `enableIfHasTracingEnabled`\n enableIfHasTracingEnabled: tracing === true ? undefined : true,\n shouldCreateSpanForRequest,\n }),\n };\n\n // eslint-disable-next-line deprecation/deprecation\n return new Http(convertedOptions) as unknown as IntegrationFnResult;\n}) satisfies Integrati