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

Raven.tags_context is not working - I don't see any tags in my Sentry errors #918

Closed
ndbroadbent opened this issue Sep 17, 2019 · 3 comments
Assignees
Projects

Comments

@ndbroadbent
Copy link

I'm trying to send some extra tags with my Sentry error reports, but they aren't showing up in Sentry. I set up the Sentry config in a file at config/initializers/sentry.rb:

  Raven.tags_context(
    region: ENV['REGION'],
    domain: ENV['DOMAIN_NAME'],
    service: Sidekiq.server? ? :worker : :web
  )

These tags aren't showing up for either Sidekiq jobs, nor for controller actions:

Screen Shot 2019-09-17 at 3 23 35 PM

Should I be calling Raven.tags_context somewhere else, or I am doing this wrong? Thanks!

@grncdr
Copy link

grncdr commented Feb 12, 2020

We have very similar code in the same initializer file and also don't see any tags in Sentry itself.

We are using Rails 5 + Unicorn, is that the same for you @ndbroadbent ?

@st0012 st0012 self-assigned this Aug 6, 2020
@st0012 st0012 added this to the 3.0.1 milestone Aug 6, 2020
@st0012 st0012 added this to High priority in 3.x Aug 6, 2020
@mattmcf
Copy link

mattmcf commented Aug 13, 2020

We are also seeing issues where a block defined with .tags_context and .extra_context is not tagging the events.

def with_error_context(&block)
  Raven.tags_context("organization_id" => @organization.id) do
    Raven.extra_context("description" => @organization.description, &block)
  end
end

And the errors are not getting tagged with the information in the wrapping blocks.

@st0012 st0012 modified the milestones: 3.0.1, 3.1.0 Aug 14, 2020
@st0012
Copy link
Collaborator

st0012 commented Aug 27, 2020

@ndbroadbent Raven.tags_context is meant to be used like

Raven.tags_context(interesting: 'yes') do
  # the `interesting: 'yes'` tag will only present in the requests sent inside the block
  Raven.capture_exception(exception)
end

If you want to add tags globally, try:

    Raven.configure do |config|
      config.tags.merge!(foo: "bar")
    end

@st0012 st0012 removed this from the 3.1.0 milestone Aug 27, 2020
@st0012 st0012 closed this as completed Jan 2, 2021
3.x automation moved this from High priority to Closed Jan 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
3.x
  
Closed
Development

No branches or pull requests

4 participants