yabeda-delayed_job 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 0d60afa9bc70d48d280a16b6ccb86f235a227f2a00bcfd8ae5f17b05d78d1cc1
4
+ data.tar.gz: 90f7696f5aae19fa4689979c26e4caa29b32e522a2d6615106e105ddad4e8eb6
5
+ SHA512:
6
+ metadata.gz: 66b2a6e48e88ec723e4ddaedb5fe4775309d8f3134d7c3c0839e3cd90a09f5c5eb33645271ef58c38d311c43b1a313042137a5ddb7c1f0d2416d822c4b5f8653
7
+ data.tar.gz: 343c34317142205464df17909a414ed0a2481b5d3125aefb713ac2e1e7c9abde8f21cf205fce19a3287264d5173ec662c8a5b4b4d5cb59941cee6db990b0dc4d
data/.gitignore ADDED
@@ -0,0 +1,56 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ # Ignore Byebug command history file.
17
+ .byebug_history
18
+
19
+ ## Specific to RubyMotion:
20
+ .dat*
21
+ .repl_history
22
+ build/
23
+ *.bridgesupport
24
+ build-iPhoneOS/
25
+ build-iPhoneSimulator/
26
+
27
+ ## Specific to RubyMotion (use of CocoaPods):
28
+ #
29
+ # We recommend against adding the Pods directory to your .gitignore. However
30
+ # you should judge for yourself, the pros and cons are mentioned at:
31
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
32
+ #
33
+ # vendor/Pods/
34
+
35
+ ## Documentation cache and generated files:
36
+ /.yardoc/
37
+ /_yardoc/
38
+ /doc/
39
+ /rdoc/
40
+
41
+ ## Environment normalization:
42
+ /.bundle/
43
+ /vendor/bundle
44
+ /lib/bundler/man/
45
+
46
+ # for a library or gem, you might want to ignore these files since the code is
47
+ # intended to run in multiple environments; otherwise, check them in:
48
+ # Gemfile.lock
49
+ # .ruby-version
50
+ # .ruby-gemset
51
+
52
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
53
+ .rvmrc
54
+
55
+ # Used by RuboCop. Remote config files pulled in from inherit_from directive.
56
+ # .rubocop-https?--*
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,8 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.5
3
+
4
+ Style/Documentation:
5
+ Enabled: false
6
+
7
+ Gemspec/RequiredRubyVersion:
8
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ language: minimal
2
+ sudo: require
3
+ services:
4
+ - docker
5
+
6
+ before_script:
7
+ - unset BUNDLE_GEMFILE
8
+ - docker-compose run app bundle install
9
+ script:
10
+ - docker-compose run app bundle exec rake
11
+
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at dsalahutdinov@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ gem 'byebug'
8
+ gem 'daemons'
9
+ gem 'delayed_job_active_record'
10
+ gem 'pg'
11
+
12
+ # Specify your gem's dependencies in yabeda-delayed_job.gemspec
13
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,92 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ yabeda-delayed_job (0.1.0)
5
+ delayed_job
6
+ yabeda
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activemodel (6.1.3.2)
12
+ activesupport (= 6.1.3.2)
13
+ activerecord (6.1.3.2)
14
+ activemodel (= 6.1.3.2)
15
+ activesupport (= 6.1.3.2)
16
+ activesupport (6.1.3.2)
17
+ concurrent-ruby (~> 1.0, >= 1.0.2)
18
+ i18n (>= 1.6, < 2)
19
+ minitest (>= 5.1)
20
+ tzinfo (~> 2.0)
21
+ zeitwerk (~> 2.3)
22
+ ast (2.4.2)
23
+ byebug (11.1.3)
24
+ concurrent-ruby (1.1.9)
25
+ daemons (1.4.0)
26
+ delayed_job (4.1.9)
27
+ activesupport (>= 3.0, < 6.2)
28
+ delayed_job_active_record (4.1.6)
29
+ activerecord (>= 3.0, < 6.2)
30
+ delayed_job (>= 3.0, < 5)
31
+ diff-lcs (1.4.4)
32
+ dry-initializer (3.0.4)
33
+ i18n (1.8.10)
34
+ concurrent-ruby (~> 1.0)
35
+ minitest (5.14.4)
36
+ parallel (1.20.1)
37
+ parser (3.0.1.1)
38
+ ast (~> 2.4.1)
39
+ pg (1.2.3)
40
+ rainbow (3.0.0)
41
+ rake (10.5.0)
42
+ regexp_parser (2.1.1)
43
+ rexml (3.2.5)
44
+ rspec (3.10.0)
45
+ rspec-core (~> 3.10.0)
46
+ rspec-expectations (~> 3.10.0)
47
+ rspec-mocks (~> 3.10.0)
48
+ rspec-core (3.10.1)
49
+ rspec-support (~> 3.10.0)
50
+ rspec-expectations (3.10.1)
51
+ diff-lcs (>= 1.2.0, < 2.0)
52
+ rspec-support (~> 3.10.0)
53
+ rspec-mocks (3.10.2)
54
+ diff-lcs (>= 1.2.0, < 2.0)
55
+ rspec-support (~> 3.10.0)
56
+ rspec-support (3.10.2)
57
+ rubocop (1.17.0)
58
+ parallel (~> 1.10)
59
+ parser (>= 3.0.0.0)
60
+ rainbow (>= 2.2.2, < 4.0)
61
+ regexp_parser (>= 1.8, < 3.0)
62
+ rexml
63
+ rubocop-ast (>= 1.7.0, < 2.0)
64
+ ruby-progressbar (~> 1.7)
65
+ unicode-display_width (>= 1.4.0, < 3.0)
66
+ rubocop-ast (1.7.0)
67
+ parser (>= 3.0.1.1)
68
+ ruby-progressbar (1.11.0)
69
+ tzinfo (2.0.4)
70
+ concurrent-ruby (~> 1.0)
71
+ unicode-display_width (2.0.0)
72
+ yabeda (0.9.0)
73
+ concurrent-ruby
74
+ dry-initializer
75
+ zeitwerk (2.4.2)
76
+
77
+ PLATFORMS
78
+ x86_64-linux
79
+
80
+ DEPENDENCIES
81
+ bundler
82
+ byebug
83
+ daemons
84
+ delayed_job_active_record
85
+ pg
86
+ rake (~> 10.0)
87
+ rspec (~> 3.0)
88
+ rubocop (~> 1.15)
89
+ yabeda-delayed_job!
90
+
91
+ BUNDLED WITH
92
+ 2.2.15
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Dmitry Salahutdinov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Dmitry
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,69 @@
1
+ # Yabeda::DelayedJob
2
+
3
+ Built-in metrics for [DelayedJob](https://github.com/collectiveidea/delayed_job) background workers monitoring out of the box! Part of the [yabeda](https://github.com/yabeda-rb/yabeda) suite.
4
+
5
+
6
+ ## Metrics
7
+
8
+ Works as the DelayedJjob plugin and provides following metrics:
9
+ - `jobs_enqueued_total` - the counter of enqueued jobs (segmented by queue/worker)
10
+ - `jobs_failed_total`/`jobs_errored_total` - the counter of failed/errored jobs (segmented by queue/worker/error)
11
+ - `jobs_waiting_count` - the number of jobs are waited for execution, queue size (segmented by queue).
12
+ - `queue_latency` - the queue latency - difference in seconds since the oldest job was enqueued (segmented by queue)
13
+ - `job_runtime` - the histogram of job running time (in seconds, segmented by queue, worker)
14
+ - `running_job_runtime` - the running time of currently executed job (segmented by queue, worker). Helps to determine long running jobs.
15
+
16
+ ## Details
17
+
18
+ Example of predefined Grafana dashboard.
19
+
20
+
21
+ ![Yabeda::DelayedJob Grafana Dashboard](docs/yabeda-delayed_job-grafana.png).
22
+
23
+
24
+ ## Installation
25
+
26
+ Add this line to your application's Gemfile:
27
+
28
+ ```ruby
29
+ gem 'yabeda-delayed_job'
30
+ ```
31
+
32
+ And then execute:
33
+
34
+ $ bundle
35
+
36
+ Or install it yourself as:
37
+
38
+ $ gem install yabeda-delayed_job
39
+
40
+ ## Usage
41
+
42
+ ### Collecting metrics
43
+
44
+ Start metrics exporter to you delayed_job startup script (`script/delayed_job`). In case you do not have Rails loaded configure Yabeda first:
45
+
46
+ ```ruby
47
+ ::Yabeda.configure!
48
+ ::Yabeda::Prometheus::Exporter.start_metrics_server!
49
+ ```
50
+
51
+ ## Development with Docker
52
+
53
+ Get local development environment working and tests running is very easy with docker-compose:
54
+ ```bash
55
+ docker-compose run app bundle
56
+ docker-compose run app bundle exec rspec
57
+ ```
58
+
59
+ ## Contributing
60
+
61
+ Bug reports and pull requests are welcome on GitHub at https://github.com/dsalahutdinov/yabeda-delayed_job. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
62
+
63
+ ## License
64
+
65
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
66
+
67
+ ## Code of Conduct
68
+
69
+ Everyone interacting in the Yabeda::DelayedJob project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/yabeda-delayed_job/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+ require 'rubocop/rake_task'
6
+
7
+ RuboCop::RakeTask.new
8
+
9
+ RSpec::Core::RakeTask.new(:spec)
10
+
11
+ task default: %i[rubocop spec]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'yabeda/delayed_job'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,34 @@
1
+ version: '3.4'
2
+
3
+ services:
4
+ app:
5
+ image: ruby:latest
6
+ environment:
7
+ - BUNDLE_PATH=/bundle
8
+ - BUNDLE_CONFIG=/app/.bundle/config
9
+ - REDIS_URL=redis://redis
10
+
11
+ - DATABASE_URL=postgresql://postgres@postgres/test
12
+ command: bash
13
+ working_dir: /app
14
+ volumes:
15
+ - .:/app:cached
16
+ - bundler_data:/bundle
17
+ tmpfs:
18
+ - /tmp
19
+ depends_on:
20
+ - postgres
21
+
22
+ postgres:
23
+ image: postgres:9.6
24
+ volumes:
25
+ - postgres:/var/lib/postgresql/data
26
+ ports:
27
+ - 5432
28
+ environment:
29
+ - POSTGRES_HOST_AUTH_METHOD=trust
30
+ - POSTGRES_DB=test
31
+
32
+ volumes:
33
+ bundler_data:
34
+ postgres: