meta(changelog): Update changelog for 10.22.0#18016
Closed
meta(changelog): Update changelog for 10.22.0#18016
Conversation
[Gitflow] Merge master into develop
Fixes: #17809 Implements message truncation logic that drops oldest messages first until the payload fits within the 20KB limit. If a single message exceeds the limit, its content is truncated from the end. Supports OpenAI/Anthropic ({ role, content }) and Google GenAI ({ role, parts: [{ text }] }) message formats.
No breaking changes that affect us: https://github.com/pahen/madge/blob/master/CHANGELOG.md#v800 Should reduce our total dependency count.
This PR adds automatic instrumentation for LangChain chat clients in Node SDK, we cover most used providers mentioned in https://python.langchain.com/docs/integrations/chat/. **What's added?** TLDR; a [LangChain Callback Handler ](https://js.langchain.com/docs/concepts/callbacks/) that: - Creates a stateful callback handler that tracks LangChain lifecycle events - Handles LLM/Chat Model events (start, end, error, streaming) - Handles Chain events (start, end, error) - Handles Tool events (start, end, error) - Extracts and normalizes request/respo **How it works?** 1. **Module Patching**: When a LangChain provider package is loaded (e.g., `@langchain/anthropic`), the instrumentation: - Finds the chat model class (e.g., `ChatAnthropic`) - Wraps the `invoke`, `stream`, and `batch` methods on the prototype - Uses a Proxy to intercept method calls 2. **Callback Injection**: When a LangChain method is called: - The wrapper intercepts the call - Augments the `options.callbacks` array with Sentry's callback handler - Calls the original method with the augmented callbacks The integration is **enabled by default** when you initialize Sentry in Node.js: ```javascript import * as Sentry from '@sentry/node'; import { ChatAnthropic } from '@langchain/anthropic'; Sentry.init({ dsn: 'your-dsn', tracesSampleRate: 1.0, sendDefaultPii: true, // Enable to record inputs/outputs }); // LangChain calls are automatically instrumented const model = new ChatAnthropic({ model: 'claude-3-5-sonnet-20241022', }); await model.invoke('What is the capital of France?'); ``` You can configure what data is recorded: ```javascript Sentry.init({ integrations: [ Sentry.langChainIntegration({ recordInputs: true, // Record prompts/messages recordOutputs: true, // Record responses }) ], }); ``` Note: We need to disable integrations for AI providers that LangChain use to avoid duplicate spans, this will be handled in a follow up PR.
This PR: - Includes bindings from child loggers as attributes - Tests that track/untrack setting is propagated to child loggers
ATM there are failing Hono E2E tests (e.g. [here](https://github.com/getsentry/sentry-javascript/actions/runs/18714106732/job/53370082672?pr=17998)), which print out following: ```sh Error: src/index.ts(20,3): error TS2584: Cannot find name 'console'. Do you need to change your target library? Try changing the 'lib' compiler option to include 'dom'. ``` The reason was, that the types were not there yet. I just wonder why it was working before. In follow up PRs I will try to update Cloudflare tests with its integrations.
There were 2 major changes: - `auto.console.logging` -> `auto.log.console` - `auto.logging.*` -> `auto.log.*` This can go in already, I am just not sure if this should be a breaking change or a minor bump, since theoretically dashboards or bookmarked searches/groupings would be failing. (closes #17900)
This adds two new options into the `nativeNodeFetchIntegration` - the only thing it does is passing the two new options directly into the OTel instrumentation. Since this is OTel related, this is only accessible within the `node` SDK. The documentation will be then updated for the fetch integration ([it seems](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/nodefetch/) that also the `spans` are missing) (closes #17953)
[Next 16 was released](https://github.com/vercel/next.js/releases/tag/v16.0.0) With that proxy files run per default on nodejs. This PR - Updates the tests to run on next 16 (non-beta) - Adds support for handling middleware transactions in the node part of the sdk
Closes: #17861 This adds - instrumentation of Cloud Functions for Firebase (v2) along side the Firestore integration. It can be used with the `Sentry.firebaseIntegration()` (this is atm not documented in the docs and got added in #16719, but will be added right after this has been merged. See getsentry/sentry-docs#15247). - The test app for Firebase has been rewritten and updated since it requires a little special setup. <details> <summary>Supported functions</summary> <ul> <li>onRequest</li> <li>onCall</li> <li>onDocumentCreated</li> <li>onDocumentUpdated</li> <li>onDocumentDeleted</li> <li>onDocumentWritten</li> <li>onDocumentCreatedWithAuthContext</li> <li>onDocumentUpdatedWithAuthContext</li> <li>onDocumentDeletedWithAuthContext</li> <li>onDocumentWrittenWithAuthContext</li> <li>onSchedule</li> <li>onObjectFinalized</li> <li>onObjectArchived</li> <li>onObjectDeleted</li> <li>onObjectMetadataUpdated</li> </ul> </details> Bear in mind that the OTel attributes for FaaS are still in [Development](https://opentelemetry.io/docs/specs/semconv/faas/faas-spans/) and could change or be removed over time (not sure if we should then even add them in here at this point in time).
Currently, the test in this PR fail: #17789 Root routes can yield an empty transaction name, causing `<unlabeled transaction>` instead of `/` as the transaction name for the root. This happens when the router includes children routes with `index: true`. The route matching is also depending on the `allRoutes` Set. The `allRoutes` Set include the children routes twice (once as children of the route and once as a root element of the Set). When only including them once, it works but parametrization does not work anymore. --> First I thought, this duplication is the cause but probably it isn't ## What’s broken Root cause is in `sendIndexPath(...)`: - Mis-parenthesized ternary picks `stripBasenameFromPathname` instead of `pathBuilder`. - Trimming turns `/` into an empty string.
…on (#17986) Adds support for LangChain manual instrumentation in @sentry/cloudflare and @sentry/vercel-edge. To instrument LangChain operations, create a callback handler with Sentry.createLangChainCallbackHandler and pass it to your LangChain invocations. ``` import * as Sentry from '@sentry/cloudflare'; import { ChatAnthropic } from '@langchain/anthropic'; // Create a LangChain callback handler const callbackHandler = Sentry.createLangChainCallbackHandler({ recordInputs: true, // Optional: record input prompts/messages recordOutputs: true // Optional: record output responses }); // Use with chat models const model = new ChatAnthropic({ model: 'claude-3-5-sonnet-20241022', apiKey: 'your-api-key' }); await model.invoke('Tell me a joke', { callbacks: [callbackHandler] }); ``` The callback handler automatically creates spans for: - Chat model invocations (gen_ai.chat) - LLM invocations (gen_ai.pipeline) - Chain executions (gen_ai.invoke_agent) - Tool executions (gen_ai.execute_tool)
It seems that the size limit was not enforced and a PR could be merged without the job being green:
…7789) Co-authored-by: s1gr1d <sigrid.huemer@posteo.at> Co-authored-by: Sigrid Huemer <32902192+s1gr1d@users.noreply.github.com>
…atibility (#18013) - Migrated from Jest `done` callback to [Promise-based async test pattern](https://vitest.dev/guide/migration.html#done-callback) - Fixed test assertion by adding missing `</head>` tag to trigger `getTraceMetaTags` call (the test did not work before as `getTraceMetaTags` is only called when there is a closing `head` tag - Corrected stream piping logic to properly test transformer functionality The getMetaTagTransformer function internally pipes the transformer TO the bodyStream (`htmlMetaTagTransformer.pipe(body)`). So the correct flow is: 1. Write data to the transformer 2. Transformer processes it and pipes to bodyStream 3. Read the output from bodyStream
…sactions (#17962) Fixes an issue where `pageload` and `navigation` transactions have incorrect (URL-based or wildcard-based) names when the span is cancelled early before lazy routes finish loading. This occurs when `document.hidden` triggers early span cancellation (e.g., user switches tabs during page load). In React Router applications with lazy routes, the parameterized route information may not be available yet when the span ends, resulting in transaction names like `/user/123/edit` (URL-based) or `/projects/*/views/*` (wildcard-based) instead of the correct parameterized route like `/user/:id/edit` or `/projects/:projectId/views/:viewId`. This fix patches `span.end()` to perform a final route resolution check before the span is sent, using the live global `allRoutes` Set to capture any lazy routes that loaded after the span was created but before it ended.
JPeer264
reviewed
Oct 23, 2025
|
|
||
| - **feat(firebase): Instrument cloud functions for firebase v2 ([#17952](https://github.com/getsentry/sentry-javascript/pull/17952))** | ||
|
|
||
| Instrumentation support was added for Firebase Cloud Functions v2, this is enabled automatically. |
Member
There was a problem hiding this comment.
Is this enabled automatically? I am not sure on this one though.
Member
There was a problem hiding this comment.
Following would be the correct term:
Suggested change
| Instrumentation support was added for Firebase Cloud Functions v2, this is enabled automatically. | |
| Instrumentation support was added for Cloud Functions for Firebase v2, this is enabled automatically. |
Member
Author
There was a problem hiding this comment.
It is enabled automatically if tracing is enabled 👍
Bug: Path Normalization FixesThe Additional Locations (1) |
Contributor
size-limit report 📦
|
Contributor
node-overhead report 🧳Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
|
caee127 to
d7c60b6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.