-
Notifications
You must be signed in to change notification settings - Fork 376
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
Add support for the kicks
gem
#4253
base: master
Are you sure you want to change the base?
Conversation
Thank you for updating Change log entry section 👏 Visited at: 2025-01-09 11:52:07 UTC |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4253 +/- ##
==========================================
- Coverage 97.73% 97.73% -0.01%
==========================================
Files 1352 1352
Lines 82409 82464 +55
Branches 4224 4229 +5
==========================================
+ Hits 80545 80595 +50
- Misses 1864 1869 +5 ☔ View full report in Codecov by Sentry. |
@@ -1112,6 +1112,32 @@ end | |||
| --------- | ------------------------------- | ------ | -------------------------------------------- | ------- | | |||
| `enabled` | `DD_TRACE_KAFKA_ENABLED` | `Bool` | Whether the integration should create spans. | `true` | | |||
|
|||
### Kicks | |||
|
|||
The Kicks integration is a server-side middleware which will trace job executions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Kicks integration is a server-side middleware which will trace job executions. | |
The Kicks integration is a server-side middleware that traces job executions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I noticed most of these were copy-pasted from the sneakers docs, so we should probably propagate the improvements to both)
The Kicks integration is a server-side middleware which will trace job executions. | ||
|
||
<div class="alert alert-warning"> | ||
Kicks is a continuation of Sneakers and both cannot be active at the same time, as they share their Ruby class namespace. Configurations to the Sneakers integration will be safely merged with any Kicks configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kicks is a continuation of Sneakers and both cannot be active at the same time, as they share their Ruby class namespace. Configurations to the Sneakers integration will be safely merged with any Kicks configuration. | |
Kicks is a continuation of Sneakers. Because Kicks and Sneakers share a Ruby class namespace, they cannot both be active at the same time. Configurations to the Sneakers integration is safely merged with any Kicks configuration. |
| ---------- | - | ----- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | | ||
| `enabled` | `DD_TRACE_SNEAKERS_ENABLED` | `Bool` | Whether the integration should create spans. | `true` | | ||
| `tag_body` | | `Bool` | Enable tagging of job message. `true` for on, `false` for off. | `false` | | ||
| `on_error` | | `Proc` | Custom error handler invoked when a job raises an error. Provided `span` and `error` as arguments. Sets error on the span by default. Useful for ignoring transient errors. | `proc { \|span, error\| span.set_error(error) unless span.nil? }` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `on_error` | | `Proc` | Custom error handler invoked when a job raises an error. Provided `span` and `error` as arguments. Sets error on the span by default. Useful for ignoring transient errors. | `proc { \|span, error\| span.set_error(error) unless span.nil? }` | | |
| `on_error` | | `Proc` | Custom error handler invoked when a job raises an error. Provides `span` and `error` as arguments. Sets error on the span by default. Useful for ignoring transient errors. | `proc { \|span, error\| span.set_error(error) unless span.nil? }` | |
@@ -1935,6 +1961,10 @@ end | |||
|
|||
The Sneakers integration is a server-side middleware which will trace job executions. | |||
|
|||
<div class="alert alert-warning"> | |||
Kicks is a continuation of Sneakers and both cannot be active at the same time, as they share their Ruby class namespace. Configurations to the Sneakers integration will be safely merged with any Kicks configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kicks is a continuation of Sneakers and both cannot be active at the same time, as they share their Ruby class namespace. Configurations to the Sneakers integration will be safely merged with any Kicks configuration. | |
Kicks is a continuation of Sneakers. Because Kicks and Sneakers share a Ruby class namespace, they cannot both be active at the same time. Configurations to the Sneakers integration is safely merged with any Kicks configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM Looks really nice :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually noticed that this file was still being ignored in the Steepfile
, but can safely be enabled (passes typecheck), so may be worth including that in this PR ;)
# @public_api Changing the integration name or integration options can cause breaking changes | ||
register_as :sneakers, auto_patch: true | ||
|
||
register_as_alias :sneakers, :kicks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that for register_as_alias
the auto_patch
is always false -- is that because it reuses the auto_patch
from the register_as
? (If so, maybe that's a useful comment to leave somewhere, perhaps in the register_as_alias
?)
@@ -1112,6 +1112,32 @@ end | |||
| --------- | ------------------------------- | ------ | -------------------------------------------- | ------- | | |||
| `enabled` | `DD_TRACE_KAFKA_ENABLED` | `Bool` | Whether the integration should create spans. | `true` | | |||
|
|||
### Kicks | |||
|
|||
The Kicks integration is a server-side middleware which will trace job executions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I noticed most of these were copy-pasted from the sneakers docs, so we should probably propagate the improvements to both)
@@ -131,7 +133,6 @@ | |||
gem 'roda', '>= 2.0.0' | |||
gem 'semantic_logger', '~> 4.0' | |||
gem 'sidekiq', '~> 7' | |||
gem 'sneakers', '>= 2.12.0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this change be propagated to the other appraisal files as well? Noticed the others still list sneakers
under contrib
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand this approach to support kicks
.
However, I am a little bit concern about
kicks
gem decided to rename the modules and paths in the future- The span data is decorated with the obsolete name
sneakers
can cause confusion
I am overall supportive because (1) might not happen in the future and (2) we could make the risk explicit in the documentation.
I might even push to deprecate sneakers
integration and replace it completely with kicks
in the next major release.
@@ -131,7 +133,6 @@ | |||
gem 'roda', '>= 2.0.0' | |||
gem 'semantic_logger', '~> 4.0' | |||
gem 'sidekiq', '~> 7' | |||
gem 'sneakers', '>= 2.12.0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marcotc Do you struggle to remove sneakers
from other runtimes? Do you need my help on this?
# The last version of Sneakers is 2.12.0. | ||
# The first version of Kicks is 3.0.0. We currently support all versions of Kicks. | ||
# | ||
# @see https://github.com/jondot/sneakers/commit/9780692624c666b6db8266d2d5710f709cb0f2e2 | ||
def self.version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They kept everything the same, even the file paths (require 'sneakers') and module names (::Sneakers).
kicks
even continue the semantic version to avoid conflict with the obsolete gem.
Correct me if I am wrong. Due to this, I assume the easiest path to support kicks
is to change self.version
with the conditional logic of kicks
from Gem.loaded_specs
. Do we need register_as_alias
to support kicks
?
@@ -202,6 +202,8 @@ | |||
build_coverage_matrix('stripe', 7..12, min: '5.15.0') | |||
build_coverage_matrix('opensearch', 2..3, gem: 'opensearch-ruby') | |||
build_coverage_matrix('elasticsearch', 7..8) | |||
build_coverage_matrix('kicks', [], min: '3.0.0') | |||
build_coverage_matrix('sneakers', [], min: '2.12.0', latest: false) # Sneakers is not receiving updates anymore and 2.12.0 is the last version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually think we don't need to invoke build_coverage_matrix
with latest: false
, since this method call only generate a single group.
Prefer the following for explicitness
appraisal 'sneakers-min' do
gem 'sneakers', '= 2.12.0'
end
# @param [Hash] meta optional, additional metadata (development dependencies, etc.) for the group | ||
def build_coverage_matrix(integration, range, gem: integration, min: nil, latest: true, meta: {}) | ||
# Allow single version to be passed easily | ||
range = range..range if range.is_a?(Integer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
range = range..range if range.is_a?(Integer) | |
range = Array(range) |
I'm guessing they would rename on a major version, so we'd probably want to support the 3.x series (with sneakers naming) for a while? Looking at their readme, it seems the main objective was "original author was unresponsive, community had a few pending patches": ...so yeah doesn't look like the kind of project that will refactor just for the sake of making the name prettier ;) |
Fixes #4191
Kicks is a fork/continuation of the
sneakers
gem (announcement).Change log entry
Yes. Add support for the
kicks
gemAdditional Notes:
They kept everything the same, even the file paths (
require 'sneakers'
) and module names (::Sneakers
).I created an alias for
instrument :kicks
toinstrument :sneakers
, to allow users to use the name that matches their installed gem name. They share the same internal objects and configuration settings.How to test the change?