@sentry/node 10.21.0 → 10.23.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 (59) hide show
  1. package/build/cjs/index.js +10 -7
  2. package/build/cjs/index.js.map +1 -1
  3. package/build/cjs/integrations/node-fetch.js +2 -0
  4. package/build/cjs/integrations/node-fetch.js.map +1 -1
  5. package/build/cjs/integrations/tracing/firebase/firebase.js +18 -0
  6. package/build/cjs/integrations/tracing/firebase/firebase.js.map +1 -1
  7. package/build/cjs/integrations/tracing/firebase/otel/firebaseInstrumentation.js +3 -0
  8. package/build/cjs/integrations/tracing/firebase/otel/firebaseInstrumentation.js.map +1 -1
  9. package/build/cjs/integrations/tracing/firebase/otel/patches/functions.js +265 -0
  10. package/build/cjs/integrations/tracing/firebase/otel/patches/functions.js.map +1 -0
  11. package/build/cjs/integrations/tracing/index.js +3 -0
  12. package/build/cjs/integrations/tracing/index.js.map +1 -1
  13. package/build/cjs/integrations/tracing/langchain/index.js +112 -0
  14. package/build/cjs/integrations/tracing/langchain/index.js.map +1 -0
  15. package/build/cjs/integrations/tracing/langchain/instrumentation.js +201 -0
  16. package/build/cjs/integrations/tracing/langchain/instrumentation.js.map +1 -0
  17. package/build/cjs/integrations/tracing/postgresjs.js +1 -1
  18. package/build/cjs/integrations/tracing/postgresjs.js.map +1 -1
  19. package/build/esm/index.js +2 -1
  20. package/build/esm/index.js.map +1 -1
  21. package/build/esm/integrations/node-fetch.js +2 -0
  22. package/build/esm/integrations/node-fetch.js.map +1 -1
  23. package/build/esm/integrations/tracing/firebase/firebase.js +19 -1
  24. package/build/esm/integrations/tracing/firebase/firebase.js.map +1 -1
  25. package/build/esm/integrations/tracing/firebase/otel/firebaseInstrumentation.js +3 -0
  26. package/build/esm/integrations/tracing/firebase/otel/firebaseInstrumentation.js.map +1 -1
  27. package/build/esm/integrations/tracing/firebase/otel/patches/functions.js +262 -0
  28. package/build/esm/integrations/tracing/firebase/otel/patches/functions.js.map +1 -0
  29. package/build/esm/integrations/tracing/index.js +3 -0
  30. package/build/esm/integrations/tracing/index.js.map +1 -1
  31. package/build/esm/integrations/tracing/langchain/index.js +109 -0
  32. package/build/esm/integrations/tracing/langchain/index.js.map +1 -0
  33. package/build/esm/integrations/tracing/langchain/instrumentation.js +199 -0
  34. package/build/esm/integrations/tracing/langchain/instrumentation.js.map +1 -0
  35. package/build/esm/integrations/tracing/postgresjs.js +1 -1
  36. package/build/esm/integrations/tracing/postgresjs.js.map +1 -1
  37. package/build/esm/package.json +1 -1
  38. package/build/types/index.d.ts +2 -1
  39. package/build/types/index.d.ts.map +1 -1
  40. package/build/types/integrations/node-fetch.d.ts +2 -1
  41. package/build/types/integrations/node-fetch.d.ts.map +1 -1
  42. package/build/types/integrations/tracing/firebase/firebase.d.ts.map +1 -1
  43. package/build/types/integrations/tracing/firebase/otel/firebaseInstrumentation.d.ts.map +1 -1
  44. package/build/types/integrations/tracing/firebase/otel/patches/functions.d.ts +23 -0
  45. package/build/types/integrations/tracing/firebase/otel/patches/functions.d.ts.map +1 -0
  46. package/build/types/integrations/tracing/firebase/otel/types.d.ts +34 -0
  47. package/build/types/integrations/tracing/firebase/otel/types.d.ts.map +1 -1
  48. package/build/types/integrations/tracing/index.d.ts.map +1 -1
  49. package/build/types/integrations/tracing/langchain/index.d.ts +93 -0
  50. package/build/types/integrations/tracing/langchain/index.d.ts.map +1 -0
  51. package/build/types/integrations/tracing/langchain/instrumentation.d.ts +29 -0
  52. package/build/types/integrations/tracing/langchain/instrumentation.d.ts.map +1 -0
  53. package/build/types-ts3.8/index.d.ts +2 -1
  54. package/build/types-ts3.8/integrations/node-fetch.d.ts +2 -1
  55. package/build/types-ts3.8/integrations/tracing/firebase/otel/patches/functions.d.ts +23 -0
  56. package/build/types-ts3.8/integrations/tracing/firebase/otel/types.d.ts +34 -0
  57. package/build/types-ts3.8/integrations/tracing/langchain/index.d.ts +93 -0
  58. package/build/types-ts3.8/integrations/tracing/langchain/instrumentation.d.ts +29 -0
  59. package/package.json +4 -4
@@ -0,0 +1,93 @@
1
+ import { LangChainOptions } from '@sentry/core';
2
+ export declare const instrumentLangChain: ((options?: LangChainOptions | undefined) => import("@opentelemetry/instrumentation").Instrumentation<import("@opentelemetry/instrumentation").InstrumentationConfig>) & {
3
+ id: string;
4
+ };
5
+ /**
6
+ * Adds Sentry tracing instrumentation for LangChain.
7
+ *
8
+ * This integration is enabled by default.
9
+ *
10
+ * When configured, this integration automatically instruments LangChain runnable instances
11
+ * to capture telemetry data by injecting Sentry callback handlers into all LangChain calls.
12
+ *
13
+ * @example
14
+ * ```javascript
15
+ * import * as Sentry from '@sentry/node';
16
+ * import { ChatOpenAI } from '@langchain/openai';
17
+ *
18
+ * Sentry.init({
19
+ * integrations: [Sentry.langChainIntegration()],
20
+ * sendDefaultPii: true, // Enable to record inputs/outputs
21
+ * });
22
+ *
23
+ * // LangChain calls are automatically instrumented
24
+ * const model = new ChatOpenAI();
25
+ * await model.invoke("What is the capital of France?");
26
+ * ```
27
+ *
28
+ * ## Manual Callback Handler
29
+ *
30
+ * You can also manually add the Sentry callback handler alongside other callbacks:
31
+ *
32
+ * @example
33
+ * ```javascript
34
+ * import * as Sentry from '@sentry/node';
35
+ * import { ChatOpenAI } from '@langchain/openai';
36
+ *
37
+ * const sentryHandler = Sentry.createLangChainCallbackHandler({
38
+ * recordInputs: true,
39
+ * recordOutputs: true
40
+ * });
41
+ *
42
+ * const model = new ChatOpenAI();
43
+ * await model.invoke(
44
+ * "What is the capital of France?",
45
+ * { callbacks: [sentryHandler, myOtherCallback] }
46
+ * );
47
+ * ```
48
+ *
49
+ * ## Options
50
+ *
51
+ * - `recordInputs`: Whether to record input messages/prompts (default: respects `sendDefaultPii` client option)
52
+ * - `recordOutputs`: Whether to record response text (default: respects `sendDefaultPii` client option)
53
+ *
54
+ * ### Default Behavior
55
+ *
56
+ * By default, the integration will:
57
+ * - Record inputs and outputs ONLY if `sendDefaultPii` is set to `true` in your Sentry client options
58
+ * - Otherwise, inputs and outputs are NOT recorded unless explicitly enabled
59
+ *
60
+ * @example
61
+ * ```javascript
62
+ * // Record inputs and outputs when sendDefaultPii is false
63
+ * Sentry.init({
64
+ * integrations: [
65
+ * Sentry.langChainIntegration({
66
+ * recordInputs: true,
67
+ * recordOutputs: true
68
+ * })
69
+ * ],
70
+ * });
71
+ *
72
+ * // Never record inputs/outputs regardless of sendDefaultPii
73
+ * Sentry.init({
74
+ * sendDefaultPii: true,
75
+ * integrations: [
76
+ * Sentry.langChainIntegration({
77
+ * recordInputs: false,
78
+ * recordOutputs: false
79
+ * })
80
+ * ],
81
+ * });
82
+ * ```
83
+ *
84
+ * ## Supported Events
85
+ *
86
+ * The integration captures the following LangChain lifecycle events:
87
+ * - LLM/Chat Model: start, end, error
88
+ * - Chain: start, end, error
89
+ * - Tool: start, end, error
90
+ *
91
+ */
92
+ export declare const langChainIntegration: (options?: LangChainOptions | undefined) => import("@sentry/core").Integration;
93
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,29 @@
1
+ import { InstrumentationConfig, InstrumentationModuleDefinition, InstrumentationBase } from '@opentelemetry/instrumentation';
2
+ import { LangChainOptions } from '@sentry/core';
3
+ type LangChainInstrumentationOptions = InstrumentationConfig & LangChainOptions;
4
+ /**
5
+ * Sentry LangChain instrumentation using OpenTelemetry.
6
+ */
7
+ export declare class SentryLangChainInstrumentation extends InstrumentationBase<LangChainInstrumentationOptions> {
8
+ constructor(config?: LangChainInstrumentationOptions);
9
+ /**
10
+ * Initializes the instrumentation by defining the modules to be patched.
11
+ * We patch the BaseChatModel class methods to inject callbacks
12
+ *
13
+ * We hook into provider packages (@langchain/anthropic, @langchain/openai, etc.)
14
+ * because @langchain/core is often bundled and not loaded as a separate module
15
+ */
16
+ init(): InstrumentationModuleDefinition | InstrumentationModuleDefinition[];
17
+ /**
18
+ * Core patch logic - patches chat model methods to inject Sentry callbacks
19
+ * This is called when a LangChain provider package is loaded
20
+ */
21
+ private _patch;
22
+ /**
23
+ * Patches chat model methods (invoke, stream, batch) to inject Sentry callbacks
24
+ * Finds a chat model class from the provider package exports and patches its prototype methods
25
+ */
26
+ private _patchRunnableMethods;
27
+ }
28
+ export {};
29
+ //# sourceMappingURL=instrumentation.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/node",
3
- "version": "10.21.0",
3
+ "version": "10.23.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",
@@ -95,9 +95,9 @@
95
95
  "@opentelemetry/sdk-trace-base": "^2.1.0",
96
96
  "@opentelemetry/semantic-conventions": "^1.37.0",
97
97
  "@prisma/instrumentation": "6.15.0",
98
- "@sentry/core": "10.21.0",
99
- "@sentry/node-core": "10.21.0",
100
- "@sentry/opentelemetry": "10.21.0",
98
+ "@sentry/core": "10.23.0",
99
+ "@sentry/node-core": "10.23.0",
100
+ "@sentry/opentelemetry": "10.23.0",
101
101
  "import-in-the-middle": "^1.14.2",
102
102
  "minimatch": "^9.0.0"
103
103
  },