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

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