Skip to content

feat: add sentry_update_context - #1835

Merged
JoshuaMoelans merged 7 commits into
masterfrom
joshua/feat/merge_context
Jul 2, 2026
Merged

JoshuaMoelans merged 7 commits into
masterfrom
joshua/feat/merge_context

Conversation

@JoshuaMoelans

@JoshuaMoelans JoshuaMoelans commented Jul 1, 2026 •

Copy link
Copy Markdown
Member

Adding this for downstream SDKs, so they can avoid fully overwriting pre-set context from our native SDK init.

Popped up as part of https://github.com/getsentry/sentry-xbox/pull/151 where the unreal integration test calls AddDeviceContext which does a plain set_by_key, making us lose device.X context set by the console SDK.

Now with sentry_update_context we only overwrite existing keys' values, and also add the new keys from the passed-in object to the context. For example

ctx={a:0, b:1, c:2}
sentry_update_context(ctx, {a:-1, d:3})
// ctx becomes {a:-1, b:1, c:2, d:3}

@JoshuaMoelans JoshuaMoelans changed the title feat: add sentry_merge_context (WIP) feat: add sentry_merge_context Jul 1, 2026
Comment thread src/sentry_core.c Resolved
Comment thread src/sentry_core.c Resolved
Comment thread include/sentry.h Resolved
Comment thread include/sentry.h Resolved
- does the same but different, updating overwrites values of keys that collide & adds the new passed-in-value's keys to the context too. (before, it would NOT overwrite, only add)
@JoshuaMoelans JoshuaMoelans changed the title (WIP) feat: add sentry_merge_context feat: add sentry_update_context Jul 2, 2026
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 7ddd241

@jpnurmi jpnurmi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@JoshuaMoelans
JoshuaMoelans merged commit 8ae6676 into master Jul 2, 2026
98 of 99 checks passed
@JoshuaMoelans
JoshuaMoelans deleted the joshua/feat/merge_context branch July 2, 2026 12:44
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
sentry-native 0.15.3

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.

- [ ] `resource` blocks have been checked for updates.
<details>
  <summary>release notes</summary>
  <pre>**Features**

- Android: Expose app-hang detection through the NDK bindings via `NdkOptions.setEnableAppHangTracking()` and `NdkOptions.setAppHangTimeoutMillis()`. ([#1823](getsentry/sentry-native#1823))
- Windows: add wide-char versions of `sentry_capture_minidump` and `sentry_capture_minidump_n`. ([#1827](getsentry/sentry-native#1827))
- Add `sentry_update_context` to allow updating already set context objects with new key-value pairs, as well as new values for existing keys. ([#1835](getsentry/sentry-native#1835))

**Fixes**:

- Native/Windows: ensure valid event IDs for fast-fail crash envelopes to fix launching of the external crash reporter for fast-fail crashes. ([#1832](getsentry/sentry-native#1832))
- Native/Linux: resolve symbols from split-debug files on Linux. ([#1836](https://github.com/getsentry/sentry-native/pull/1836))</pre>
  <p>View the full release notes at <a href="https://github.com/getsentry/sentry-native/releases/tag/0.15.3">https://github.com/getsentry/sentry-native/releases/tag/0.15.3</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!13728
Sign up for free to 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.

2 participants