eventboss 1.7.0 → 1.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b837d9db4a587bec35fc7d31765551263011c2bd33559944c7de34ffa885c3b
4
- data.tar.gz: 3b0f1808873bf4a8d2b5407b82de0ced2f86a2bd5f67775f4f3c73493dfe1bd7
3
+ metadata.gz: e4628ccf4b64bbc755253aedf850c096998ed965231ac1464de4384872d2d1f1
4
+ data.tar.gz: cc0661659e16a84c8e5073fba547ca934038c8e769bdd5a06ad4c126511a4f4a
5
5
  SHA512:
6
- metadata.gz: d7c7a8696654ccefd5d25596a9f439c8fbbd8ca41a71525f195010fbb0f469db5f6937632e0b6c46a67cb774b67fc3aeec174e507e649f46c2ab76e55ea56dee
7
- data.tar.gz: 4d7c2b81fc401f5d7890ad1144ee87cd933a34470110a50b7d94e6d88fbcf5792f938777f7b93b3ec37280dc09d5b7c17f2e2b9ac9dc34f50f0c8ed4075af8ed
6
+ metadata.gz: a4e2ea1c6484a55a08b6a4067e94cd3171c4bc165930ec5475077263ccc7a898a96d5cef6917daf680483f61841d597b7c77019d783fcf11bf5a39b020dd5d29
7
+ data.tar.gz: 2198208804156ab4a6a99e2624a970c9d494c325e4648b3c53eec207f8ecbf2b0ce5cc5e5d932ca0531bb58410d2d595fa1b7250a39b48749085e8bdfcbf610b
@@ -0,0 +1,24 @@
1
+ name: Run Bundler Audit
2
+
3
+ on:
4
+ pull_request:
5
+
6
+ jobs:
7
+ run-bundler_audit:
8
+ name: Run bundler audit
9
+ runs-on: ubuntu-latest
10
+ strategy:
11
+ matrix:
12
+ ruby-version: ["3.0"]
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+ - name: Set up Ruby
16
+ uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: ${{ matrix.ruby-version }}
19
+ - name: Install bundle audit
20
+ run: gem install bundle-audit
21
+ - name: Update Ruby Advisory Database
22
+ run: bundle-audit update
23
+ - name: Run audit
24
+ run: bundle audit
@@ -0,0 +1,28 @@
1
+ name: Run RSpec tests
2
+
3
+ on:
4
+ workflow_call:
5
+ workflow_dispatch:
6
+ pull_request:
7
+
8
+ env:
9
+ APPLICATION_NAME: eventboss
10
+
11
+ jobs:
12
+ run-tests:
13
+ name: Run RSpec
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ matrix:
17
+ ruby-version: ["3.0"]
18
+ steps:
19
+ - uses: actions/checkout@v2
20
+ - name: Set up Ruby
21
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby
22
+ uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby-version }}
25
+ # runs 'bundle install' and caches installed gems automatically
26
+ bundler-cache: true
27
+ - name: Run tests
28
+ run: bundle exec rspec
data/Gemfile.lock CHANGED
@@ -1,55 +1,57 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eventboss (1.7.0)
4
+ eventboss (1.8.1)
5
5
  aws-sdk-sns (>= 1.1.0)
6
6
  aws-sdk-sqs (>= 1.3.0)
7
7
  dotenv (~> 2.1, >= 2.1.1)
8
+ rexml (~> 3.0)
8
9
 
9
10
  GEM
10
11
  remote: https://rubygems.org/
11
12
  specs:
12
- aws-eventstream (1.1.1)
13
- aws-partitions (1.432.0)
14
- aws-sdk-core (3.113.0)
15
- aws-eventstream (~> 1, >= 1.0.2)
16
- aws-partitions (~> 1, >= 1.239.0)
17
- aws-sigv4 (~> 1.1)
18
- jmespath (~> 1.0)
19
- aws-sdk-sns (1.37.0)
20
- aws-sdk-core (~> 3, >= 3.109.0)
13
+ aws-eventstream (1.3.0)
14
+ aws-partitions (1.894.0)
15
+ aws-sdk-core (3.191.3)
16
+ aws-eventstream (~> 1, >= 1.3.0)
17
+ aws-partitions (~> 1, >= 1.651.0)
18
+ aws-sigv4 (~> 1.8)
19
+ jmespath (~> 1, >= 1.6.1)
20
+ aws-sdk-sns (1.72.0)
21
+ aws-sdk-core (~> 3, >= 3.191.0)
21
22
  aws-sigv4 (~> 1.1)
22
- aws-sdk-sqs (1.35.0)
23
- aws-sdk-core (~> 3, >= 3.109.0)
23
+ aws-sdk-sqs (1.70.0)
24
+ aws-sdk-core (~> 3, >= 3.191.0)
24
25
  aws-sigv4 (~> 1.1)
25
- aws-sigv4 (1.2.3)
26
+ aws-sigv4 (1.8.0)
26
27
  aws-eventstream (~> 1, >= 1.0.2)
27
- diff-lcs (1.3)
28
- dotenv (2.7.6)
29
- jmespath (1.4.0)
30
- rake (13.0.1)
31
- rspec (3.7.0)
32
- rspec-core (~> 3.7.0)
33
- rspec-expectations (~> 3.7.0)
34
- rspec-mocks (~> 3.7.0)
35
- rspec-core (3.7.0)
36
- rspec-support (~> 3.7.0)
37
- rspec-expectations (3.7.0)
28
+ diff-lcs (1.5.0)
29
+ dotenv (2.8.1)
30
+ jmespath (1.6.2)
31
+ rake (13.0.6)
32
+ rexml (3.2.6)
33
+ rspec (3.11.0)
34
+ rspec-core (~> 3.11.0)
35
+ rspec-expectations (~> 3.11.0)
36
+ rspec-mocks (~> 3.11.0)
37
+ rspec-core (3.11.0)
38
+ rspec-support (~> 3.11.0)
39
+ rspec-expectations (3.11.0)
38
40
  diff-lcs (>= 1.2.0, < 2.0)
39
- rspec-support (~> 3.7.0)
40
- rspec-mocks (3.7.0)
41
+ rspec-support (~> 3.11.0)
42
+ rspec-mocks (3.11.0)
41
43
  diff-lcs (>= 1.2.0, < 2.0)
42
- rspec-support (~> 3.7.0)
43
- rspec-support (3.7.0)
44
+ rspec-support (~> 3.11.0)
45
+ rspec-support (3.11.0)
44
46
 
45
47
  PLATFORMS
46
48
  ruby
47
49
 
48
50
  DEPENDENCIES
49
- bundler (~> 1.13)
51
+ bundler (>= 1)
50
52
  eventboss!
51
53
  rake (>= 10.0)
52
54
  rspec (~> 3.0)
53
55
 
54
56
  BUNDLED WITH
55
- 2.1.4
57
+ 2.3.7
data/README.md CHANGED
@@ -100,8 +100,8 @@ EVENTBOSS_ENV=env_name # production/staging/test
100
100
  EVENTBOSS_REGION=aws_region # i.e. eu-west-1
101
101
  EVENTBOSS_CONCURRENCY=10 # default is 25
102
102
 
103
- AWS_SNS_ENDPOINT=http://localhost:4575 # when using with localstack
104
- AWS_SQS_ENDPOINT=http://localhost:4576 # when using with localstack
103
+ AWS_SNS_ENDPOINT=http://localhost:4566 # when using with localstack
104
+ AWS_SQS_ENDPOINT=http://localhost:4566 # when using with localstack
105
105
  ```
106
106
  Use fixed account ID for localstack setup:
107
107
  ```
@@ -0,0 +1,27 @@
1
+ version: '2'
2
+ services:
3
+ web:
4
+ build:
5
+ context: .
6
+ dockerfile: Dockerfile-test
7
+ env_file:
8
+ - .env.example
9
+ volumes:
10
+ - tmp:/usr/src/app/tmp
11
+ - log:/usr/src/app/log
12
+ pronto:
13
+ build:
14
+ context: .
15
+ dockerfile: Dockerfile-test
16
+ volumes:
17
+ - .:/usr/src/app
18
+ entrypoint: ""
19
+ command: bash -c "bundle exec pronto run -f github_status text -c origin/master"
20
+ environment:
21
+ GITHUB_ACCESS_TOKEN: ${GITHUB_ACCESS_TOKEN}
22
+ RACK_ENV: test
23
+ RAILS_ENV: test
24
+
25
+ volumes:
26
+ log:
27
+ tmp:
data/eventboss.gemspec CHANGED
@@ -23,8 +23,9 @@ Gem::Specification.new do |spec|
23
23
  spec.add_dependency "aws-sdk-sqs", ">= 1.3.0"
24
24
  spec.add_dependency "aws-sdk-sns", ">= 1.1.0"
25
25
  spec.add_dependency "dotenv", "~> 2.1", ">= 2.1.1"
26
+ spec.add_dependency "rexml", "~> 3.0"
26
27
 
27
- spec.add_development_dependency "bundler", "~> 1.13"
28
+ spec.add_development_dependency "bundler", ">= 1"
28
29
  spec.add_development_dependency 'rake', '>= 10.0'
29
30
  spec.add_development_dependency "rspec", "~> 3.0"
30
31
  end
@@ -17,6 +17,9 @@ module Eventboss
17
17
  logger.info('development-mode') { "Creating queue #{queue.name}..." }
18
18
  sqs_client.create_queue(queue_name: queue.name)
19
19
 
20
+ logger.info('development-mode') { "Creating deadletter queue #{queue.name}-deadletter..." }
21
+ sqs_client.create_queue(queue_name: "#{queue.name}-deadletter")
22
+
20
23
  logger.info('development-mode') { "Setting up queue #{queue.name} policy..." }
21
24
  policy = queue_policy(queue.arn, topic.topic_arn)
22
25
  sqs_client.set_queue_attributes(queue_url: queue.url, attributes: { Policy: policy.to_json })
@@ -4,7 +4,13 @@ module Eventboss
4
4
  def call(exception, context = {})
5
5
  eventboss_context = { component: 'eventboss' }
6
6
  eventboss_context[:action] = context[:processor].class.to_s if context[:processor]
7
- ::Rollbar.error(exception, eventboss_context.merge(context))
7
+
8
+ default_options = { use_exception_level_filters: true }
9
+
10
+ ::Rollbar.error(
11
+ exception,
12
+ context.merge(eventboss_context, default_options)
13
+ )
8
14
  end
9
15
  end
10
16
  end
@@ -0,0 +1,17 @@
1
+ module Eventboss
2
+ module ErrorHandlers
3
+ class Sentry
4
+ def call(exception, context = {})
5
+ eventboss_context = { component: 'eventboss' }
6
+ eventboss_context[:action] = context[:processor].class.to_s if context[:processor]
7
+
8
+ ::Sentry.with_scope do |scope|
9
+ scope.set_tags(
10
+ context.merge(eventboss_context)
11
+ )
12
+ ::Sentry.capture_exception(exception)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,6 +1,7 @@
1
1
  require 'eventboss/error_handlers/logger'
2
2
  require 'eventboss/error_handlers/airbrake'
3
3
  require 'eventboss/error_handlers/rollbar'
4
+ require 'eventboss/error_handlers/sentry'
4
5
  require 'eventboss/error_handlers/db_connection_drop_handler'
5
6
  require 'eventboss/error_handlers/db_connection_not_established_handler'
6
7
  require 'eventboss/error_handlers/non_existent_queue_handler'
@@ -55,7 +55,7 @@ module Eventboss
55
55
  @launcher.poller_stopped(self)
56
56
  rescue Eventboss::Shutdown
57
57
  @launcher.poller_stopped(self)
58
- rescue Aws::SQS::Errors::NonExistentQueue
58
+ rescue Aws::SQS::Errors::NonExistentQueue => exception
59
59
  handle_exception(exception, poller_id: id)
60
60
  @launcher.poller_stopped(self)
61
61
  rescue StandardError => exception
@@ -1,3 +1,3 @@
1
1
  module Eventboss
2
- VERSION = "1.7.0"
2
+ VERSION = "1.8.1"
3
3
  end
@@ -6,6 +6,9 @@ namespace :eventboss do
6
6
  task :reload, [:event_name, :source_app, :max_messages] do |task, args|
7
7
  source_app = args[:source_app]
8
8
  event_name = args[:event_name]
9
+ start_time = Time.now
10
+
11
+ Eventboss.logger.info "[#{task.name}] Start task"
9
12
 
10
13
  # Zero means: fetch all messages
11
14
  max_messages = args[:max_messages].to_i
@@ -17,13 +20,11 @@ namespace :eventboss do
17
20
 
18
21
  queue_name = compose_queue_name(source_app, event_name)
19
22
 
20
- puts "[#{task.name}] Reloading #{queue_name}-deadletter (max: #{ max_messages }, batch: #{ batch_size })"
23
+ Eventboss.logger.info "[#{task.name}] Reloading #{queue_name}-deadletter (max: #{ max_messages }, batch: #{ batch_size })"
21
24
  queue = Eventboss::Queue.new("#{queue_name}-deadletter")
22
25
  send_queue = Eventboss::Queue.new(queue_name)
23
26
 
24
- puts "[#{task.name}] #{queue.url}"
25
- puts "[#{task.name}] to"
26
- puts "[#{task.name}] #{send_queue.url}"
27
+ Eventboss.logger.info "[#{task.name}] #{queue.url} to #{send_queue.url}"
27
28
 
28
29
  fetcher = Eventboss::Fetcher.new(Eventboss.configuration)
29
30
  client = fetcher.client
@@ -42,16 +43,24 @@ namespace :eventboss do
42
43
 
43
44
  break if max_messages > 0 && total >= max_messages
44
45
  end
46
+ Eventboss.logger.info <<~HEREDOC
47
+ [#{task.name}] Task done
48
+ total messages: #{total}
49
+ total time: #{Time.now - start_time}s
50
+ HEREDOC
45
51
  end
46
52
 
47
53
  desc 'Purge deadletter queue'
48
54
  task :purge, [:event_name, :source_app, :max_messages] do |task, args|
49
55
  source_app = args[:source_app]
50
56
  event_name = args[:event_name]
57
+ start_time = Time.now
51
58
 
52
59
  # Zero means: fetch all messages
53
60
  max_messages = args[:max_messages].to_i
54
61
 
62
+ Eventboss.logger.info "[#{task.name}] Start task"
63
+
55
64
  # Ensure we don't fetch more than 10 messages from SQS
56
65
  batch_size = max_messages == 0 ? 10 : [10, max_messages].min
57
66
 
@@ -59,9 +68,9 @@ namespace :eventboss do
59
68
 
60
69
  queue_name = compose_queue_name(source_app, event_name)
61
70
 
62
- puts "[#{task.name}] Purging #{queue_name}-deadletter (max: #{ max_messages }, batch: #{ batch_size })"
71
+ Eventboss.logger.info "[#{task.name}] Purging #{queue_name}-deadletter (max: #{ max_messages }, batch: #{ batch_size })"
63
72
  queue = Eventboss::Queue.new("#{queue_name}-deadletter")
64
- puts "[#{task.name}] #{queue.url}"
73
+ Eventboss.logger.info "[#{task.name}] #{queue.url}"
65
74
 
66
75
  fetcher = Eventboss::Fetcher.new(Eventboss.configuration)
67
76
  total = 0
@@ -78,6 +87,12 @@ namespace :eventboss do
78
87
 
79
88
  break if max_messages > 0 && total >= max_messages
80
89
  end
90
+
91
+ Eventboss.logger.info <<~HEREDOC
92
+ [#{task.name}] Task done
93
+ total messages: #{total}
94
+ total time: #{Time.now - start_time}s
95
+ HEREDOC
81
96
  end
82
97
 
83
98
  def compose_queue_name(source_app, event_name)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eventboss
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - AirHelp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-08 00:00:00.000000000 Z
11
+ date: 2024-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-sqs
@@ -59,19 +59,33 @@ dependencies:
59
59
  - !ruby/object:Gem::Version
60
60
  version: 2.1.1
61
61
  - !ruby/object:Gem::Dependency
62
- name: bundler
62
+ name: rexml
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '1.13'
68
- type: :development
67
+ version: '3.0'
68
+ type: :runtime
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: '1.13'
74
+ version: '3.0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: bundler
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '1'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '1'
75
89
  - !ruby/object:Gem::Dependency
76
90
  name: rake
77
91
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +122,8 @@ executables:
108
122
  extensions: []
109
123
  extra_rdoc_files: []
110
124
  files:
125
+ - ".github/workflows/bundler_audit.yml"
126
+ - ".github/workflows/rspec.yml"
111
127
  - ".gitignore"
112
128
  - ".rspec"
113
129
  - ".travis.yml"
@@ -119,6 +135,7 @@ files:
119
135
  - README.md
120
136
  - Rakefile
121
137
  - bin/eventboss
138
+ - docker-compose.test.yml
122
139
  - eventboss.gemspec
123
140
  - lib/eventboss.rb
124
141
  - lib/eventboss/cli.rb
@@ -130,6 +147,7 @@ files:
130
147
  - lib/eventboss/error_handlers/logger.rb
131
148
  - lib/eventboss/error_handlers/non_existent_queue_handler.rb
132
149
  - lib/eventboss/error_handlers/rollbar.rb
150
+ - lib/eventboss/error_handlers/sentry.rb
133
151
  - lib/eventboss/extensions.rb
134
152
  - lib/eventboss/fetcher.rb
135
153
  - lib/eventboss/instrumentation.rb
@@ -173,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
191
  - !ruby/object:Gem::Version
174
192
  version: '0'
175
193
  requirements: []
176
- rubygems_version: 3.1.6
194
+ rubygems_version: 3.5.5
177
195
  signing_key:
178
196
  specification_version: 4
179
197
  summary: Eventboss Ruby Client.