@sentry/node 8.10.0 → 8.12.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/cjs/integrations/anr/index.js +1 -1
  2. package/cjs/integrations/anr/index.js.map +1 -1
  3. package/cjs/integrations/local-variables/local-variables-async.js +1 -1
  4. package/cjs/integrations/local-variables/local-variables-async.js.map +1 -1
  5. package/cjs/integrations/node-fetch.js +1 -1
  6. package/cjs/integrations/node-fetch.js.map +1 -1
  7. package/cjs/integrations/tracing/koa.js +1 -0
  8. package/cjs/integrations/tracing/koa.js.map +1 -1
  9. package/cjs/sdk/api.js +83 -13
  10. package/cjs/sdk/api.js.map +1 -1
  11. package/cjs/sdk/index.js +2 -0
  12. package/cjs/sdk/index.js.map +1 -1
  13. package/cjs/sdk/initOtel.js +5 -1
  14. package/cjs/sdk/initOtel.js.map +1 -1
  15. package/esm/integrations/anr/index.js +1 -1
  16. package/esm/integrations/anr/index.js.map +1 -1
  17. package/esm/integrations/anr/worker-script.js +2 -2
  18. package/esm/integrations/local-variables/local-variables-async.js +1 -1
  19. package/esm/integrations/local-variables/local-variables-async.js.map +1 -1
  20. package/esm/integrations/local-variables/worker-script.js +1 -1
  21. package/esm/integrations/node-fetch.js +1 -1
  22. package/esm/integrations/node-fetch.js.map +1 -1
  23. package/esm/integrations/tracing/koa.js +1 -0
  24. package/esm/integrations/tracing/koa.js.map +1 -1
  25. package/esm/sdk/api.js +83 -13
  26. package/esm/sdk/api.js.map +1 -1
  27. package/esm/sdk/index.js +2 -0
  28. package/esm/sdk/index.js.map +1 -1
  29. package/esm/sdk/initOtel.js +5 -1
  30. package/esm/sdk/initOtel.js.map +1 -1
  31. package/package.json +5 -5
  32. package/types/integrations/tracing/koa.d.ts.map +1 -1
  33. package/types/sdk/api.d.ts.map +1 -1
  34. package/types/sdk/index.d.ts +3 -2
  35. package/types/sdk/index.d.ts.map +1 -1
  36. package/types/sdk/initOtel.d.ts.map +1 -1
  37. package/types/types.d.ts +10 -0
  38. package/types/types.d.ts.map +1 -1
  39. package/types-ts3.8/sdk/index.d.ts +3 -2
  40. package/types-ts3.8/types.d.ts +10 -0
package/esm/sdk/api.js CHANGED
@@ -4,6 +4,7 @@ import { createGetModuleFromFilename } from '../utils/module.js';
4
4
  /**
5
5
  * Returns a release dynamically from environment variables.
6
6
  */
7
+ // eslint-disable-next-line complexity
7
8
  function getSentryRelease(fallback) {
8
9
  // Always read first as Sentry takes this as precedence
9
10
  if (process.env.SENTRY_RELEASE) {
@@ -15,22 +16,91 @@ function getSentryRelease(fallback) {
15
16
  return GLOBAL_OBJ.SENTRY_RELEASE.id;
16
17
  }
17
18
 
18
- return (
19
+ // This list is in approximate alpha order, separated into 3 categories:
20
+ // 1. Git providers
21
+ // 2. CI providers with specific environment variables (has the provider name in the variable name)
22
+ // 3. CI providers with generic environment variables (checked for last to prevent possible false positives)
23
+
24
+ const possibleReleaseNameOfGitProvider =
19
25
  // GitHub Actions - https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables
20
- process.env.GITHUB_SHA ||
21
- // Netlify - https://docs.netlify.com/configure-builds/environment-variables/#build-metadata
22
- process.env.COMMIT_REF ||
26
+ process.env['GITHUB_SHA'] ||
27
+ // GitLab CI - https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
28
+ process.env['CI_MERGE_REQUEST_SOURCE_BRANCH_SHA'] ||
29
+ process.env['CI_BUILD_REF'] ||
30
+ process.env['CI_COMMIT_SHA'] ||
31
+ // Bitbucket - https://support.atlassian.com/bitbucket-cloud/docs/variables-and-secrets/
32
+ process.env['BITBUCKET_COMMIT'];
33
+
34
+ const possibleReleaseNameOfCiProvidersWithSpecificEnvVar =
35
+ // AppVeyor - https://www.appveyor.com/docs/environment-variables/
36
+ process.env['APPVEYOR_PULL_REQUEST_HEAD_COMMIT'] ||
37
+ process.env['APPVEYOR_REPO_COMMIT'] ||
38
+ // AWS CodeBuild - https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html
39
+ process.env['CODEBUILD_RESOLVED_SOURCE_VERSION'] ||
40
+ // AWS Amplify - https://docs.aws.amazon.com/amplify/latest/userguide/environment-variables.html
41
+ process.env['AWS_COMMIT_ID'] ||
42
+ // Azure Pipelines - https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml
43
+ process.env['BUILD_SOURCEVERSION'] ||
44
+ // Bitrise - https://devcenter.bitrise.io/builds/available-environment-variables/
45
+ process.env['GIT_CLONE_COMMIT_HASH'] ||
46
+ // Buddy CI - https://buddy.works/docs/pipelines/environment-variables#default-environment-variables
47
+ process.env['BUDDY_EXECUTION_REVISION'] ||
48
+ // Builtkite - https://buildkite.com/docs/pipelines/environment-variables
49
+ process.env['BUILDKITE_COMMIT'] ||
50
+ // CircleCI - https://circleci.com/docs/variables/
51
+ process.env['CIRCLE_SHA1'] ||
52
+ // Cirrus CI - https://cirrus-ci.org/guide/writing-tasks/#environment-variables
53
+ process.env['CIRRUS_CHANGE_IN_REPO'] ||
54
+ // Codefresh - https://codefresh.io/docs/docs/codefresh-yaml/variables/
55
+ process.env['CF_REVISION'] ||
56
+ // Codemagic - https://docs.codemagic.io/yaml-basic-configuration/environment-variables/
57
+ process.env['CM_COMMIT'] ||
58
+ // Cloudflare Pages - https://developers.cloudflare.com/pages/platform/build-configuration/#environment-variables
59
+ process.env['CF_PAGES_COMMIT_SHA'] ||
60
+ // Drone - https://docs.drone.io/pipeline/environment/reference/
61
+ process.env['DRONE_COMMIT_SHA'] ||
62
+ // Flightcontrol - https://www.flightcontrol.dev/docs/guides/flightcontrol/environment-variables#built-in-environment-variables
63
+ process.env['FC_GIT_COMMIT_SHA'] ||
64
+ // Heroku #1 https://devcenter.heroku.com/articles/heroku-ci
65
+ process.env['HEROKU_TEST_RUN_COMMIT_VERSION'] ||
66
+ // Heroku #2 https://docs.sentry.io/product/integrations/deployment/heroku/#configure-releases
67
+ process.env['HEROKU_SLUG_COMMIT'] ||
68
+ // Render - https://render.com/docs/environment-variables
69
+ process.env['RENDER_GIT_COMMIT'] ||
70
+ // Semaphore CI - https://docs.semaphoreci.com/ci-cd-environment/environment-variables
71
+ process.env['SEMAPHORE_GIT_SHA'] ||
72
+ // TravisCI - https://docs.travis-ci.com/user/environment-variables/#default-environment-variables
73
+ process.env['TRAVIS_PULL_REQUEST_SHA'] ||
23
74
  // Vercel - https://vercel.com/docs/v2/build-step#system-environment-variables
24
- process.env.VERCEL_GIT_COMMIT_SHA ||
25
- process.env.VERCEL_GITHUB_COMMIT_SHA ||
26
- process.env.VERCEL_GITLAB_COMMIT_SHA ||
27
- process.env.VERCEL_BITBUCKET_COMMIT_SHA ||
75
+ process.env['VERCEL_GIT_COMMIT_SHA'] ||
76
+ process.env['VERCEL_GITHUB_COMMIT_SHA'] ||
77
+ process.env['VERCEL_GITLAB_COMMIT_SHA'] ||
78
+ process.env['VERCEL_BITBUCKET_COMMIT_SHA'] ||
28
79
  // Zeit (now known as Vercel)
29
- process.env.ZEIT_GITHUB_COMMIT_SHA ||
30
- process.env.ZEIT_GITLAB_COMMIT_SHA ||
31
- process.env.ZEIT_BITBUCKET_COMMIT_SHA ||
32
- // Cloudflare Pages - https://developers.cloudflare.com/pages/platform/build-configuration/#environment-variables
33
- process.env.CF_PAGES_COMMIT_SHA ||
80
+ process.env['ZEIT_GITHUB_COMMIT_SHA'] ||
81
+ process.env['ZEIT_GITLAB_COMMIT_SHA'] ||
82
+ process.env['ZEIT_BITBUCKET_COMMIT_SHA'];
83
+
84
+ const possibleReleaseNameOfCiProvidersWithGenericEnvVar =
85
+ // CloudBees CodeShip - https://docs.cloudbees.com/docs/cloudbees-codeship/latest/pro-builds-and-configuration/environment-variables
86
+ process.env['CI_COMMIT_ID'] ||
87
+ // Coolify - https://coolify.io/docs/knowledge-base/environment-variables
88
+ process.env['SOURCE_COMMIT'] ||
89
+ // Heroku #3 https://devcenter.heroku.com/changelog-items/630
90
+ process.env['SOURCE_VERSION'] ||
91
+ // Jenkins - https://plugins.jenkins.io/git/#environment-variables
92
+ process.env['GIT_COMMIT'] ||
93
+ // Netlify - https://docs.netlify.com/configure-builds/environment-variables/#build-metadata
94
+ process.env['COMMIT_REF'] ||
95
+ // TeamCity - https://www.jetbrains.com/help/teamcity/predefined-build-parameters.html
96
+ process.env['BUILD_VCS_NUMBER'] ||
97
+ // Woodpecker CI - https://woodpecker-ci.org/docs/usage/environment
98
+ process.env['CI_COMMIT_SHA'];
99
+
100
+ return (
101
+ possibleReleaseNameOfGitProvider ||
102
+ possibleReleaseNameOfCiProvidersWithSpecificEnvVar ||
103
+ possibleReleaseNameOfCiProvidersWithGenericEnvVar ||
34
104
  fallback
35
105
  );
36
106
  }
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sources":["../../../src/sdk/api.ts"],"sourcesContent":["// PUBLIC APIS\n\nimport type { StackParser } from '@sentry/types';\nimport { GLOBAL_OBJ, createStackParser, nodeStackLineParser } from '@sentry/utils';\nimport { createGetModuleFromFilename } from '../utils/module';\n\n/**\n * Returns a release dynamically from environment variables.\n */\nexport function getSentryRelease(fallback?: string): string | undefined {\n // Always read first as Sentry takes this as precedence\n if (process.env.SENTRY_RELEASE) {\n return process.env.SENTRY_RELEASE;\n }\n\n // This supports the variable that sentry-webpack-plugin injects\n if (GLOBAL_OBJ.SENTRY_RELEASE && GLOBAL_OBJ.SENTRY_RELEASE.id) {\n return GLOBAL_OBJ.SENTRY_RELEASE.id;\n }\n\n return (\n // GitHub Actions - https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables\n process.env.GITHUB_SHA ||\n // Netlify - https://docs.netlify.com/configure-builds/environment-variables/#build-metadata\n process.env.COMMIT_REF ||\n // Vercel - https://vercel.com/docs/v2/build-step#system-environment-variables\n process.env.VERCEL_GIT_COMMIT_SHA ||\n process.env.VERCEL_GITHUB_COMMIT_SHA ||\n process.env.VERCEL_GITLAB_COMMIT_SHA ||\n process.env.VERCEL_BITBUCKET_COMMIT_SHA ||\n // Zeit (now known as Vercel)\n process.env.ZEIT_GITHUB_COMMIT_SHA ||\n process.env.ZEIT_GITLAB_COMMIT_SHA ||\n process.env.ZEIT_BITBUCKET_COMMIT_SHA ||\n // Cloudflare Pages - https://developers.cloudflare.com/pages/platform/build-configuration/#environment-variables\n process.env.CF_PAGES_COMMIT_SHA ||\n fallback\n );\n}\n\n/** Node.js stack parser */\nexport const defaultStackParser: StackParser = createStackParser(nodeStackLineParser(createGetModuleFromFilename()));\n"],"names":[],"mappings":";;;AAMA;AACA;AACA;AACO,SAAS,gBAAgB,CAAC,QAAQ,EAA+B;AACxE;AACA,EAAE,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE;AAClC,IAAI,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,CAAA;AACrC,GAAE;AACF;AACA;AACA,EAAE,IAAI,UAAU,CAAC,cAAA,IAAkB,UAAU,CAAC,cAAc,CAAC,EAAE,EAAE;AACjE,IAAI,OAAO,UAAU,CAAC,cAAc,CAAC,EAAE,CAAA;AACvC,GAAE;AACF;AACA,EAAE;AACF;AACA,IAAI,OAAO,CAAC,GAAG,CAAC,UAAW;AAC3B;AACA,IAAI,OAAO,CAAC,GAAG,CAAC,UAAW;AAC3B;AACA,IAAI,OAAO,CAAC,GAAG,CAAC,qBAAsB;AACtC,IAAI,OAAO,CAAC,GAAG,CAAC,wBAAyB;AACzC,IAAI,OAAO,CAAC,GAAG,CAAC,wBAAyB;AACzC,IAAI,OAAO,CAAC,GAAG,CAAC,2BAA4B;AAC5C;AACA,IAAI,OAAO,CAAC,GAAG,CAAC,sBAAuB;AACvC,IAAI,OAAO,CAAC,GAAG,CAAC,sBAAuB;AACvC,IAAI,OAAO,CAAC,GAAG,CAAC,yBAA0B;AAC1C;AACA,IAAI,OAAO,CAAC,GAAG,CAAC,mBAAoB;AACpC,IAAI,QAAA;AACJ,IAAG;AACH,CAAA;AACA;AACA;AACa,MAAA,kBAAkB,GAAgB,iBAAiB,CAAC,mBAAmB,CAAC,2BAA2B,EAAE,CAAC;;;;"}
1
+ {"version":3,"file":"api.js","sources":["../../../src/sdk/api.ts"],"sourcesContent":["// PUBLIC APIS\n\nimport type { StackParser } from '@sentry/types';\nimport { GLOBAL_OBJ, createStackParser, nodeStackLineParser } from '@sentry/utils';\nimport { createGetModuleFromFilename } from '../utils/module';\n\n/**\n * Returns a release dynamically from environment variables.\n */\n// eslint-disable-next-line complexity\nexport function getSentryRelease(fallback?: string): string | undefined {\n // Always read first as Sentry takes this as precedence\n if (process.env.SENTRY_RELEASE) {\n return process.env.SENTRY_RELEASE;\n }\n\n // This supports the variable that sentry-webpack-plugin injects\n if (GLOBAL_OBJ.SENTRY_RELEASE && GLOBAL_OBJ.SENTRY_RELEASE.id) {\n return GLOBAL_OBJ.SENTRY_RELEASE.id;\n }\n\n // This list is in approximate alpha order, separated into 3 categories:\n // 1. Git providers\n // 2. CI providers with specific environment variables (has the provider name in the variable name)\n // 3. CI providers with generic environment variables (checked for last to prevent possible false positives)\n\n const possibleReleaseNameOfGitProvider =\n // GitHub Actions - https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables\n process.env['GITHUB_SHA'] ||\n // GitLab CI - https://docs.gitlab.com/ee/ci/variables/predefined_variables.html\n process.env['CI_MERGE_REQUEST_SOURCE_BRANCH_SHA'] ||\n process.env['CI_BUILD_REF'] ||\n process.env['CI_COMMIT_SHA'] ||\n // Bitbucket - https://support.atlassian.com/bitbucket-cloud/docs/variables-and-secrets/\n process.env['BITBUCKET_COMMIT'];\n\n const possibleReleaseNameOfCiProvidersWithSpecificEnvVar =\n // AppVeyor - https://www.appveyor.com/docs/environment-variables/\n process.env['APPVEYOR_PULL_REQUEST_HEAD_COMMIT'] ||\n process.env['APPVEYOR_REPO_COMMIT'] ||\n // AWS CodeBuild - https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html\n process.env['CODEBUILD_RESOLVED_SOURCE_VERSION'] ||\n // AWS Amplify - https://docs.aws.amazon.com/amplify/latest/userguide/environment-variables.html\n process.env['AWS_COMMIT_ID'] ||\n // Azure Pipelines - https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml\n process.env['BUILD_SOURCEVERSION'] ||\n // Bitrise - https://devcenter.bitrise.io/builds/available-environment-variables/\n process.env['GIT_CLONE_COMMIT_HASH'] ||\n // Buddy CI - https://buddy.works/docs/pipelines/environment-variables#default-environment-variables\n process.env['BUDDY_EXECUTION_REVISION'] ||\n // Builtkite - https://buildkite.com/docs/pipelines/environment-variables\n process.env['BUILDKITE_COMMIT'] ||\n // CircleCI - https://circleci.com/docs/variables/\n process.env['CIRCLE_SHA1'] ||\n // Cirrus CI - https://cirrus-ci.org/guide/writing-tasks/#environment-variables\n process.env['CIRRUS_CHANGE_IN_REPO'] ||\n // Codefresh - https://codefresh.io/docs/docs/codefresh-yaml/variables/\n process.env['CF_REVISION'] ||\n // Codemagic - https://docs.codemagic.io/yaml-basic-configuration/environment-variables/\n process.env['CM_COMMIT'] ||\n // Cloudflare Pages - https://developers.cloudflare.com/pages/platform/build-configuration/#environment-variables\n process.env['CF_PAGES_COMMIT_SHA'] ||\n // Drone - https://docs.drone.io/pipeline/environment/reference/\n process.env['DRONE_COMMIT_SHA'] ||\n // Flightcontrol - https://www.flightcontrol.dev/docs/guides/flightcontrol/environment-variables#built-in-environment-variables\n process.env['FC_GIT_COMMIT_SHA'] ||\n // Heroku #1 https://devcenter.heroku.com/articles/heroku-ci\n process.env['HEROKU_TEST_RUN_COMMIT_VERSION'] ||\n // Heroku #2 https://docs.sentry.io/product/integrations/deployment/heroku/#configure-releases\n process.env['HEROKU_SLUG_COMMIT'] ||\n // Render - https://render.com/docs/environment-variables\n process.env['RENDER_GIT_COMMIT'] ||\n // Semaphore CI - https://docs.semaphoreci.com/ci-cd-environment/environment-variables\n process.env['SEMAPHORE_GIT_SHA'] ||\n // TravisCI - https://docs.travis-ci.com/user/environment-variables/#default-environment-variables\n process.env['TRAVIS_PULL_REQUEST_SHA'] ||\n // Vercel - https://vercel.com/docs/v2/build-step#system-environment-variables\n process.env['VERCEL_GIT_COMMIT_SHA'] ||\n process.env['VERCEL_GITHUB_COMMIT_SHA'] ||\n process.env['VERCEL_GITLAB_COMMIT_SHA'] ||\n process.env['VERCEL_BITBUCKET_COMMIT_SHA'] ||\n // Zeit (now known as Vercel)\n process.env['ZEIT_GITHUB_COMMIT_SHA'] ||\n process.env['ZEIT_GITLAB_COMMIT_SHA'] ||\n process.env['ZEIT_BITBUCKET_COMMIT_SHA'];\n\n const possibleReleaseNameOfCiProvidersWithGenericEnvVar =\n // CloudBees CodeShip - https://docs.cloudbees.com/docs/cloudbees-codeship/latest/pro-builds-and-configuration/environment-variables\n process.env['CI_COMMIT_ID'] ||\n // Coolify - https://coolify.io/docs/knowledge-base/environment-variables\n process.env['SOURCE_COMMIT'] ||\n // Heroku #3 https://devcenter.heroku.com/changelog-items/630\n process.env['SOURCE_VERSION'] ||\n // Jenkins - https://plugins.jenkins.io/git/#environment-variables\n process.env['GIT_COMMIT'] ||\n // Netlify - https://docs.netlify.com/configure-builds/environment-variables/#build-metadata\n process.env['COMMIT_REF'] ||\n // TeamCity - https://www.jetbrains.com/help/teamcity/predefined-build-parameters.html\n process.env['BUILD_VCS_NUMBER'] ||\n // Woodpecker CI - https://woodpecker-ci.org/docs/usage/environment\n process.env['CI_COMMIT_SHA'];\n\n return (\n possibleReleaseNameOfGitProvider ||\n possibleReleaseNameOfCiProvidersWithSpecificEnvVar ||\n possibleReleaseNameOfCiProvidersWithGenericEnvVar ||\n fallback\n );\n}\n\n/** Node.js stack parser */\nexport const defaultStackParser: StackParser = createStackParser(nodeStackLineParser(createGetModuleFromFilename()));\n"],"names":[],"mappings":";;;AAMA;AACA;AACA;AACA;AACO,SAAS,gBAAgB,CAAC,QAAQ,EAA+B;AACxE;AACA,EAAE,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc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C,CAAA;AAChC;AACA,EAAE;AACF,IAAI,gCAAiC;AACrC,IAAI,kDAAmD;AACvD,IAAI,iDAAkD;AACtD,IAAI,QAAA;AACJ,IAAG;AACH,CAAA;AACA;AACA;AACa,MAAA,kBAAkB,GAAgB,iBAAiB,CAAC,mBAAmB,CAAC,2BAA2B,EAAE,CAAC;;;;"}
package/esm/sdk/index.js CHANGED
@@ -152,6 +152,8 @@ function _init(
152
152
 
153
153
  enhanceDscWithOpenTelemetryRootSpanName(client);
154
154
  setupEventContextTrace(client);
155
+
156
+ return client;
155
157
  }
156
158
 
157
159
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/sdk/index.ts"],"sourcesContent":["import {\n endSession,\n functionToStringIntegration,\n getClient,\n getCurrentScope,\n getIntegrationsToSetup,\n getIsolationScope,\n hasTracingEnabled,\n inboundFiltersIntegration,\n linkedErrorsIntegration,\n requestDataIntegration,\n startSession,\n} from '@sentry/core';\nimport {\n enhanceDscWithOpenTelemetryRootSpanName,\n openTelemetrySetupCheck,\n setOpenTelemetryContextAsyncContextStrategy,\n setupEventContextTrace,\n} from '@sentry/opentelemetry';\nimport type { Client, Integration, Options } from '@sentry/types';\nimport {\n consoleSandbox,\n dropUndefinedKeys,\n logger,\n propagationContextFromHeaders,\n stackParserFromStackParserOptions,\n} from '@sentry/utils';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { consoleIntegration } from '../integrations/console';\nimport { nodeContextIntegration } from '../integrations/context';\nimport { contextLinesIntegration } from '../integrations/contextlines';\n\nimport { httpIntegration } from '../integrations/http';\nimport { localVariablesIntegration } from '../integrations/local-variables';\nimport { modulesIntegration } from '../integrations/modules';\nimport { nativeNodeFetchIntegration } from '../integrations/node-fetch';\nimport { onUncaughtExceptionIntegration } from '../integrations/onuncaughtexception';\nimport { onUnhandledRejectionIntegration } from '../integrations/onunhandledrejection';\nimport { spotlightIntegration } from '../integrations/spotlight';\nimport { getAutoPerformanceIntegrations } from '../integrations/tracing';\nimport { makeNodeTransport } from '../transports';\nimport type { NodeClientOptions, NodeOptions } from '../types';\nimport { isCjs } from '../utils/commonjs';\nimport { defaultStackParser, getSentryRelease } from './api';\nimport { NodeClient } from './client';\nimport { initOpenTelemetry, maybeInitializeEsmLoader } from './initOtel';\n\nfunction getCjsOnlyIntegrations(): Integration[] {\n return isCjs() ? [modulesIntegration()] : [];\n}\n\n/**\n * Get default integrations, excluding performance.\n */\nexport function getDefaultIntegrationsWithoutPerformance(): Integration[] {\n return [\n // Common\n inboundFiltersIntegration(),\n functionToStringIntegration(),\n linkedErrorsIntegration(),\n requestDataIntegration(),\n // Native Wrappers\n consoleIntegration(),\n httpIntegration(),\n nativeNodeFetchIntegration(),\n // Global Handlers\n onUncaughtExceptionIntegration(),\n onUnhandledRejectionIntegration(),\n // Event Info\n contextLinesIntegration(),\n localVariablesIntegration(),\n nodeContextIntegration(),\n ...getCjsOnlyIntegrations(),\n ];\n}\n\n/** Get the default integrations for the Node SDK. */\nexport function getDefaultIntegrations(options: Options): Integration[] {\n return [\n ...getDefaultIntegrationsWithoutPerformance(),\n // We only add performance integrations if tracing is enabled\n // Note that this means that without tracing enabled, e.g. `expressIntegration()` will not be added\n // This means that generally request isolation will work (because that is done by httpIntegration)\n // But `transactionName` will not be set automatically\n ...(shouldAddPerformanceIntegrations(options) ? getAutoPerformanceIntegrations() : []),\n ];\n}\n\nfunction shouldAddPerformanceIntegrations(options: Options): boolean {\n if (!hasTracingEnabled(options)) {\n return false;\n }\n\n // We want to ensure `tracesSampleRate` is not just undefined/null here\n return options.enableTracing || options.tracesSampleRate != null || 'tracesSampler' in options;\n}\n\n/**\n * Initialize Sentry for Node.\n */\nexport function init(options: NodeOptions | undefined = {}): void {\n return _init(options, getDefaultIntegrations);\n}\n\n/**\n * Initialize Sentry for Node, without any integrations added by default.\n */\nexport function initWithoutDefaultIntegrations(options: NodeOptions | undefined = {}): void {\n return _init(options, () => []);\n}\n\n/**\n * Initialize Sentry for Node, without performance instrumentation.\n */\nfunction _init(\n options: NodeOptions | undefined = {},\n getDefaultIntegrationsImpl: (options: Options) => Integration[],\n): void {\n const clientOptions = getClientOptions(options, getDefaultIntegrationsImpl);\n\n if (clientOptions.debug === true) {\n if (DEBUG_BUILD) {\n logger.enable();\n } else {\n // use `console.warn` rather than `logger.warn` since by non-debug bundles have all `logger.x` statements stripped\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn('[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.');\n });\n }\n }\n\n if (!isCjs()) {\n maybeInitializeEsmLoader();\n }\n\n setOpenTelemetryContextAsyncContextStrategy();\n\n const scope = getCurrentScope();\n scope.update(options.initialScope);\n\n const client = new NodeClient(clientOptions);\n // The client is on the current scope, from where it generally is inherited\n getCurrentScope().setClient(client);\n\n if (isEnabled(client)) {\n client.init();\n }\n\n logger.log(`Running in ${isCjs() ? 'CommonJS' : 'ESM'} mode.`);\n\n if (options.autoSessionTracking) {\n startSessionTracking();\n }\n\n updateScopeFromEnvVariables();\n\n if (options.spotlight) {\n // force integrations to be setup even if no DSN was set\n // If they have already been added before, they will be ignored anyhow\n const integrations = client.getOptions().integrations;\n for (const integration of integrations) {\n client.addIntegration(integration);\n }\n client.addIntegration(\n spotlightIntegration({\n sidecarUrl: typeof options.spotlight === 'string' ? options.spotlight : undefined,\n }),\n );\n }\n\n // If users opt-out of this, they _have_ to set up OpenTelemetry themselves\n // There is no way to use this SDK without OpenTelemetry!\n if (!options.skipOpenTelemetrySetup) {\n initOpenTelemetry(client);\n validateOpenTelemetrySetup();\n }\n\n enhanceDscWithOpenTelemetryRootSpanName(client);\n setupEventContextTrace(client);\n}\n\n/**\n * Validate that your OpenTelemetry setup is correct.\n */\nexport function validateOpenTelemetrySetup(): void {\n if (!DEBUG_BUILD) {\n return;\n }\n\n const setup = openTelemetrySetupCheck();\n\n const required = ['SentrySpanProcessor', 'SentryContextManager', 'SentryPropagator'] as const;\n for (const k of required) {\n if (!setup.includes(k)) {\n logger.error(\n `You have to set up the ${k}. Without this, the OpenTelemetry & Sentry integration will not work properly.`,\n );\n }\n }\n\n if (!setup.includes('SentrySampler')) {\n logger.warn(\n 'You have to set up the SentrySampler. Without this, the OpenTelemetry & Sentry integration may still work, but sample rates set for the Sentry SDK will not be respected.',\n );\n }\n}\n\nfunction getClientOptions(\n options: NodeOptions,\n getDefaultIntegrationsImpl: (options: Options) => Integration[],\n): NodeClientOptions {\n const release = getRelease(options.release);\n\n const autoSessionTracking =\n typeof release !== 'string'\n ? false\n : options.autoSessionTracking === undefined\n ? true\n : options.autoSessionTracking;\n\n const tracesSampleRate = getTracesSampleRate(options.tracesSampleRate);\n\n const baseOptions = dropUndefinedKeys({\n transport: makeNodeTransport,\n dsn: process.env.SENTRY_DSN,\n environment: process.env.SENTRY_ENVIRONMENT,\n });\n\n const overwriteOptions = dropUndefinedKeys({\n release,\n autoSessionTracking,\n tracesSampleRate,\n });\n\n const mergedOptions = {\n ...baseOptions,\n ...options,\n ...overwriteOptions,\n };\n\n if (options.defaultIntegrations === undefined) {\n options.defaultIntegrations = getDefaultIntegrationsImpl(mergedOptions);\n }\n\n const clientOptions: NodeClientOptions = {\n ...mergedOptions,\n stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),\n integrations: getIntegrationsToSetup({\n defaultIntegrations: options.defaultIntegrations,\n integrations: options.integrations,\n }),\n };\n\n return clientOptions;\n}\n\nfunction getRelease(release: NodeOptions['release']): string | undefined {\n if (release !== undefined) {\n return release;\n }\n\n const detectedRelease = getSentryRelease();\n if (detectedRelease !== undefined) {\n return detectedRelease;\n }\n\n return undefined;\n}\n\nfunction getTracesSampleRate(tracesSampleRate: NodeOptions['tracesSampleRate']): number | undefined {\n if (tracesSampleRate !== undefined) {\n return tracesSampleRate;\n }\n\n const sampleRateFromEnv = process.env.SENTRY_TRACES_SAMPLE_RATE;\n if (!sampleRateFromEnv) {\n return undefined;\n }\n\n const parsed = parseFloat(sampleRateFromEnv);\n return isFinite(parsed) ? parsed : undefined;\n}\n\n/**\n * Update scope and propagation context based on environmental variables.\n *\n * See https://github.com/getsentry/rfcs/blob/main/text/0071-continue-trace-over-process-boundaries.md\n * for more details.\n */\nfunction updateScopeFromEnvVariables(): void {\n const sentryUseEnvironment = (process.env.SENTRY_USE_ENVIRONMENT || '').toLowerCase();\n if (!['false', 'n', 'no', 'off', '0'].includes(sentryUseEnvironment)) {\n const sentryTraceEnv = process.env.SENTRY_TRACE;\n const baggageEnv = process.env.SENTRY_BAGGAGE;\n const propagationContext = propagationContextFromHeaders(sentryTraceEnv, baggageEnv);\n getCurrentScope().setPropagationContext(propagationContext);\n }\n}\n\n/**\n * Enable automatic Session Tracking for the node process.\n */\nfunction startSessionTracking(): void {\n const client = getClient<NodeClient>();\n if (client && client.getOptions().autoSessionTracking) {\n client.initSessionFlusher();\n }\n\n startSession();\n\n // Emitted in the case of healthy sessions, error of `mechanism.handled: true` and unhandledrejections because\n // The 'beforeExit' event is not emitted for conditions causing explicit termination,\n // such as calling process.exit() or uncaught exceptions.\n // Ref: https://nodejs.org/api/process.html#process_event_beforeexit\n process.on('beforeExit', () => {\n const session = getIsolationScope().getSession();\n\n // Only call endSession, if the Session exists on Scope and SessionStatus is not a\n // Terminal Status i.e. Exited or Crashed because\n // \"When a session is moved away from ok it must not be updated anymore.\"\n // Ref: https://develop.sentry.dev/sdk/sessions/\n if (session && session.status !== 'ok') {\n endSession();\n }\n });\n}\n\nfunction isEnabled(client: Client): boolean {\n return client.getOptions().enabled !== false && client.getTransport() !== undefined;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AA+CA,SAAS,sBAAsB,GAAkB;AACjD,EAAE,OAAO,KAAK,EAAC,GAAI,CAAC,kBAAkB,EAAE,CAAA,GAAI,EAAE,CAAA;AAC9C,CAAA;AACA;AACA;AACA;AACA;AACO,SAAS,wCAAwC,GAAkB;AAC1E,EAAE,OAAO;AACT;AACA,IAAI,yBAAyB,EAAE;AAC/B,IAAI,2BAA2B,EA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OAAO,CAAC,GAAG,CAAC,YAAY,CAAA;AACnD,IAAI,MAAM,UAAW,GAAE,OAAO,CAAC,GAAG,CAAC,cAAc,CAAA;AACjD,IAAI,MAAM,qBAAqB,6BAA6B,CAAC,cAAc,EAAE,UAAU,CAAC,CAAA;AACxF,IAAI,eAAe,EAAE,CAAC,qBAAqB,CAAC,kBAAkB,CAAC,CAAA;AAC/D,GAAE;AACF,CAAA;AACA;AACA;AACA;AACA;AACA,SAAS,oBAAoB,GAAS;AACtC,EAAE,MAAM,MAAA,GAAS,SAAS,EAAc,CAAA;AACxC,EAAE,IAAI,MAAA,IAAU,MAAM,CAAC,UAAU,EAAE,CAAC,mBAAmB,EAAE;AACzD,IAAI,MAAM,CAAC,kBAAkB,EAAE,CAAA;AAC/B,GAAE;AACF;AACA,EAAE,YAAY,EAAE,CAAA;AAChB;AACA;AACA;AACA;AACA;AACA,EAAE,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM;AACjC,IAAI,MAAM,UAAU,iBAAiB,EAAE,CAAC,UAAU,EAAE,CAAA;AACpD;AACA;AACA;AACA;AACA;AACA,IAAI,IAAI,OAAQ,IAAG,OAAO,CAAC,MAAA,KAAW,IAAI,EAAE;AAC5C,MAAM,UAAU,EAAE,CAAA;AAClB,KAAI;AACJ,GAAG,CAAC,CAAA;AACJ,CAAA;AACA;AACA,SAAS,SAAS,CAAC,MAAM,EAAmB;AAC5C,EAAE,OAAO,MAAM,CAAC,UAAU,EAAE,CAAC,OAAA,KAAY,KAAA,IAAS,MAAM,CAAC,YAAY,EAAC,KAAM,SAAS,CAAA;AACrF;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/sdk/index.ts"],"sourcesContent":["import {\n endSession,\n functionToStringIntegration,\n getClient,\n getCurrentScope,\n getIntegrationsToSetup,\n getIsolationScope,\n hasTracingEnabled,\n inboundFiltersIntegration,\n linkedErrorsIntegration,\n requestDataIntegration,\n startSession,\n} from '@sentry/core';\nimport {\n enhanceDscWithOpenTelemetryRootSpanName,\n openTelemetrySetupCheck,\n setOpenTelemetryContextAsyncContextStrategy,\n setupEventContextTrace,\n} from '@sentry/opentelemetry';\nimport type { Client, Integration, Options } from '@sentry/types';\nimport {\n consoleSandbox,\n dropUndefinedKeys,\n logger,\n propagationContextFromHeaders,\n stackParserFromStackParserOptions,\n} from '@sentry/utils';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { consoleIntegration } from '../integrations/console';\nimport { nodeContextIntegration } from '../integrations/context';\nimport { contextLinesIntegration } from '../integrations/contextlines';\n\nimport { httpIntegration } from '../integrations/http';\nimport { localVariablesIntegration } from '../integrations/local-variables';\nimport { modulesIntegration } from '../integrations/modules';\nimport { nativeNodeFetchIntegration } from '../integrations/node-fetch';\nimport { onUncaughtExceptionIntegration } from '../integrations/onuncaughtexception';\nimport { onUnhandledRejectionIntegration } from '../integrations/onunhandledrejection';\nimport { spotlightIntegration } from '../integrations/spotlight';\nimport { getAutoPerformanceIntegrations } from '../integrations/tracing';\nimport { makeNodeTransport } from '../transports';\nimport type { NodeClientOptions, NodeOptions } from '../types';\nimport { isCjs } from '../utils/commonjs';\nimport { defaultStackParser, getSentryRelease } from './api';\nimport { NodeClient } from './client';\nimport { initOpenTelemetry, maybeInitializeEsmLoader } from './initOtel';\n\nfunction getCjsOnlyIntegrations(): Integration[] {\n return isCjs() ? [modulesIntegration()] : [];\n}\n\n/**\n * Get default integrations, excluding performance.\n */\nexport function getDefaultIntegrationsWithoutPerformance(): Integration[] {\n return [\n // Common\n inboundFiltersIntegration(),\n functionToStringIntegration(),\n linkedErrorsIntegration(),\n requestDataIntegration(),\n // Native Wrappers\n consoleIntegration(),\n httpIntegration(),\n nativeNodeFetchIntegration(),\n // Global Handlers\n onUncaughtExceptionIntegration(),\n onUnhandledRejectionIntegration(),\n // Event Info\n contextLinesIntegration(),\n localVariablesIntegration(),\n nodeContextIntegration(),\n ...getCjsOnlyIntegrations(),\n ];\n}\n\n/** Get the default integrations for the Node SDK. */\nexport function getDefaultIntegrations(options: Options): Integration[] {\n return [\n ...getDefaultIntegrationsWithoutPerformance(),\n // We only add performance integrations if tracing is enabled\n // Note that this means that without tracing enabled, e.g. `expressIntegration()` will not be added\n // This means that generally request isolation will work (because that is done by httpIntegration)\n // But `transactionName` will not be set automatically\n ...(shouldAddPerformanceIntegrations(options) ? getAutoPerformanceIntegrations() : []),\n ];\n}\n\nfunction shouldAddPerformanceIntegrations(options: Options): boolean {\n if (!hasTracingEnabled(options)) {\n return false;\n }\n\n // We want to ensure `tracesSampleRate` is not just undefined/null here\n return options.enableTracing || options.tracesSampleRate != null || 'tracesSampler' in options;\n}\n\n/**\n * Initialize Sentry for Node.\n */\nexport function init(options: NodeOptions | undefined = {}): NodeClient | undefined {\n return _init(options, getDefaultIntegrations);\n}\n\n/**\n * Initialize Sentry for Node, without any integrations added by default.\n */\nexport function initWithoutDefaultIntegrations(options: NodeOptions | undefined = {}): NodeClient {\n return _init(options, () => []);\n}\n\n/**\n * Initialize Sentry for Node, without performance instrumentation.\n */\nfunction _init(\n options: NodeOptions | undefined = {},\n getDefaultIntegrationsImpl: (options: Options) => Integration[],\n): NodeClient {\n const clientOptions = getClientOptions(options, getDefaultIntegrationsImpl);\n\n if (clientOptions.debug === true) {\n if (DEBUG_BUILD) {\n logger.enable();\n } else {\n // use `console.warn` rather than `logger.warn` since by non-debug bundles have all `logger.x` statements stripped\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn('[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.');\n });\n }\n }\n\n if (!isCjs()) {\n maybeInitializeEsmLoader();\n }\n\n setOpenTelemetryContextAsyncContextStrategy();\n\n const scope = getCurrentScope();\n scope.update(options.initialScope);\n\n const client = new NodeClient(clientOptions);\n // The client is on the current scope, from where it generally is inherited\n getCurrentScope().setClient(client);\n\n if (isEnabled(client)) {\n client.init();\n }\n\n logger.log(`Running in ${isCjs() ? 'CommonJS' : 'ESM'} mode.`);\n\n if (options.autoSessionTracking) {\n startSessionTracking();\n }\n\n updateScopeFromEnvVariables();\n\n if (options.spotlight) {\n // force integrations to be setup even if no DSN was set\n // If they have already been added before, they will be ignored anyhow\n const integrations = client.getOptions().integrations;\n for (const integration of integrations) {\n client.addIntegration(integration);\n }\n client.addIntegration(\n spotlightIntegration({\n sidecarUrl: typeof options.spotlight === 'string' ? options.spotlight : undefined,\n }),\n );\n }\n\n // If users opt-out of this, they _have_ to set up OpenTelemetry themselves\n // There is no way to use this SDK without OpenTelemetry!\n if (!options.skipOpenTelemetrySetup) {\n initOpenTelemetry(client);\n validateOpenTelemetrySetup();\n }\n\n enhanceDscWithOpenTelemetryRootSpanName(client);\n setupEventContextTrace(client);\n\n return client;\n}\n\n/**\n * Validate that your OpenTelemetry setup is correct.\n */\nexport function validateOpenTelemetrySetup(): void {\n if (!DEBUG_BUILD) {\n return;\n }\n\n const setup = openTelemetrySetupCheck();\n\n const required = ['SentrySpanProcessor', 'SentryContextManager', 'SentryPropagator'] as const;\n for (const k of required) {\n if (!setup.includes(k)) {\n logger.error(\n `You have to set up the ${k}. Without this, the OpenTelemetry & Sentry integration will not work properly.`,\n );\n }\n }\n\n if (!setup.includes('SentrySampler')) {\n logger.warn(\n 'You have to set up the SentrySampler. Without this, the OpenTelemetry & Sentry integration may still work, but sample rates set for the Sentry SDK will not be respected.',\n );\n }\n}\n\nfunction getClientOptions(\n options: NodeOptions,\n getDefaultIntegrationsImpl: (options: Options) => Integration[],\n): NodeClientOptions {\n const release = getRelease(options.release);\n\n const autoSessionTracking =\n typeof release !== 'string'\n ? false\n : options.autoSessionTracking === undefined\n ? true\n : options.autoSessionTracking;\n\n const tracesSampleRate = getTracesSampleRate(options.tracesSampleRate);\n\n const baseOptions = dropUndefinedKeys({\n transport: makeNodeTransport,\n dsn: process.env.SENTRY_DSN,\n environment: process.env.SENTRY_ENVIRONMENT,\n });\n\n const overwriteOptions = dropUndefinedKeys({\n release,\n autoSessionTracking,\n tracesSampleRate,\n });\n\n const mergedOptions = {\n ...baseOptions,\n ...options,\n ...overwriteOptions,\n };\n\n if (options.defaultIntegrations === undefined) {\n options.defaultIntegrations = getDefaultIntegrationsImpl(mergedOptions);\n }\n\n const clientOptions: NodeClientOptions = {\n ...mergedOptions,\n stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),\n integrations: getIntegrationsToSetup({\n defaultIntegrations: options.defaultIntegrations,\n integrations: options.integrations,\n }),\n };\n\n return clientOptions;\n}\n\nfunction getRelease(release: NodeOptions['release']): string | undefined {\n if (release !== undefined) {\n return release;\n }\n\n const detectedRelease = getSentryRelease();\n if (detectedRelease !== undefined) {\n return detectedRelease;\n }\n\n return undefined;\n}\n\nfunction getTracesSampleRate(tracesSampleRate: NodeOptions['tracesSampleRate']): number | undefined {\n if (tracesSampleRate !== undefined) {\n return tracesSampleRate;\n }\n\n const sampleRateFromEnv = process.env.SENTRY_TRACES_SAMPLE_RATE;\n if (!sampleRateFromEnv) {\n return undefined;\n }\n\n const parsed = parseFloat(sampleRateFromEnv);\n return isFinite(parsed) ? parsed : undefined;\n}\n\n/**\n * Update scope and propagation context based on environmental variables.\n *\n * See https://github.com/getsentry/rfcs/blob/main/text/0071-continue-trace-over-process-boundaries.md\n * for more details.\n */\nfunction updateScopeFromEnvVariables(): void {\n const sentryUseEnvironment = (process.env.SENTRY_USE_ENVIRONMENT || '').toLowerCase();\n if (!['false', 'n', 'no', 'off', '0'].includes(sentryUseEnvironment)) {\n const sentryTraceEnv = process.env.SENTRY_TRACE;\n const baggageEnv = process.env.SENTRY_BAGGAGE;\n const propagationContext = propagationContextFromHeaders(sentryTraceEnv, baggageEnv);\n getCurrentScope().setPropagationContext(propagationContext);\n }\n}\n\n/**\n * Enable automatic Session Tracking for the node process.\n */\nfunction startSessionTracking(): void {\n const client = getClient<NodeClient>();\n if (client && client.getOptions().autoSessionTracking) {\n client.initSessionFlusher();\n }\n\n startSession();\n\n // Emitted in the case of healthy sessions, error of `mechanism.handled: true` and unhandledrejections because\n // The 'beforeExit' event is not emitted for conditions causing explicit termination,\n // such as calling process.exit() or uncaught exceptions.\n // Ref: https://nodejs.org/api/process.html#process_event_beforeexit\n process.on('beforeExit', () => {\n const session = getIsolationScope().getSession();\n\n // Only call endSession, if the Session exists on Scope and SessionStatus is not a\n // Terminal Status i.e. Exited or Crashed because\n // \"When a session is moved away from ok it must not be updated anymore.\"\n // Ref: https://develop.sentry.dev/sdk/sessions/\n if (session && session.status !== 'ok') {\n endSession();\n }\n });\n}\n\nfunction isEnabled(client: Client): boolean {\n return client.getOptions().enabled !== false && client.getTransport() !== undefined;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AA+CA,SAAS,sBAAsB,GAAkB;AACjD,EAAE,OAAO,KAAK,EAAC,GAAI,CAAC,kBAAkB,EAAE,CAAA,GAAI,EAAE,CAAA;AAC9C,CAAA;AACA;AACA;AACA;AACA;AACO,SAAS,wCAAwC,GAAkB;AAC1E,EAAE,OAAO;AACT;AACA,IAAI,yBAAyB,EAAE;AAC/B,IAAI,2BAA2B,EAAE;AACjC,IAAI,uBAAuB,EAAE;AAC7B,IAAI,sBAAsB,EAAE;AAC5B;AACA,IAAI,kBAAkB,EAAE;AACxB,IAAI,eAAe,EAAE;AACrB,IAAI,0BAA0B,EAAE;AAChC;AACA,IAAI,8BAA8B,EAAE;AACpC,IAAI,+BAA+B,EAAE;AACrC;AACA,IAAI,uBAAuB,EAAE;AAC7B,IAAI,yBAAyB,EAAE;AAC/B,IAAI,sBAAsB,EAAE;AAC5B,IAAI,GAAG,sBAAsB,EAAE;AAC/B,GAAG,CAAA;AACH,CAAA;AACA;AACA;AACO,SAAS,sBAAsB,CAAC,OAAO,EAA0B;AACxE,EAAE,OAAO;AACT,IAAI,GAAG,wCAAwC,EAAE;AACjD;AACA;AACA;AACA;AACA,IAAI,IAAI,gCAAgC,CAAC,OAAO,CAAA,GAAI,8BAA8B,EAAC,GAAI,EAAE;AACzF,GAAG,CAAA;AACH,CAAA;AACA;AACA,SAAS,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OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM;AACjC,IAAI,MAAM,UAAU,iBAAiB,EAAE,CAAC,UAAU,EAAE,CAAA;AACpD;AACA;AACA;AACA;AACA;AACA,IAAI,IAAI,OAAQ,IAAG,OAAO,CAAC,MAAA,KAAW,IAAI,EAAE;AAC5C,MAAM,UAAU,EAAE,CAAA;AAClB,KAAI;AACJ,GAAG,CAAC,CAAA;AACJ,CAAA;AACA;AACA,SAAS,SAAS,CAAC,MAAM,EAAmB;AAC5C,EAAE,OAAO,MAAM,CAAC,UAAU,EAAE,CAAC,OAAA,KAAY,KAAA,IAAS,MAAM,CAAC,YAAY,EAAC,KAAM,SAAS,CAAA;AACrF;;;;"}
@@ -100,7 +100,11 @@ function setupOtel(client) {
100
100
  }),
101
101
  forceFlushTimeoutMillis: 500,
102
102
  });
103
- provider.addSpanProcessor(new SentrySpanProcessor());
103
+ provider.addSpanProcessor(
104
+ new SentrySpanProcessor({
105
+ timeout: client.getOptions().maxSpanWaitDuration,
106
+ }),
107
+ );
104
108
 
105
109
  // Initialize the provider
106
110
  provider.register({
@@ -1 +1 @@
1
- {"version":3,"file":"initOtel.js","sources":["../../../src/sdk/initOtel.ts"],"sourcesContent":["import moduleModule from 'module';\nimport { DiagLogLevel, diag } from '@opentelemetry/api';\nimport { Resource } from '@opentelemetry/resources';\nimport { BasicTracerProvider } from '@opentelemetry/sdk-trace-base';\nimport {\n SEMRESATTRS_SERVICE_NAME,\n SEMRESATTRS_SERVICE_NAMESPACE,\n SEMRESATTRS_SERVICE_VERSION,\n} from '@opentelemetry/semantic-conventions';\nimport { SDK_VERSION } from '@sentry/core';\nimport { SentryPropagator, SentrySampler, SentrySpanProcessor } from '@sentry/opentelemetry';\nimport { GLOBAL_OBJ, consoleSandbox, logger } from '@sentry/utils';\n\nimport { getOpenTelemetryInstrumentationToPreload } from '../integrations/tracing';\nimport { SentryContextManager } from '../otel/contextManager';\nimport { isCjs } from '../utils/commonjs';\nimport type { NodeClient } from './client';\n\ndeclare const __IMPORT_META_URL_REPLACEMENT__: string;\n\n/**\n * Initialize OpenTelemetry for Node.\n */\nexport function initOpenTelemetry(client: NodeClient): void {\n if (client.getOptions().debug) {\n setupOpenTelemetryLogger();\n }\n\n const provider = setupOtel(client);\n client.traceProvider = provider;\n}\n\n/** Initialize the ESM loader. */\nexport function maybeInitializeEsmLoader(): void {\n const [nodeMajor = 0, nodeMinor = 0] = process.versions.node.split('.').map(Number);\n\n // Register hook was added in v20.6.0 and v18.19.0\n if (nodeMajor >= 22 || (nodeMajor === 20 && nodeMinor >= 6) || (nodeMajor === 18 && nodeMinor >= 19)) {\n // We need to work around using import.meta.url directly because jest complains about it.\n const importMetaUrl =\n typeof __IMPORT_META_URL_REPLACEMENT__ !== 'undefined' ? __IMPORT_META_URL_REPLACEMENT__ : undefined;\n\n if (!GLOBAL_OBJ._sentryEsmLoaderHookRegistered && importMetaUrl) {\n try {\n // @ts-expect-error register is available in these versions\n moduleModule.register('@opentelemetry/instrumentation/hook.mjs', importMetaUrl);\n GLOBAL_OBJ._sentryEsmLoaderHookRegistered = true;\n } catch (error) {\n logger.warn('Failed to register ESM hook', error);\n }\n }\n } else {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] You are using Node.js in ESM mode (\"import syntax\"). The Sentry Node.js SDK is not compatible with ESM in Node.js versions before 18.19.0 or before 20.6.0. Please either build your application with CommonJS (\"require() syntax\"), or use version 7.x of the Sentry Node.js SDK.',\n );\n });\n }\n}\n\ninterface NodePreloadOptions {\n debug?: boolean;\n integrations?: string[];\n}\n\n/**\n * Preload OpenTelemetry for Node.\n * This can be used to preload instrumentation early, but set up Sentry later.\n * By preloading the OTEL instrumentation wrapping still happens early enough that everything works.\n */\nexport function preloadOpenTelemetry(options: NodePreloadOptions = {}): void {\n const { debug } = options;\n\n if (debug) {\n logger.enable();\n setupOpenTelemetryLogger();\n }\n\n if (!isCjs()) {\n maybeInitializeEsmLoader();\n }\n\n // These are all integrations that we need to pre-load to ensure they are set up before any other code runs\n getPreloadMethods(options.integrations).forEach(fn => {\n fn();\n\n if (debug) {\n logger.log(`[Sentry] Preloaded ${fn.id} instrumentation`);\n }\n });\n}\n\nfunction getPreloadMethods(integrationNames?: string[]): ((() => void) & { id: string })[] {\n const instruments = getOpenTelemetryInstrumentationToPreload();\n\n if (!integrationNames) {\n return instruments;\n }\n\n return instruments.filter(instrumentation => integrationNames.includes(instrumentation.id));\n}\n\n/** Just exported for tests. */\nexport function setupOtel(client: NodeClient): BasicTracerProvider {\n // Create and configure NodeTracerProvider\n const provider = new BasicTracerProvider({\n sampler: new SentrySampler(client),\n resource: new Resource({\n [SEMRESATTRS_SERVICE_NAME]: 'node',\n [SEMRESATTRS_SERVICE_NAMESPACE]: 'sentry',\n [SEMRESATTRS_SERVICE_VERSION]: SDK_VERSION,\n }),\n forceFlushTimeoutMillis: 500,\n });\n provider.addSpanProcessor(new SentrySpanProcessor());\n\n // Initialize the provider\n provider.register({\n propagator: new SentryPropagator(),\n contextManager: new SentryContextManager(),\n });\n\n return provider;\n}\n\n/**\n * Setup the OTEL logger to use our own logger.\n */\nfunction setupOpenTelemetryLogger(): void {\n const otelLogger = new Proxy(logger as typeof logger & { verbose: (typeof logger)['debug'] }, {\n get(target, prop, receiver) {\n const actualProp = prop === 'verbose' ? 'debug' : prop;\n return Reflect.get(target, actualProp, receiver);\n },\n });\n\n // Disable diag, to ensure this works even if called multiple times\n diag.disable();\n diag.setLogger(otelLogger, DiagLogLevel.DEBUG);\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAoBA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,MAAM,EAAoB;AAC5D,EAAE,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE;AACjC,IAAI,wBAAwB,EAAE,CAAA;AAC9B,GAAE;AACF;AACA,EAAE,MAAM,QAAS,GAAE,SAAS,CAAC,MAAM,CAAC,CAAA;AACpC,EAAE,MAAM,CAAC,a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BAAmB,EAAE,CAAC,CAAA;AACtD;AACA;AACA,EAAE,QAAQ,CAAC,QAAQ,CAAC;AACpB,IAAI,UAAU,EAAE,IAAI,gBAAgB,EAAE;AACtC,IAAI,cAAc,EAAE,IAAI,oBAAoB,EAAE;AAC9C,GAAG,CAAC,CAAA;AACJ;AACA,EAAE,OAAO,QAAQ,CAAA;AACjB,CAAA;AACA;AACA;AACA;AACA;AACA,SAAS,wBAAwB,GAAS;AAC1C,EAAE,MAAM,UAAW,GAAE,IAAI,KAAK,CAAC,SAAiE;AAChG,IAAI,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE;AAChC,MAAM,MAAM,aAAa,IAAA,KAAS,SAAU,GAAE,OAAQ,GAAE,IAAI,CAAA;AAC5D,MAAM,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAA;AACtD,KAAK;AACL,GAAG,CAAC,CAAA;AACJ;AACA;AACA,EAAE,IAAI,CAAC,OAAO,EAAE,CAAA;AAChB,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,YAAY,CAAC,KAAK,CAAC,CAAA;AAChD;;;;"}
1
+ {"version":3,"file":"initOtel.js","sources":["../../../src/sdk/initOtel.ts"],"sourcesContent":["import moduleModule from 'module';\nimport { DiagLogLevel, diag } from '@opentelemetry/api';\nimport { Resource } from '@opentelemetry/resources';\nimport { BasicTracerProvider } from '@opentelemetry/sdk-trace-base';\nimport {\n SEMRESATTRS_SERVICE_NAME,\n SEMRESATTRS_SERVICE_NAMESPACE,\n SEMRESATTRS_SERVICE_VERSION,\n} from '@opentelemetry/semantic-conventions';\nimport { SDK_VERSION } from '@sentry/core';\nimport { SentryPropagator, SentrySampler, SentrySpanProcessor } from '@sentry/opentelemetry';\nimport { GLOBAL_OBJ, consoleSandbox, logger } from '@sentry/utils';\n\nimport { getOpenTelemetryInstrumentationToPreload } from '../integrations/tracing';\nimport { SentryContextManager } from '../otel/contextManager';\nimport { isCjs } from '../utils/commonjs';\nimport type { NodeClient } from './client';\n\ndeclare const __IMPORT_META_URL_REPLACEMENT__: string;\n\n/**\n * Initialize OpenTelemetry for Node.\n */\nexport function initOpenTelemetry(client: NodeClient): void {\n if (client.getOptions().debug) {\n setupOpenTelemetryLogger();\n }\n\n const provider = setupOtel(client);\n client.traceProvider = provider;\n}\n\n/** Initialize the ESM loader. */\nexport function maybeInitializeEsmLoader(): void {\n const [nodeMajor = 0, nodeMinor = 0] = process.versions.node.split('.').map(Number);\n\n // Register hook was added in v20.6.0 and v18.19.0\n if (nodeMajor >= 22 || (nodeMajor === 20 && nodeMinor >= 6) || (nodeMajor === 18 && nodeMinor >= 19)) {\n // We need to work around using import.meta.url directly because jest complains about it.\n const importMetaUrl =\n typeof __IMPORT_META_URL_REPLACEMENT__ !== 'undefined' ? __IMPORT_META_URL_REPLACEMENT__ : undefined;\n\n if (!GLOBAL_OBJ._sentryEsmLoaderHookRegistered && importMetaUrl) {\n try {\n // @ts-expect-error register is available in these versions\n moduleModule.register('@opentelemetry/instrumentation/hook.mjs', importMetaUrl);\n GLOBAL_OBJ._sentryEsmLoaderHookRegistered = true;\n } catch (error) {\n logger.warn('Failed to register ESM hook', error);\n }\n }\n } else {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] You are using Node.js in ESM mode (\"import syntax\"). The Sentry Node.js SDK is not compatible with ESM in Node.js versions before 18.19.0 or before 20.6.0. Please either build your application with CommonJS (\"require() syntax\"), or use version 7.x of the Sentry Node.js SDK.',\n );\n });\n }\n}\n\ninterface NodePreloadOptions {\n debug?: boolean;\n integrations?: string[];\n}\n\n/**\n * Preload OpenTelemetry for Node.\n * This can be used to preload instrumentation early, but set up Sentry later.\n * By preloading the OTEL instrumentation wrapping still happens early enough that everything works.\n */\nexport function preloadOpenTelemetry(options: NodePreloadOptions = {}): void {\n const { debug } = options;\n\n if (debug) {\n logger.enable();\n setupOpenTelemetryLogger();\n }\n\n if (!isCjs()) {\n maybeInitializeEsmLoader();\n }\n\n // These are all integrations that we need to pre-load to ensure they are set up before any other code runs\n getPreloadMethods(options.integrations).forEach(fn => {\n fn();\n\n if (debug) {\n logger.log(`[Sentry] Preloaded ${fn.id} instrumentation`);\n }\n });\n}\n\nfunction getPreloadMethods(integrationNames?: string[]): ((() => void) & { id: string })[] {\n const instruments = getOpenTelemetryInstrumentationToPreload();\n\n if (!integrationNames) {\n return instruments;\n }\n\n return instruments.filter(instrumentation => integrationNames.includes(instrumentation.id));\n}\n\n/** Just exported for tests. */\nexport function setupOtel(client: NodeClient): BasicTracerProvider {\n // Create and configure NodeTracerProvider\n const provider = new BasicTracerProvider({\n sampler: new SentrySampler(client),\n resource: new Resource({\n [SEMRESATTRS_SERVICE_NAME]: 'node',\n [SEMRESATTRS_SERVICE_NAMESPACE]: 'sentry',\n [SEMRESATTRS_SERVICE_VERSION]: SDK_VERSION,\n }),\n forceFlushTimeoutMillis: 500,\n });\n provider.addSpanProcessor(\n new SentrySpanProcessor({\n timeout: client.getOptions().maxSpanWaitDuration,\n }),\n );\n\n // Initialize the provider\n provider.register({\n propagator: new SentryPropagator(),\n contextManager: new SentryContextManager(),\n });\n\n return provider;\n}\n\n/**\n * Setup the OTEL logger to use our own logger.\n */\nfunction setupOpenTelemetryLogger(): void {\n const otelLogger = new Proxy(logger as typeof logger & { verbose: (typeof logger)['debug'] }, {\n get(target, prop, receiver) {\n const actualProp = prop === 'verbose' ? 'debug' : prop;\n return Reflect.get(target, actualProp, receiver);\n },\n });\n\n // Disable diag, to ensure this works even if called multiple times\n diag.disable();\n diag.setLogger(otelLogger, DiagLogLevel.DEBUG);\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAoBA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,MAAM,EAAoB;AAC5D,EAAE,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE;AACjC,IAAI,wBAAwB,EAAE,CAAA;AAC9B,GAAE;AACF;AACA,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E,GAAG;AAChC,GAAG,CAAC,CAAA;AACJ,EAAE,QAAQ,CAAC,gBAAgB;AAC3B,IAAI,IAAI,mBAAmB,CAAC;AAC5B,MAAM,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,mBAAmB;AACtD,KAAK,CAAC;AACN,GAAG,CAAA;AACH;AACA;AACA,EAAE,QAAQ,CAAC,QAAQ,CAAC;AACpB,IAAI,UAAU,EAAE,IAAI,gBAAgB,EAAE;AACtC,IAAI,cAAc,EAAE,IAAI,oBAAoB,EAAE;AAC9C,GAAG,CAAC,CAAA;AACJ;AACA,EAAE,OAAO,QAAQ,CAAA;AACjB,CAAA;AACA;AACA;AACA;AACA;AACA,SAAS,wBAAwB,GAAS;AAC1C,EAAE,MAAM,UAAW,GAAE,IAAI,KAAK,CAAC,SAAiE;AAChG,IAAI,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE;AAChC,MAAM,MAAM,aAAa,IAAA,KAAS,SAAU,GAAE,OAAQ,GAAE,IAAI,CAAA;AAC5D,MAAM,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAA;AACtD,KAAK;AACL,GAAG,CAAC,CAAA;AACJ;AACA;AACA,EAAE,IAAI,CAAC,OAAO,EAAE,CAAA;AAChB,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,YAAY,CAAC,KAAK,CAAC,CAAA;AAChD;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/node",
3
- "version": "8.10.0",
3
+ "version": "8.12.0-beta.0",
4
4
  "description": "Sentry Node SDK using OpenTelemetry for performance instrumentation",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/node",
@@ -93,10 +93,10 @@
93
93
  "@opentelemetry/sdk-trace-base": "^1.25.0",
94
94
  "@opentelemetry/semantic-conventions": "^1.25.0",
95
95
  "@prisma/instrumentation": "5.15.0",
96
- "@sentry/core": "8.10.0",
97
- "@sentry/opentelemetry": "8.10.0",
98
- "@sentry/types": "8.10.0",
99
- "@sentry/utils": "8.10.0"
96
+ "@sentry/core": "8.12.0-beta.0",
97
+ "@sentry/opentelemetry": "8.12.0-beta.0",
98
+ "@sentry/types": "8.12.0-beta.0",
99
+ "@sentry/utils": "8.12.0-beta.0"
100
100
  },
101
101
  "devDependencies": {
102
102
  "@types/node": "^14.18.0"
@@ -1 +1 @@
1
- {"version":3,"file":"koa.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing/koa.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,aAAa;;CAmBzB,CAAC;AAWF,eAAO,MAAM,cAAc,2CAAqC,CAAC;AAGjE,eAAO,MAAM,oBAAoB;sBAA6B,GAAG,QAAQ,GAAG,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI;MAAK,IAU3G,CAAC"}
1
+ {"version":3,"file":"koa.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing/koa.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,aAAa;;CAmBzB,CAAC;AAWF,eAAO,MAAM,cAAc,2CAAqC,CAAC;AAGjE,eAAO,MAAM,oBAAoB;sBAA6B,GAAG,QAAQ,GAAG,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI;MAAK,IAW3G,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/sdk/api.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAIjD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CA6BtE;AAED,2BAA2B;AAC3B,eAAO,MAAM,kBAAkB,EAAE,WAAmF,CAAC"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/sdk/api.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAIjD;;GAEG;AAEH,wBAAgB,gBAAgB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAkGtE;AAED,2BAA2B;AAC3B,eAAO,MAAM,kBAAkB,EAAE,WAAmF,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import type { Integration, Options } from '@sentry/types';
2
2
  import type { NodeOptions } from '../types';
3
+ import { NodeClient } from './client';
3
4
  /**
4
5
  * Get default integrations, excluding performance.
5
6
  */
@@ -9,11 +10,11 @@ export declare function getDefaultIntegrations(options: Options): Integration[];
9
10
  /**
10
11
  * Initialize Sentry for Node.
11
12
  */
12
- export declare function init(options?: NodeOptions | undefined): void;
13
+ export declare function init(options?: NodeOptions | undefined): NodeClient | undefined;
13
14
  /**
14
15
  * Initialize Sentry for Node, without any integrations added by default.
15
16
  */
16
- export declare function initWithoutDefaultIntegrations(options?: NodeOptions | undefined): void;
17
+ export declare function initWithoutDefaultIntegrations(options?: NodeOptions | undefined): NodeClient;
17
18
  /**
18
19
  * Validate that your OpenTelemetry setup is correct.
19
20
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sdk/index.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAU,WAAW,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAsBlE,OAAO,KAAK,EAAqB,WAAW,EAAE,MAAM,UAAU,CAAC;AAU/D;;GAEG;AACH,wBAAgB,wCAAwC,IAAI,WAAW,EAAE,CAoBxE;AAED,qDAAqD;AACrD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,EAAE,CAStE;AAWD;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,GAAE,WAAW,GAAG,SAAc,GAAG,IAAI,CAEhE;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,GAAE,WAAW,GAAG,SAAc,GAAG,IAAI,CAE1F;AAyED;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,IAAI,CAqBjD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sdk/index.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAU,WAAW,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAsBlE,OAAO,KAAK,EAAqB,WAAW,EAAE,MAAM,UAAU,CAAC;AAG/D,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAOtC;;GAEG;AACH,wBAAgB,wCAAwC,IAAI,WAAW,EAAE,CAoBxE;AAED,qDAAqD;AACrD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,EAAE,CAStE;AAWD;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,GAAE,WAAW,GAAG,SAAc,GAAG,UAAU,GAAG,SAAS,CAElF;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,GAAE,WAAW,GAAG,SAAc,GAAG,UAAU,CAEhG;AA2ED;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,IAAI,CAqBjD"}
@@ -1 +1 @@
1
- {"version":3,"file":"initOtel.d.ts","sourceRoot":"","sources":["../../../src/sdk/initOtel.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAapE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAI3C;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAO1D;AAED,iCAAiC;AACjC,wBAAgB,wBAAwB,IAAI,IAAI,CA0B/C;AAED,UAAU,kBAAkB;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,kBAAuB,GAAG,IAAI,CAoB3E;AAYD,+BAA+B;AAC/B,wBAAgB,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,mBAAmB,CAoBjE"}
1
+ {"version":3,"file":"initOtel.d.ts","sourceRoot":"","sources":["../../../src/sdk/initOtel.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAapE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAI3C;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAO1D;AAED,iCAAiC;AACjC,wBAAgB,wBAAwB,IAAI,IAAI,CA0B/C;AAED,UAAU,kBAAkB;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,kBAAuB,GAAG,IAAI,CAoB3E;AAYD,+BAA+B;AAC/B,wBAAgB,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,mBAAmB,CAwBjE"}
package/types/types.d.ts CHANGED
@@ -65,6 +65,16 @@ export interface BaseNodeOptions {
65
65
  * * The `SentrySampler`
66
66
  */
67
67
  skipOpenTelemetrySetup?: boolean;
68
+ /**
69
+ * The max. duration in seconds that the SDK will wait for parent spans to be finished before discarding a span.
70
+ * The SDK will automatically clean up spans that have no finished parent after this duration.
71
+ * This is necessary to prevent memory leaks in case of parent spans that are never finished or otherwise dropped/missing.
72
+ * However, if you have very long-running spans in your application, a shorter duration might cause spans to be discarded too early.
73
+ * In this case, you can increase this duration to a value that fits your expected data.
74
+ *
75
+ * Defaults to 300 seconds (5 minutes).
76
+ */
77
+ maxSpanWaitDuration?: number;
68
78
  /** Callback that is executed when a fatal global error occurs. */
69
79
  onFatalError?(this: void, error: Error): void;
70
80
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRo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;CAAG;AAElG,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,KAAK,CAAC;IACb,cAAc,EAAE,KAAK,CAAC;CACvB;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,YAAY,GAAG,IAAI,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { Integration, Options } from '@sentry/types';
2
2
  import { NodeOptions } from '../types';
3
+ import { NodeClient } from './client';
3
4
  /**
4
5
  * Get default integrations, excluding performance.
5
6
  */
@@ -9,11 +10,11 @@ export declare function getDefaultIntegrations(options: Options): Integration[];
9
10
  /**
10
11
  * Initialize Sentry for Node.
11
12
  */
12
- export declare function init(options?: NodeOptions | undefined): void;
13
+ export declare function init(options?: NodeOptions | undefined): NodeClient | undefined;
13
14
  /**
14
15
  * Initialize Sentry for Node, without any integrations added by default.
15
16
  */
16
- export declare function initWithoutDefaultIntegrations(options?: NodeOptions | undefined): void;
17
+ export declare function initWithoutDefaultIntegrations(options?: NodeOptions | undefined): NodeClient;
17
18
  /**
18
19
  * Validate that your OpenTelemetry setup is correct.
19
20
  */
@@ -65,6 +65,16 @@ export interface BaseNodeOptions {
65
65
  * * The `SentrySampler`
66
66
  */
67
67
  skipOpenTelemetrySetup?: boolean;
68
+ /**
69
+ * The max. duration in seconds that the SDK will wait for parent spans to be finished before discarding a span.
70
+ * The SDK will automatically clean up spans that have no finished parent after this duration.
71
+ * This is necessary to prevent memory leaks in case of parent spans that are never finished or otherwise dropped/missing.
72
+ * However, if you have very long-running spans in your application, a shorter duration might cause spans to be discarded too early.
73
+ * In this case, you can increase this duration to a value that fits your expected data.
74
+ *
75
+ * Defaults to 300 seconds (5 minutes).
76
+ */
77
+ maxSpanWaitDuration?: number;
68
78
  /** Callback that is executed when a fatal global error occurs. */
69
79
  onFatalError?(this: void, error: Error): void;
70
80
  }