Skip to content

Add SentrySdk.SetTag #4228 #4232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 30, 2025
Merged

Conversation

KnapSac
Copy link
Contributor

@KnapSac KnapSac commented May 30, 2025

I also added SentrySdk.UnsetTag, because it feels closely related with SetTag.

Some questions I had while implementing this:

  • Hub.ConfigureScope wraps the call to ScopeManager.ConfigureScope in a try/catch, would that be appropriate for these methods too? E.g. PushScope doesn't use a try/catch.
    public void ConfigureScope(Action<Scope> configureScope)
    {
    try
    {
    ScopeManager.ConfigureScope(configureScope);
    }
    catch (Exception e)
    {
    _options.LogError(e, "Failure to ConfigureScope");
    }
    }
  • There is an extension method on IHasTags which can set multiple tags at once. Does it make sense to add it to SentrySdk too?
    public static void SetTags(this IHasTags hasTags, IEnumerable<KeyValuePair<string, string>> tags)

Copy link

codecov bot commented May 30, 2025

Codecov Report

Attention: Patch coverage is 85.71429% with 2 lines in your changes missing coverage. Please review.

Project coverage is 73.07%. Comparing base (495e742) to head (a295305).
Report is 618 commits behind head on main.

Files with missing lines Patch % Lines
src/Sentry/Extensibility/HubAdapter.cs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4232      +/-   ##
==========================================
- Coverage   75.73%   73.07%   -2.66%     
==========================================
  Files         357      456      +99     
  Lines       13466    16529    +3063     
  Branches     2671     3286     +615     
==========================================
+ Hits        10198    12079    +1881     
- Misses       2593     3609    +1016     
- Partials      675      841     +166     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@bruno-garcia bruno-garcia left a comment

Choose a reason for hiding this comment

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

Perfect! Thank you so much for adding this

@bruno-garcia bruno-garcia merged commit bc1e4f1 into getsentry:main May 30, 2025
34 checks passed
@KnapSac KnapSac deleted the feat/4228/set-tag branch May 30, 2025 16:50
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.

None yet

2 participants