runtime_analysis-sidekiq 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +9 -0
- data/LICENSE.txt +96 -0
- data/README.md +55 -0
- data/lib/runtime_analysis/sidekiq/version.rb +7 -0
- data/lib/runtime_analysis/sidekiq.rb +38 -0
- data/lib/runtime_analysis-sidekiq.rb +3 -0
- metadata +85 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: f070b654c5580bbef9da313df04709cb50b1c94a20d0ce14c11412a8261494b2
|
|
4
|
+
data.tar.gz: 237b3d78fbed1c16967f64c21ca723a08d6cdf4185e7506611f5f6f805e1f75c
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: b4b7d1a531a48dcd541d24bf08563749e564fb1237db287d344a4d32bc4878ddc23fedf4928a058c5f56a35ffa18733d712b62774da1d503fe3e5e944704d23e
|
|
7
|
+
data.tar.gz: 9e5f65f57ebf42f998c5ebdcf2221d6ecbb5bdd98923384cc9ff466e6f03691001a95cf5604a29d78441796fdc2548499712f99090d5a93851ed7c67c637678e
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [1.0.0] - unreleased
|
|
4
|
+
|
|
5
|
+
- Make each Sidekiq job a request for errors-only recording, named `HardJob#perform`, with a server
|
|
6
|
+
middleware that requiring the gem puts first in a server's chain. This was in `runtime_analysis`
|
|
7
|
+
itself, as a module prepended to `Sidekiq::Processor#process`, a private method. The middleware
|
|
8
|
+
is Sidekiq's supported way in. A failed job is kept whatever the error tracker decides, and a
|
|
9
|
+
tracker told from an error handler is still given where the nil came from.
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
Copyright (c) 2026. All rights reserved.
|
|
2
|
+
|
|
3
|
+
Licensor: Espíritos Algébricos – Unipessoal Lda, Vila Nova de Gaia, Portugal, under licence from the
|
|
4
|
+
copyright owner. The terms are the PolyForm Shield License 1.0.0 below.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# PolyForm Shield License 1.0.0
|
|
9
|
+
|
|
10
|
+
<https://polyformproject.org/licenses/shield/1.0.0>
|
|
11
|
+
|
|
12
|
+
## Acceptance
|
|
13
|
+
|
|
14
|
+
In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
|
|
15
|
+
|
|
16
|
+
## Copyright License
|
|
17
|
+
|
|
18
|
+
The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor's copyright in it for any permitted purpose. However, you may only distribute the software according to [Distribution License](#distribution-license) and make changes or new works based on the software according to [Changes and New Works License](#changes-and-new-works-license).
|
|
19
|
+
|
|
20
|
+
## Distribution License
|
|
21
|
+
|
|
22
|
+
The licensor grants you an additional copyright license to distribute copies of the software. Your license to distribute covers distributing the software with changes and new works permitted by [Changes and New Works License](#changes-and-new-works-license).
|
|
23
|
+
|
|
24
|
+
## Notices
|
|
25
|
+
|
|
26
|
+
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms or the URL for them above, as well as copies of any plain-text lines beginning with `Required Notice:` that the licensor provided with the software. For example:
|
|
27
|
+
|
|
28
|
+
> Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
|
|
29
|
+
|
|
30
|
+
## Changes and New Works License
|
|
31
|
+
|
|
32
|
+
The licensor grants you an additional copyright license to make changes and new works based on the software for any permitted purpose.
|
|
33
|
+
|
|
34
|
+
## Patent License
|
|
35
|
+
|
|
36
|
+
The licensor grants you a patent license for the software that covers patent claims the licensor can license, or becomes able to license, that you would infringe by using the software.
|
|
37
|
+
|
|
38
|
+
## Noncompete
|
|
39
|
+
|
|
40
|
+
Any purpose is a permitted purpose, except for providing any product that competes with the software or any product the licensor or any of its affiliates provides using the software.
|
|
41
|
+
|
|
42
|
+
## Competition
|
|
43
|
+
|
|
44
|
+
Goods and services compete even when they provide functionality through different kinds of interfaces or for different technical platforms. Applications can compete with services, libraries with plugins, frameworks with development tools, and so on, even if they're written in different programming languages or for different computer architectures. Goods and services compete even when provided free of charge. If you market a product as a practical substitute for the software or another product, it definitely competes.
|
|
45
|
+
|
|
46
|
+
## New Products
|
|
47
|
+
|
|
48
|
+
If you are using the software to provide a product that does not compete, but the licensor or any of its affiliates brings your product into competition by providing a new version of the software or another product using the software, you may continue using versions of the software available under these terms beforehand to provide your competing product, but not any later versions.
|
|
49
|
+
|
|
50
|
+
## Discontinued Products
|
|
51
|
+
|
|
52
|
+
You may begin using the software to compete with a product or service that the licensor or any of its affiliates has stopped providing, unless the licensor includes a plain-text line beginning with `Licensor Line of Business:` with the software that mentions that line of business. For example:
|
|
53
|
+
|
|
54
|
+
> Licensor Line of Business: YoyodyneCMS Content Management System (http://example.com/cms)
|
|
55
|
+
|
|
56
|
+
## Sales of Business
|
|
57
|
+
|
|
58
|
+
If the licensor or any of its affiliates sells a line of business developing the software or using the software to provide a product, the buyer can also enforce [Noncompete](#noncompete) for that product.
|
|
59
|
+
|
|
60
|
+
## Fair Use
|
|
61
|
+
|
|
62
|
+
You may have "fair use" rights for the software under the law. These terms do not limit them.
|
|
63
|
+
|
|
64
|
+
## No Other Rights
|
|
65
|
+
|
|
66
|
+
These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the licensor from granting licenses to anyone else. These terms do not imply any other licenses.
|
|
67
|
+
|
|
68
|
+
## Patent Defense
|
|
69
|
+
|
|
70
|
+
If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
|
|
71
|
+
|
|
72
|
+
## Violations
|
|
73
|
+
|
|
74
|
+
The first time you are notified in writing that you have violated any of these terms, or done anything with the software not covered by your licenses, your licenses can nonetheless continue if you come into full compliance with these terms, and take practical steps to correct past violations, within 32 days of receiving notice. Otherwise, all your licenses end immediately.
|
|
75
|
+
|
|
76
|
+
## No Liability
|
|
77
|
+
|
|
78
|
+
***As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.***
|
|
79
|
+
|
|
80
|
+
## Definitions
|
|
81
|
+
|
|
82
|
+
The **licensor** is the individual or entity offering these terms, and the **software** is the software the licensor makes available under these terms.
|
|
83
|
+
|
|
84
|
+
A **product** can be a good or service, or a combination of them.
|
|
85
|
+
|
|
86
|
+
**You** refers to the individual or entity agreeing to these terms.
|
|
87
|
+
|
|
88
|
+
**Your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all its affiliates.
|
|
89
|
+
|
|
90
|
+
**Affiliates** means the other organizations than an organization has control over, is under the control of, or is under common control with.
|
|
91
|
+
|
|
92
|
+
**Control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
|
93
|
+
|
|
94
|
+
**Your licenses** are all the licenses granted to you for the software under these terms.
|
|
95
|
+
|
|
96
|
+
**Use** means anything you do with the software requiring one of your licenses.
|
data/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# runtime_analysis-sidekiq
|
|
2
|
+
|
|
3
|
+
Makes each Sidekiq job a request for [runtime_analysis](https://www.runtimeanalyz.ing) to keep when
|
|
4
|
+
it fails. With errors-only recording on, a job that raises is written as one file named for the job,
|
|
5
|
+
`HardJob#perform`, and a job that ends well writes nothing.
|
|
6
|
+
|
|
7
|
+
```ruby
|
|
8
|
+
# Gemfile
|
|
9
|
+
gem "runtime_analysis"
|
|
10
|
+
gem "runtime_analysis-sidekiq"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Nothing else is added in a Sidekiq server: requiring the gem puts its middleware first in the
|
|
14
|
+
server's chain. A job that ActiveJob wraps is named for the class it wraps.
|
|
15
|
+
|
|
16
|
+
## Telling your error tracker
|
|
17
|
+
|
|
18
|
+
Sidekiq tells an error tracker of a failed job from its error handlers, after the job has ended.
|
|
19
|
+
The callback you gave your tracker still works there:
|
|
20
|
+
`RuntimeAnalysis.reported(error) { |origin| ... }` is handed where the job's nil came from.
|
|
21
|
+
[Configuration](https://www.runtimeanalyz.ing/configuration#your-error-tracker) has the callback
|
|
22
|
+
for Sentry and for Honeybadger.
|
|
23
|
+
|
|
24
|
+
A job that raises is kept whatever your tracker decides. An error your tracker ignores still writes
|
|
25
|
+
a file each time the job raises it.
|
|
26
|
+
|
|
27
|
+
## Embedded Sidekiq
|
|
28
|
+
|
|
29
|
+
Requiring the gem adds its middleware in a process Sidekiq's own command started. An app that
|
|
30
|
+
embeds Sidekiq adds it where it configures the embed:
|
|
31
|
+
|
|
32
|
+
```ruby
|
|
33
|
+
Sidekiq.configure_embed { |config| RuntimeAnalysis::Sidekiq.install(config) }
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## In tests
|
|
37
|
+
|
|
38
|
+
Sidekiq's inline test mode runs no server, so add the middleware by hand:
|
|
39
|
+
|
|
40
|
+
```ruby
|
|
41
|
+
Sidekiq::Testing.server_middleware { |chain| chain.prepend RuntimeAnalysis::Sidekiq::Middleware }
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Versions
|
|
45
|
+
|
|
46
|
+
Tested with Sidekiq 7.3 and 8.1, on Ruby 3.2 and later, with no Redis: a job is run through
|
|
47
|
+
Sidekiq's own processor and through its inline test mode. Every job in those tests has
|
|
48
|
+
`retry: false`, since a retry is written to Redis. A job that retries, which is what most jobs do,
|
|
49
|
+
has been run only in a test app with a Sidekiq 8.1 server and Redis, last on 2026-11-29. Embedded
|
|
50
|
+
Sidekiq has not been run.
|
|
51
|
+
|
|
52
|
+
## License
|
|
53
|
+
|
|
54
|
+
Copyright (c) 2026. All rights reserved. Licensed by Espíritos Algébricos – Unipessoal Lda under the
|
|
55
|
+
[PolyForm Shield License 1.0.0](LICENSE.txt).
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "sidekiq"
|
|
4
|
+
require "runtime_analysis"
|
|
5
|
+
require_relative "sidekiq/version"
|
|
6
|
+
|
|
7
|
+
module RuntimeAnalysis
|
|
8
|
+
# Makes each Sidekiq job a request, named `HardJob#perform`, for errors-only recording to keep or
|
|
9
|
+
# discard as a whole. A job ActiveJob wraps is named for the class it wraps.
|
|
10
|
+
#
|
|
11
|
+
# Sidekiq tells an error tracker of a failed job from its error handlers, after the job has left
|
|
12
|
+
# every server middleware. `RuntimeAnalysis.job` is why a middleware is enough all the same: it
|
|
13
|
+
# keeps a job that raised and remembers where its nil came from, so a handler that calls
|
|
14
|
+
# `RuntimeAnalysis.reported` is still given it.
|
|
15
|
+
#
|
|
16
|
+
# Where jobs run without a server, as in Sidekiq's inline test mode, add the middleware by hand:
|
|
17
|
+
#
|
|
18
|
+
# Sidekiq::Testing.server_middleware { |chain| chain.prepend RuntimeAnalysis::Sidekiq::Middleware }
|
|
19
|
+
module Sidekiq
|
|
20
|
+
class Middleware
|
|
21
|
+
def call(_instance, job, _queue, &)
|
|
22
|
+
identity = Failsafe.attempt { "#{job["wrapped"] || job["class"]}#perform" }
|
|
23
|
+
RuntimeAnalysis.job(identity, &)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def self.install(config)
|
|
28
|
+
config.server_middleware { |chain| chain.prepend(Middleware) }
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Sidekiq runs the block only in a process that is a server.
|
|
32
|
+
def self.install_in_server
|
|
33
|
+
::Sidekiq.configure_server { |config| install(config) }
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
RuntimeAnalysis::Sidekiq.install_in_server
|
metadata
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: runtime_analysis-sidekiq
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Runtime Analysis
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: runtime_analysis
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
-
|
|
17
|
+
- ~>
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: "1.0"
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
-
|
|
25
|
+
- ~>
|
|
26
|
+
- !ruby/object:Gem::Version
|
|
27
|
+
version: "1.0"
|
|
28
|
+
- !ruby/object:Gem::Dependency
|
|
29
|
+
name: sidekiq
|
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
|
31
|
+
requirements:
|
|
32
|
+
-
|
|
33
|
+
- ">="
|
|
34
|
+
- !ruby/object:Gem::Version
|
|
35
|
+
version: "7.0"
|
|
36
|
+
type: :runtime
|
|
37
|
+
prerelease: false
|
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
39
|
+
requirements:
|
|
40
|
+
-
|
|
41
|
+
- ">="
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: "7.0"
|
|
44
|
+
description: "A Sidekiq server middleware for runtime_analysis's errors-only recording: a job that raises is written as one file, and your error tracker can be told where its nil came from."
|
|
45
|
+
email:
|
|
46
|
+
- hello@runtimeanalyz.ing
|
|
47
|
+
executables: []
|
|
48
|
+
extensions: []
|
|
49
|
+
extra_rdoc_files: []
|
|
50
|
+
files:
|
|
51
|
+
- CHANGELOG.md
|
|
52
|
+
- LICENSE.txt
|
|
53
|
+
- README.md
|
|
54
|
+
- lib/runtime_analysis-sidekiq.rb
|
|
55
|
+
- lib/runtime_analysis/sidekiq.rb
|
|
56
|
+
- lib/runtime_analysis/sidekiq/version.rb
|
|
57
|
+
homepage: "https://www.runtimeanalyz.ing"
|
|
58
|
+
licenses:
|
|
59
|
+
- LicenseRef-PolyForm-Shield-1.0.0
|
|
60
|
+
metadata:
|
|
61
|
+
allowed_push_host: "https://rubygems.org"
|
|
62
|
+
homepage_uri: "https://www.runtimeanalyz.ing"
|
|
63
|
+
source_code_uri: "https://github.com/runtime-analysis/runtime_analysis"
|
|
64
|
+
bug_tracker_uri: "https://github.com/runtime-analysis/runtime_analysis/issues"
|
|
65
|
+
rubygems_mfa_required: "true"
|
|
66
|
+
rdoc_options: []
|
|
67
|
+
require_paths:
|
|
68
|
+
- lib
|
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
70
|
+
requirements:
|
|
71
|
+
-
|
|
72
|
+
- ">="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: 3.2.0
|
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
|
+
requirements:
|
|
77
|
+
-
|
|
78
|
+
- ">="
|
|
79
|
+
- !ruby/object:Gem::Version
|
|
80
|
+
version: "0"
|
|
81
|
+
requirements: []
|
|
82
|
+
rubygems_version: 4.1.1
|
|
83
|
+
specification_version: 4
|
|
84
|
+
summary: Makes each Sidekiq job a request for runtime_analysis to keep when it fails.
|
|
85
|
+
test_files: []
|