Skip to content

feat: add set_tags for updating multiple tags in one go - #1993

Merged
jpnurmi merged 4 commits into
masterfrom
jpnurmi/feat/set-tags
Aug 14, 2026
Merged

jpnurmi merged 4 commits into
masterfrom
jpnurmi/feat/set-tags

Conversation

@jpnurmi

@jpnurmi jpnurmi commented Aug 14, 2026 •

Copy link
Copy Markdown
Collaborator

Makes a significant difference in terms of performance when updating multiple tags, because out-of-process handlers only need to flush the scope once.

When setting multiple tags, out-of-process handlers only need to flush
the scope once.
@github-actions

github-actions Bot commented Aug 14, 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 bd13e8f

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 36099d1. Configure here.

Comment thread src/sentry_scope.c

@JoshuaMoelans JoshuaMoelans left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

very nice, simple, yet elegant improvement 🚀 did you happen to benchmark how much this enhances performance 👀

@jpnurmi

jpnurmi commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator Author

very nice, simple, yet elegant improvement 🚀 did you happen to benchmark how much this enhances performance 👀

Very rough numbers measured on Windows using QueryPerformanceFrequency + QueryPerformanceCounter:

Before (~2-4 ms)

sentry_set_tag("foo", "111");
sentry_set_tag("bar", "222");
sentry_set_tag("baz", "333");
sentry_set_tag("qux", "444");

After (~0.5-1 ms)

sentry_value_t tags = sentry_value_new_object();
sentry_value_set_by_key(tags, "foo", sentry_value_new_string("111"));
sentry_value_set_by_key(tags, "bar", sentry_value_new_string("222"));
sentry_value_set_by_key(tags, "baz", sentry_value_new_string("333"));
sentry_value_set_by_key(tags, "qux", sentry_value_new_string("444"));
sentry_set_tags(tags);
  • with external crash reporter enabled, causing extra work during scope flush

@jpnurmi

jpnurmi commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator Author

Q: set_tags vs. update_tags?

  • sentry-unreal has USentryScope::SetTags
  • sentry-native has update_context which is not the same thing but there's some similarity

@codecov

codecov Bot commented Aug 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.23%. Comparing base (1047c2f) to head (bd13e8f).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1993      +/-   ##
==========================================
- Coverage   75.56%   74.23%   -1.34%     
==========================================
  Files          91      104      +13     
  Lines       22129    25701    +3572     
  Branches     3948     4640     +692     
==========================================
+ Hits        16722    19078    +2356     
- Misses       4542     5314     +772     
- Partials      865     1309     +444     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jpnurmi
jpnurmi requested a review from tustanivsky August 14, 2026 11:05
@jpnurmi

jpnurmi commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator Author

Q: set_tags vs. update_tags?

  • sentry-unreal has USentryScope::SetTags
  • sentry-native has update_context which is not the same thing but there's some similarity

let's keep set_tags because it calls set_tag in a loop, so it's literally a plural version of set_tag

@jpnurmi
jpnurmi merged commit 0626940 into master Aug 14, 2026
66 checks passed
@jpnurmi
jpnurmi deleted the jpnurmi/feat/set-tags branch August 14, 2026 13:18
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
sentry-native 0.16.4

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**:

- Windows: report WINE and Proton metadata in a separate runtime context. ([#1995](getsentry/sentry-native#1995))
- Add a public custom HTTP transport client interface (`sentry_http_transport_new`) so applications can plug in their own HTTP client (e.g. platform-native ones) while sentry-native continues to own request queueing, retry/backoff, offline caching, rate-limiting, and client reports. The built-in curl and WinHTTP transports are now implemented against this same interface. ([#1987](getsentry/sentry-native#1987))
- Native/Windows: capture WER report ID and expose as `contexts.wer.report_id` in crash events when the WER integration is enabled. ([#1970](getsentry/sentry-native#1970))
- Add `sentry_set_tags` and `sentry_scope_set_tags` for updating multiple tags with a single scope flush, improving bulk-update performance. ([#1993](getsentry/sentry-native#1993))
- Add `on_crashed_last_run` callback for inspecting crash envelopes from previous runs. ([#1985](getsentry/sentry-native#1985))
- Add `sentry_get_last_event_id` and `sentry_scope_get_last_event_id` for retrieving the last event ID captured with the global or given scope, respectively. ([#1992](getsentry/sentry-native#1992))
- Native/Unix: The native crash daemon now loads `libcurl` dynamically at runtime by default when `SENTRY_LINK_CURL=AUTO`, avoiding `libcurl` linker work during process startup and significantly speeding up startup time. Explicitly set `SENTRY_LINK_CURL=ON` to link it directly. ([#1955](getsentry/sentry-native#1955))
- Add missing public scope mutators: `set_release`, `set_environment`, `set_transaction`, `remove_tag`, `remove_extra`, `remove_context`, and `remove_attachment`. ([#2011](getsentry/sentry-native#2011))

**Deprecations**:

- Deprecate `sentry_options_get/set_enable_logs` and `sentry_options_get/set_enable_metrics`. ([#2000](getsentry/sentry-native#2000))

**Fixes**:

- Native: store daemon logs, minidumps, crash envelopes, and scratch files in `.run` directories so they are cleaned up with the run instead of accumulating in the database root. Minidumps can still be retained with `cache_keep`, which stores `.dmp` sidecars alongside cached envelopes. ([#1976](getsentry/sentry-native#1976))
- Linux/ARM32: prevent recursive crashes when libunwind receives an unmapped initial instruction pointer during crash handling. ([#1977](getsentry/sentry-native#1977))
- Improve log and metric delivery when telemetry is captured faster than envelopes can be serialized by offloading serialization to an internal thread pool. ([#1946](getsentry/sentry-native#1946))
- Wine: fix OS version detection and cross-compiling Windows builds from Linux. ([#2001](getsentry/sentry-native#2001))
- Destroy condition variables as approriate when no longer needed. ([#2004](getsentry/sentry-native#2004))
- Crashpad/Windows: preserve module CodeView UUIDs for minimal PDB70 records with empty PDB filenames. ([#2003](getsentry/sentry-native#2003))
- Native/Windows: improve crash-processing performance for applications with many threads. ([#2018](getsentry/sentry-native#2018))
- Prevent a race between SDK reinitialization and cleanup of the previous curl client when libcurl is linked directly. ([#2015](https://github.com/getsentry/sentry-native/pull/2015))</pre>
  <p>View the full release notes at <a href="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/getsentry/sentry-native/releases/tag/0.16.4">https://github.com/getsentry/sentry-native/releases/tag/0.16.4</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!17725
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.

3 participants