sbmt-outbox 6.3.1 → 6.4.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 +4 -4
- data/README.md +4 -0
- data/lib/generators/outbox/install/templates/outbox.yml +2 -0
- data/lib/sbmt/outbox/cli.rb +1 -1
- data/lib/sbmt/outbox/probes/metrics.rb +52 -0
- data/lib/sbmt/outbox/probes/probe.rb +10 -0
- data/lib/sbmt/outbox/version.rb +1 -1
- data/lib/sbmt/outbox.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aed7afb062770ab592517d363d16fa57428a29b9e67ec83eb65c5ceacbfba714
|
4
|
+
data.tar.gz: eafe1f3ea486c9913a82508a7e20a423e6eb6789651d7cb0642e706fa233a609
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e58e6a80a6bd1a2ec1f9f41816d2b70532ae2e58b29f8588d5c326d22617fdbeb8e321fa70d2d02773ac6d0ff07403047351eb7ea89ff1597b9708ff66b69909
|
7
|
+
data.tar.gz: fe734a0361f7a749b23f63074faa5c3c1d3b9c92fad1e997ca4603a64a2efb30550f7a62c22a96f2830c0ef8fb1be0650fb6cd7a3a62100a63245d3631834580
|
data/README.md
CHANGED
@@ -224,7 +224,11 @@ The `outbox.yml` configuration file is the main configuration for the gem, where
|
|
224
224
|
default: &default
|
225
225
|
owner: foo-team # optional, used in Yabeda metrics
|
226
226
|
bucket_size: 16 # optional, default 16, see into about the buckets at the #Concurrency section
|
227
|
+
metrics:
|
228
|
+
enabled: true # default false, yabeda server autostart with port: 9090 and path: /metrics
|
229
|
+
port: 9090 # optional, default, used in Yabeda metrics
|
227
230
|
probes:
|
231
|
+
enabled: false # optional, default true
|
228
232
|
port: 5555 # default, used for Kubernetes probes
|
229
233
|
|
230
234
|
outbox_items: # outbox items section
|
data/lib/sbmt/outbox/cli.rb
CHANGED
@@ -69,8 +69,8 @@ module Sbmt
|
|
69
69
|
$stdout.puts AsciiArt.logo
|
70
70
|
$stdout.puts "Outbox/Inbox worker has been started"
|
71
71
|
$stdout.puts "Version: #{VERSION}"
|
72
|
-
$stdout.puts "Starting probes..."
|
73
72
|
Sbmt::Outbox::Probes::Probe.run_probes
|
73
|
+
Sbmt::Outbox::Probes::Metrics.run_metrics
|
74
74
|
|
75
75
|
worker.start
|
76
76
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Sbmt
|
4
|
+
module Outbox
|
5
|
+
module Probes
|
6
|
+
class Metrics
|
7
|
+
DEFAULT_YABEDA_PORT = 9090
|
8
|
+
DEFAULT_YABEDA_PATH = "/metrics"
|
9
|
+
class << self
|
10
|
+
def run_metrics
|
11
|
+
return unless autostart_yabeda_server?
|
12
|
+
|
13
|
+
if defined?(Yabeda)
|
14
|
+
$stdout.puts "Starting metrics http-server..."
|
15
|
+
|
16
|
+
start_webrick(
|
17
|
+
Yabeda::Prometheus::Mmap::Exporter::NOT_FOUND_HANDLER,
|
18
|
+
middlewares: {::Yabeda::Prometheus::Exporter => {path: DEFAULT_YABEDA_PATH}},
|
19
|
+
port: yabeda_port
|
20
|
+
)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def yabeda_port
|
27
|
+
Sbmt::Outbox.yaml_config.dig(:metrics, :port) || DEFAULT_YABEDA_PORT
|
28
|
+
end
|
29
|
+
|
30
|
+
def start_webrick(app, middlewares:, port:)
|
31
|
+
Thread.new do
|
32
|
+
::Rack::Handler::WEBrick.run(
|
33
|
+
::Rack::Builder.new do
|
34
|
+
middlewares.each do |middleware, options|
|
35
|
+
use middleware, **options
|
36
|
+
end
|
37
|
+
run app
|
38
|
+
end,
|
39
|
+
Host: "0.0.0.0",
|
40
|
+
Port: port
|
41
|
+
)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def autostart_yabeda_server?
|
46
|
+
Sbmt::Outbox.yaml_config.dig(:metrics, :enabled) || false
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -7,6 +7,10 @@ module Sbmt
|
|
7
7
|
DEFAULT_PROBE_PORT = 5555
|
8
8
|
class << self
|
9
9
|
def run_probes
|
10
|
+
return unless autostart_probe?
|
11
|
+
|
12
|
+
$stdout.puts "Starting probes..."
|
13
|
+
|
10
14
|
::HttpHealthCheck.run_server_async(
|
11
15
|
port: probe_port,
|
12
16
|
rack_app: HttpHealthCheck::RackApp.configure do |c|
|
@@ -31,6 +35,12 @@ module Sbmt
|
|
31
35
|
|
32
36
|
Sbmt::Outbox.yaml_config.fetch(:probes).fetch(:port)
|
33
37
|
end
|
38
|
+
|
39
|
+
def autostart_probe?
|
40
|
+
value = Sbmt::Outbox.yaml_config.dig(:probes, :enabled)
|
41
|
+
value = true if value.nil?
|
42
|
+
value
|
43
|
+
end
|
34
44
|
end
|
35
45
|
end
|
36
46
|
end
|
data/lib/sbmt/outbox/version.rb
CHANGED
data/lib/sbmt/outbox.rb
CHANGED
@@ -38,6 +38,7 @@ require_relative "outbox/engine"
|
|
38
38
|
require_relative "outbox/middleware/builder"
|
39
39
|
require_relative "outbox/middleware/runner"
|
40
40
|
require_relative "outbox/probes/probe"
|
41
|
+
require_relative "outbox/probes/metrics"
|
41
42
|
require_relative "outbox/redis_client_factory"
|
42
43
|
|
43
44
|
module Sbmt
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sbmt-outbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sbermarket Ruby-Platform Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-05-
|
11
|
+
date: 2024-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: connection_pool
|
@@ -586,6 +586,7 @@ files:
|
|
586
586
|
- lib/sbmt/outbox/middleware/sentry/tracing_batch_process_middleware.rb
|
587
587
|
- lib/sbmt/outbox/middleware/sentry/tracing_item_process_middleware.rb
|
588
588
|
- lib/sbmt/outbox/middleware/sentry/transaction.rb
|
589
|
+
- lib/sbmt/outbox/probes/metrics.rb
|
589
590
|
- lib/sbmt/outbox/probes/probe.rb
|
590
591
|
- lib/sbmt/outbox/redis_client_factory.rb
|
591
592
|
- lib/sbmt/outbox/tasks/delete_failed_items.rake
|