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

Tag queue name and jid on sidekiq events #1258

Merged
merged 2 commits into from
Jan 31, 2021
Merged

Tag queue name and jid on sidekiq events #1258

merged 2 commits into from
Jan 31, 2021

Conversation

st0012
Copy link
Collaborator

@st0012 st0012 commented Jan 31, 2021

截圖 2021-02-01 上午12 02 22

@st0012 st0012 added this to the 4.2.0 milestone Jan 31, 2021
@st0012 st0012 self-assigned this Jan 31, 2021
@st0012 st0012 merged commit d616c07 into 4-2 Jan 31, 2021
@st0012 st0012 deleted the tag-sidekiq-workers branch January 31, 2021 16:13
st0012 added a commit that referenced this pull request Feb 3, 2021
* Add ThreadsInterface (#1178)

* Add ThreadsInterface

* Update changelog

* Inspect exception cause by default & don't exclude ActiveJob::DeserializationError  (#1180)

* Turn on inspect_exception_causes_for_exclusion by default

With this config turned on, we can avoid matching the surface exceptions
in integrations, which could cause issues like #1071.

Solves #642.

* Remove ActiveJob::DeserializationError from ignored list

Since the previous commit solves #642, this commit can remove
ActiveJob::DeserializationError from the ignored exceptions list.

Solves #1071.

* Update async document

* Update changelog

* Make sentry-rails a Rails engine and provide default job class for async (#1181)

* Make sentry-rails a Rails engine too

* Add Sentry::SendEventJob

Instead of letting users defining their SentryJob class, we should
provide a default job class for them.

* Update document and example for the new job class

* Update changelog

* Add configuration option for trusted proxies (#1126)

* Add configuration option for trusted proxies

* Add `trusted_proxies` configuration option to sentry-ruby
* Add existing ActionDispatch `trusted_proxies` values

* Address some PR feedback

* Isolate trusted proxy test configuration
* Add comments to explain why we reverse the forwarded_for ip list
* Call `uniq` on the trusted proxy list
* Rename `filter_local_addresses(ips) to filter_trusted_proxy_addresses(ips)

* Remove duplicated hash entry

* Update some tests after PR feedback

* retrigger checks

Co-authored-by: Stan Lo <stan001212@gmail.com>

* Only define SendEventJob when ActiveJob is defined

* Allow users to configure ActiveJob adapters to ignore (#1256)

* Allow users to configure ActiveJob adapters to ignore

* Update changelog

* Add sidekiq adapter to sentry-rails' ignored adapters list (#1257)

* Add sidekiq adapter to sentry-rails' ignored adapters list

* Update changelog

* Tag queue name and jid on sidekiq events (#1258)

* Add queue name and jid to event tags

* Update changelog

* Tag job_id and provider_job_id on ActiveJob events (#1259)

* Refactor/test ActiveJob's context data

* Tag job_id and provider_job_id on ActiveJob events

* Update changelog

* Add ability to have many post initialization callbacks (#1261)

* Add ability to have many post initialization callbacks

* Revert version bumping, fix codestyle and rewrite rspec test

* Remove dependenciy bumping from sentry-sidekiq

* Add entries to CHANGELOG

* Support config.before_breadcrumb (#1253)

* Support config.before_breadcrumb

Example:

```
config.before_breadcrumb = lambda do |breadcrumb, hint|
  breadcrumb.message = "foo"
  breadcrumb
end
```

* Update changelog

* Update sentry-ruby's changelog

* Update sentry-rails' changelog

* Update sentry-sidekiq's changelog

* Rename ignored_active_job_adapters to skippable_job_adapters (#1264)

* Update sentry-ruby's changelog

Co-authored-by: Jon-Erik Schneiderhan <45184220+jeschneiderhan@users.noreply.github.com>
Co-authored-by: Valentine Kiselev <mrexox@outlook.com>
st0012 added a commit that referenced this pull request Feb 3, 2021
* Add queue name and jid to event tags

* Update changelog
@ivanovv
Copy link

ivanovv commented Feb 17, 2021

Hey @st0012

Can you clarify one thing – why did you guys decide to add jid to tags and not to the context?

From Sentry docs:

Tags:

We’ll automatically index all tags for an event, as well as the frequency and the last time that Sentry has seen a tag. We also keep track of the number of distinct tags and can assist you in determining hotspots for various issues.

Contexts:

Custom contexts allow you to attach arbitrary data to an event. Often, this context is shared among any issue captured in its lifecycle. You cannot search these, but they are viewable on the issue page

We have 128,741,632 jobs processed by Sidekiq, that means 128,741,632 unique tag values. And I'm sure there are much much bigger numbers out there for systems processing millions of jobs per day.

Is there even a difference between Custom contexts and Tags for Sentry from the perf POV? Or in billing from the customer POV?

@st0012
Copy link
Collaborator Author

st0012 commented Feb 17, 2021

@ivanovv using tags doesn't affect billing. and the purpose is to help search events associated with particular jobs easier. we've been tagging request_id (also unique per event) for web applications for a while, which I found useful for searching events and I haven't seen any issues related to that.

the job id is still present in the Additional Data section like before so you don't really lose anything from this change.

@ivanovv
Copy link

ivanovv commented Feb 17, 2021

@st0012 thanks a lot for the clarification.

It looks like Sentry own documentation is a bit confusing – the docs imply that tags are somewhat expensive from the perf point of view and for random (mostly uniq) values that we don't need search on it is better to use custom contexts. But then in your own integrations you put things like jid and request_id inside tags.

That's just my 2c, maybe I'm overthinking it too much

@st0012
Copy link
Collaborator Author

st0012 commented Feb 17, 2021

you're welcome 🙂
I do think jid needs search support though. with jid being searchable, you can easily get a jid from sidekiq web and use it to search related exceptions in Sentry. when if it's not searchable, mapping a job with its exceptions directly was much harder I think?

@ivanovv
Copy link

ivanovv commented Feb 17, 2021

I do think jid needs search support though. with jid being searchable, you can easily get a jid from sidekiq web and use it to search related exceptions in Sentry. when if it's not searchable, mapping a job with its exceptions directly was much harder I think?

This is the usual Sidekiq log

2021-02-15T14:13:33.745Z 15733 TID-22b5j5 PusherWorker JID-dce5864533171bbec94491f8 INFO: start
2021-02-15T14:13:33.947Z 15733 TID-22b5j5 PusherWorker JID-dce5864533171bbec94491f8 INFO: done: 0.202 sec

Knowing the jid won't provide you much info unless you add more logging, and when you do so the jid is no longer useful.

At least that's my personal perspective from the last 2-3 years of using Sidekiq.
When we were just starting, (7 years ago) I used to care about jids more and sometimes use the pristine Sidekiq log to connect things together, but additional logging (and in case of Sentry – using tags and contexts) is the correct answer here, IMO.

@ivanovv
Copy link

ivanovv commented Feb 17, 2021

Also, one thing I was wrong about – we only send jid in case the job fails, so it won't be millions of jids.

Finally, for retries, the jid being searchable is a great thing because it will allow to see the stack trace easily.

@sandstrom
Copy link

Just gotten started with Sentry. Overall very happy!

But JID and request ID as tags doesn't make sense to me, at least not in some views (two examples below).

Perhaps you should introduce a third category, or a property on tags, to distinguish high cardinality properties?

In short, for any high cardinality tab, skip them in these two views (examples below) and probably a few more places.

These two can be marked high-cardinality in your SDK, and you could also allow custom-added tags to be marked as high_cardinality = true for similar treatment.

CleanShot 2023-11-28 at 19 19 09

CleanShot 2023-11-28 at 19 20 25

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.

3 participants