Skip to content

ref(core): Simplify addResponseAttributes in openai integration - #20013

Merged
nicohrubec merged 6 commits into
developfrom
nh/openai-simplify-response-attributes
Apr 2, 2026
Merged

ref(core): Simplify addResponseAttributes in openai integration#20013
nicohrubec merged 6 commits into
developfrom
nh/openai-simplify-response-attributes

Conversation

@nicohrubec

@nicohrubecnicohrubec commented Mar 27, 2026

Copy link
Copy Markdown
Member

addResponseAttributes in the openai integration had a lot of convoluted special handling for setting attributes across different OpenAI APIs (chat completions, responses API, embeddings, conversations). To reduce complexity, this inlines everything into one helper that simply sets attributes if they are present on the response, rather than branching by API type.

@github-actions

github-actionsBot commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (core, node) Portable Express integration by isaacs in #19928
  • (deno) Add denoRuntimeMetricsIntegration by chargome in #20023
  • (deps) Bump @xmldom/xmldom from 0.8.3 to 0.8.12 by dependabot in #20066

Internal Changes 🔧

Core

  • Simplify addResponseAttributes in openai integration by nicohrubec in #20013
  • Extract shared endStreamSpan for AI integrations by nicohrubec in #20021
  • Remove provider-specific AI span attributes in favor of gen_ai attributes in sentry conventions by nicohrubec in #20011

🤖 This preview updates automatically when you update the PR.

@github-actions

github-actionsBot commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

PathSize% ChangeChange
@sentry/browser25.65 kB+0.02%+5 B 🔺
@sentry/browser - with treeshaking flags24.14 kB+0.03%+5 B 🔺
@sentry/browser (incl. Tracing)42.16 kB+0.02%+7 B 🔺
@sentry/browser (incl. Tracing, Profiling)46.77 kB+0.02%+9 B 🔺
@sentry/browser (incl. Tracing, Replay)80.94 kB+0.01%+5 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags70.56 kB+0.01%+5 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas)85.66 kB+0.01%+8 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback)97.92 kB+0.01%+5 B 🔺
@sentry/browser (incl. Feedback)42.42 kB+0.02%+6 B 🔺
@sentry/browser (incl. sendFeedback)30.31 kB+0.02%+6 B 🔺
@sentry/browser (incl. FeedbackAsync)35.29 kB+0.02%+6 B 🔺
@sentry/browser (incl. Metrics)26.96 kB+0.03%+7 B 🔺
@sentry/browser (incl. Logs)27.11 kB+0.03%+7 B 🔺
@sentry/browser (incl. Metrics & Logs)27.78 kB+0.03%+7 B 🔺
@sentry/react27.41 kB+0.03%+6 B 🔺
@sentry/react (incl. Tracing)44.48 kB+0.02%+5 B 🔺
@sentry/vue30.08 kB+0.02%+5 B 🔺
@sentry/vue (incl. Tracing)44.05 kB+0.02%+8 B 🔺
@sentry/svelte25.67 kB+0.02%+5 B 🔺
CDN Bundle28.32 kB+0.03%+6 B 🔺
CDN Bundle (incl. Tracing)43.11 kB+0.02%+6 B 🔺
CDN Bundle (incl. Logs, Metrics)29.68 kB+0.02%+4 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics)44.16 kB+0.02%+7 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics)68.48 kB+0.01%+6 B 🔺
CDN Bundle (incl. Tracing, Replay)80.01 kB+0.01%+7 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics)81.05 kB+0.01%+6 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback)85.55 kB+0.01%+5 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics)86.58 kB+0.01%+6 B 🔺
CDN Bundle - uncompressed82.68 kB+0.03%+22 B 🔺
CDN Bundle (incl. Tracing) - uncompressed127.83 kB+0.02%+22 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed86.83 kB+0.03%+22 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed131.24 kB+0.02%+22 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed209.81 kB+0.02%+22 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed244.7 kB+0.01%+22 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed248.1 kB+0.01%+22 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed257.62 kB+0.01%+22 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed261 kB+0.01%+22 B 🔺
@sentry/nextjs (client)46.9 kB+0.02%+7 B 🔺
@sentry/sveltekit (client)42.62 kB+0.02%+7 B 🔺
@sentry/node-core55.77 kB+0.04%+17 B 🔺
@sentry/node172.04 kB-0.42%-710 B 🔽
@sentry/node - without tracing96.05 kB+0.05%+40 B 🔺
@sentry/aws-serverless112.81 kB+0.03%+30 B 🔺

View base workflow run

@github-actions

github-actionsBot commented Mar 27, 2026

Copy link
Copy Markdown
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.

ScenarioRequests/s% of BaselinePrev. Requests/sChange %
GET Baseline9,388-9,319+1%
GET With Sentry1,73819%1,697+2%
GET With Sentry (error only)5,89163%5,860+1%
POST Baseline1,185-1,190-0%
POST With Sentry59550%593+0%
POST With Sentry (error only)1,03888%1,061-2%
MYSQL Baseline3,198-3,265-2%
MYSQL With Sentry43714%460-5%
MYSQL With Sentry (error only)2,58381%2,622-1%

View base workflow run

@nicohrubec
nicohrubecforce-pushed the nh/openai-simplify-response-attributes branch from a4f3bbc to 8b62c33CompareMarch 27, 2026 13:19
@nicohrubecnicohrubec changed the title Nh/OpenAI simplify response attributesref(core): Simplify addResponseAttributes in openai integrationMar 27, 2026
# Conflicts:
#	packages/core/src/tracing/openai/streaming.ts
#	packages/core/src/tracing/openai/utils.ts
# Conflicts:
#	packages/core/src/tracing/openai/streaming.ts
@nicohrubec
nicohrubec marked this pull request as ready for review April 1, 2026 09:28
@nicohrubec
nicohrubec merged commit d0bbc1a into developApr 2, 2026
241 checks passed
@nicohrubec
nicohrubec deleted the nh/openai-simplify-response-attributes branch April 2, 2026 07:11
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@nicohrubec@JPeer264@andreiborza