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 ourterms of serviceand privacy statement.We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ActiveSupport tracer for cache module #2380

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

frederikspang
Copy link

@frederikspang frederikspang commented Aug 16, 2024

Description

Implement child spans for ActiveSupport cache according tohttps://docs.sentry.io/platforms/ruby/tracing/instrumentation/custom-instrumentation/caches-module/

Todo:

  • Specs

Copy link

codecov bot commented Aug 27, 2024

CodecovReport

Attention: Patch coverage is97.19626%with3 linesin your changes missing coverage. Please review.

Project coverage is 98.68%. Comparing base(4db5f74)to head(6eaf81b).

Files Patch % Lines
.../sentry/rails/tracing/active_support_subscriber.rb 87.50% 3 Missing⚠️
Additional details and impacted files
@@ Coverage Diff @@
## master #2380 +/- ##
==========================================
-Coverage 98.69% 98.68% -0.02%
==========================================
Files 210 212 +2
Lines 13923 14028 +105
==========================================
+Hits 13741 13843 +102
-Misses 182 185 +3
Components Coverage Δ
sentry-ruby 99.06% <ø> (ø)
sentry-rails 97.33% <97.19%> (-0.01%) ⬇️
sentry-sidekiq 97.07% <ø> (ø)
sentry-resque 97.11% <ø> (ø)
sentry-delayed_job 98.92% <ø> (ø)
sentry-opentelemetry 100.00% <ø> (ø)
Files Coverage Δ
sentry-rails/lib/sentry/rails/configuration.rb 97.50% <100.00%> (+0.06%) ⬆️
...ntry-rails/spec/sentry/rails/configuration_spec.rb 100.00% <100.00%> (ø)
...ry/rails/tracing/active_support_subscriber_spec.rb 100.00% <100.00%> (ø)
.../sentry/rails/tracing/active_support_subscriber.rb 87.50% <87.50%> (ø)

Copy link
Member

@sl0thentr0py sl0thentr0py left a comment

Choose a reason for hiding this comment

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

thanks a lot@frederikspang,left a couple of comments.
I will test this out a bit when I have some time with our product.
There are also some other types that are not covered (such ascache_read_multi) that I will also think about the best way to handle.

op: operation_name(event_name),
origin: SPAN_ORIGIN,
start_timestamp: payload[START_TIMESTAMP_NAME],
description: payload[:service],
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

You're absolutely right. That's a bad leftover from activestorage instrumentation! I'll have a look at this one tomorrow.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

Be my guest! I'm happy to resolve the errors in here and in#2383(Also from me/us:) )

I've pushed initial changes, but I am not running a full test suite - I'll get that up and running locally as well.

Any way to accept CI runs from this PR automatically? Instead of manual approval each time I do changes:)

Copy link
Author

Choose a reason for hiding this comment

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

One thing - Before I go around pure anarchy in terms ofmake_basic_app.With the current set up I am unable to change the Rails.cache store to a memory store, because the block is yielded from an initializer - After initializing the rails app and cache store (Filestore by default).

I can either change the store for allmake_basic_appsetup (Which shouldn't affect much), or we can introduce a new parameter tomake_basic_app(cache_store:),but that seems like a bad direction to go.

The issue in specs is, that the Prune method, only works for memorystore.

When that is settled, I'll write specs for all of the other Rails.cache.* methods

Copy link
Author

Choose a reason for hiding this comment

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

Got you! I've added specs for increment and decrement, and marked these as skipped for Rails < 8.0 - That should prepare them for having Rails 8.0 in testing matrix, and being included there.

Copy link
Author

Choose a reason for hiding this comment

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

Unless we want to introduce Redis or Memcached in the testing, which is a separate container for the GitHub Actions workflow.

Copy link
Author

Choose a reason for hiding this comment

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

@sl0thentr0pyDo we need anything else here except internal QA/processing from you guys?
We're looking forward to having this merged soon!

Copy link
Member

Choose a reason for hiding this comment

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

no I will take care of this next week, sorry just swamped with another big feature

Copy link
Author

Choose a reason for hiding this comment

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

No worries!

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