Skip to content
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

Allow custom tags to be passed when using the ActiveSupport::ErrorReporter #1932

Conversation

BobbyMcWho
Copy link
Contributor

@BobbyMcWho BobbyMcWho commented Nov 3, 2022

Description

Allows for passing tags within the ActiveRecord::ErrorReporter context, to properly be sent to Sentry. I noticed that this file lacks spec coverage, should I add a spec file for it?

Q: context[:tags] or context[:sentry_tags] ?

Copy link
Collaborator

@st0012 st0012 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR 👍
I think we can use tags first as I can't think of any potential conflicts yet.

Can you also add a few cases for it? For example:

  • It works when context[:tags] is a Hash and doesn't mutates context
  • It doesn't break when context[:tags] is a non-Hash

sentry-rails/lib/sentry/rails/error_subscriber.rb Outdated Show resolved Hide resolved
@BobbyMcWho
Copy link
Contributor Author

@st0012 Added the suggested changes, mind approving the workflow runs?

@codecov-commenter
Copy link

codecov-commenter commented Nov 11, 2022

Codecov Report

Base: 98.41% // Head: 98.10% // Decreases project coverage by -0.31% ⚠️

Coverage data is based on head (26db53c) compared to base (f466ed3).
Patch coverage: 38.63% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1932      +/-   ##
==========================================
- Coverage   98.41%   98.10%   -0.32%     
==========================================
  Files         156      158       +2     
  Lines        9793     9847      +54     
==========================================
+ Hits         9638     9660      +22     
- Misses        155      187      +32     
Impacted Files Coverage Δ
sentry-rails/lib/sentry/rails/error_subscriber.rb 38.46% <0.00%> (ø)
...y-rails/spec/sentry/rails/error_subscriber_spec.rb 41.46% <41.46%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@BobbyMcWho BobbyMcWho force-pushed the allow-custom-tags-using-active_support-error_reporter branch from 9671040 to 63bcfbe Compare November 12, 2022 01:11
@BobbyMcWho
Copy link
Contributor Author

@st0012 does the inclusion of the spec break non rails-7 tests?

@st0012
Copy link
Collaborator

st0012 commented Nov 15, 2022

We also have integration tests for the error reporter here. We can still use the unit tests you added but you need to skip them for Rails 7.0-

@BobbyMcWho
Copy link
Contributor Author

Alright @st0012, I believe cb032e9 should resolve the suite failures

@BobbyMcWho
Copy link
Contributor Author

Is it just jruby that's failing now? Is it the new jruby release?

Copy link
Collaborator

@st0012 st0012 left a comment

Choose a reason for hiding this comment

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

The JRuby failure should have been fixed on master.
The tests look good but I think we can still improve the implementation. Also, can you add a changelog entry for this PR? Thx

sentry-rails/lib/sentry/rails/error_subscriber.rb Outdated Show resolved Hide resolved
Copy link
Collaborator

@st0012 st0012 left a comment

Choose a reason for hiding this comment

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

Looks good and thanks for the work 👍
We still need a changelog entry to merge this though 🙂

@st0012 st0012 modified the milestones: 6.0.0, 5.7.0 Dec 1, 2022
@BobbyMcWho BobbyMcWho force-pushed the allow-custom-tags-using-active_support-error_reporter branch from 73c197c to 30f4273 Compare December 2, 2022 19:52
@BobbyMcWho
Copy link
Contributor Author

Sorry about that @st0012, been majorly busy with things. If there's any way to get this into a 5.7.1 release that would be lovely, else we can pin to a ref I suppose.

@st0012
Copy link
Collaborator

st0012 commented Dec 3, 2022

@BobbyMcWho I think it's a feature so it needs to wait for the next minor/major release, which will probably happen around Christmas 🙂

@st0012 st0012 enabled auto-merge (squash) December 3, 2022 11:19
@st0012 st0012 disabled auto-merge December 3, 2022 11:20
@st0012 st0012 enabled auto-merge (squash) December 3, 2022 11:20
@BobbyMcWho
Copy link
Contributor Author

Okay, giving it a thought I can shut off the auto instrumented one and just add a custom subscriber to our app in the meantime, so that's fine!

@st0012
Copy link
Collaborator

st0012 commented Dec 3, 2022

I do want to merge it into master though so you can just use the GH source. But for some reason it doesn't allow me to merge even with all checks passing.
@sl0thentr0py Can you help me merge this? I'm not sure what's blocking it.

@sl0thentr0py
Copy link
Member

hmm this is because danger can't update status on a forked PR

Warning: Running from a forked repo. Danger won’t be able to post comments and workflow status on the main repo, printing directly.

will see what to do

@st0012 st0012 merged commit 52de12e into getsentry:master Dec 7, 2022
@st0012 st0012 modified the milestones: 6.0.0, 5.8.0 Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants