cosmonats 0.8.0 → 0.10.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 +73 -22
- data/lib/cosmo/active_job/adapter.rb +2 -0
- data/lib/cosmo/active_job/executor.rb +7 -0
- data/lib/cosmo/active_job/options.rb +6 -0
- data/lib/cosmo/api/batch.rb +26 -0
- data/lib/cosmo/api/counter.rb +52 -4
- data/lib/cosmo/api/cron/entry.rb +34 -20
- data/lib/cosmo/api/cron.rb +24 -10
- data/lib/cosmo/api/job.rb +15 -1
- data/lib/cosmo/api/kv.rb +141 -12
- data/lib/cosmo/api/registry.rb +47 -6
- data/lib/cosmo/api/stats/jobs.rb +84 -0
- data/lib/cosmo/api/stats/metrics.rb +20 -9
- data/lib/cosmo/api/stats/processes.rb +27 -11
- data/lib/cosmo/api/stats/totals.rb +1 -0
- data/lib/cosmo/api/stats.rb +58 -7
- data/lib/cosmo/api/stream.rb +73 -24
- data/lib/cosmo/batch/callback.rb +5 -0
- data/lib/cosmo/batch/dispatcher.rb +4 -4
- data/lib/cosmo/batch.rb +34 -11
- data/lib/cosmo/cli.rb +6 -0
- data/lib/cosmo/client.rb +217 -23
- data/lib/cosmo/config/cosmo.yml +1 -0
- data/lib/cosmo/config/settings.rb +4 -0
- data/lib/cosmo/config.rb +58 -10
- data/lib/cosmo/engine.rb +28 -1
- data/lib/cosmo/heartbeat.rb +12 -3
- data/lib/cosmo/http_server/handler.rb +5 -0
- data/lib/cosmo/http_server/health.rb +2 -0
- data/lib/cosmo/http_server/ping.rb +2 -0
- data/lib/cosmo/http_server.rb +8 -0
- data/lib/cosmo/job/data.rb +12 -1
- data/lib/cosmo/job/enqueuer.rb +100 -1
- data/lib/cosmo/job/limit.rb +5 -1
- data/lib/cosmo/job/processor.rb +56 -21
- data/lib/cosmo/job/setter.rb +53 -0
- data/lib/cosmo/job.rb +71 -2
- data/lib/cosmo/logger.rb +37 -0
- data/lib/cosmo/middleware/chain.rb +12 -0
- data/lib/cosmo/middleware/limit.rb +12 -3
- data/lib/cosmo/middleware/metrics.rb +6 -4
- data/lib/cosmo/middleware/sentry.rb +6 -4
- data/lib/cosmo/middleware/totals.rb +5 -11
- data/lib/cosmo/middleware.rb +0 -1
- data/lib/cosmo/processor.rb +60 -3
- data/lib/cosmo/publisher.rb +8 -0
- data/lib/cosmo/services.rb +7 -2
- data/lib/cosmo/stream/message.rb +5 -0
- data/lib/cosmo/stream/processor.rb +7 -0
- data/lib/cosmo/stream/serializer.rb +4 -0
- data/lib/cosmo/stream.rb +35 -1
- data/lib/cosmo/utils/duration.rb +3 -0
- data/lib/cosmo/utils/hash.rb +12 -0
- data/lib/cosmo/utils/json.rb +8 -0
- data/lib/cosmo/utils/signal.rb +9 -0
- data/lib/cosmo/utils/stopwatch.rb +1 -0
- data/lib/cosmo/utils/string.rb +4 -0
- data/lib/cosmo/utils/thread_pool.rb +8 -0
- data/lib/cosmo/utils/ttl_cache.rb +10 -0
- data/lib/cosmo/utils.rb +0 -1
- data/lib/cosmo/version.rb +1 -1
- data/lib/cosmo/web/assets/app.css +273 -629
- data/lib/cosmo/web/assets/app.js +158 -0
- data/lib/cosmo/web/assets/fonts/OFL.txt +92 -0
- data/lib/cosmo/web/assets/fonts/geist-mono.woff2 +0 -0
- data/lib/cosmo/web/assets/fonts/geist.woff2 +0 -0
- data/lib/cosmo/web/assets/logo.svg +10 -0
- data/lib/cosmo/web/cache.rb +77 -0
- data/lib/cosmo/web/chart.rb +63 -39
- data/lib/cosmo/web/circuit.rb +56 -0
- data/lib/cosmo/web/context.rb +6 -4
- data/lib/cosmo/web/controllers/application.rb +42 -0
- data/lib/cosmo/web/controllers/batches.rb +8 -1
- data/lib/cosmo/web/controllers/crons.rb +24 -3
- data/lib/cosmo/web/controllers/jobs.rb +88 -68
- data/lib/cosmo/web/controllers/metrics.rb +6 -0
- data/lib/cosmo/web/controllers/overview.rb +88 -0
- data/lib/cosmo/web/controllers/processes.rb +36 -0
- data/lib/cosmo/web/controllers/streams.rb +38 -28
- data/lib/cosmo/web/helpers/application.rb +101 -0
- data/lib/cosmo/web/renderer.rb +36 -6
- data/lib/cosmo/web/throughput.rb +104 -0
- data/lib/cosmo/web/views/batches/_table.erb +42 -54
- data/lib/cosmo/web/views/batches/index.erb +3 -10
- data/lib/cosmo/web/views/crons/_table.erb +36 -55
- data/lib/cosmo/web/views/crons/index.erb +2 -9
- data/lib/cosmo/web/views/jobs/_args.erb +5 -0
- data/lib/cosmo/web/views/jobs/_busy.erb +25 -121
- data/lib/cosmo/web/views/jobs/_dead.erb +42 -82
- data/lib/cosmo/web/views/jobs/_enqueued.erb +33 -113
- data/lib/cosmo/web/views/jobs/_panel.erb +34 -0
- data/lib/cosmo/web/views/jobs/_queue_row.erb +18 -0
- data/lib/cosmo/web/views/jobs/_queues.erb +20 -0
- data/lib/cosmo/web/views/jobs/_scheduled.erb +20 -54
- data/lib/cosmo/web/views/jobs/index.erb +4 -17
- data/lib/cosmo/web/views/layout.erb +73 -22
- data/lib/cosmo/web/views/metrics/_chart.erb +37 -32
- data/lib/cosmo/web/views/metrics/_panel.erb +3 -3
- data/lib/cosmo/web/views/metrics/_table.erb +24 -40
- data/lib/cosmo/web/views/metrics/index.erb +8 -16
- data/lib/cosmo/web/views/overview/_badges.erb +3 -0
- data/lib/cosmo/web/views/overview/_kpis.erb +19 -0
- data/lib/cosmo/web/views/overview/_running.erb +18 -0
- data/lib/cosmo/web/views/overview/_throughput.erb +50 -0
- data/lib/cosmo/web/views/overview/_workers.erb +25 -0
- data/lib/cosmo/web/views/overview/index.erb +28 -0
- data/lib/cosmo/web/views/processes/_table.erb +67 -0
- data/lib/cosmo/web/views/processes/index.erb +1 -0
- data/lib/cosmo/web/views/shared/_pager.erb +22 -0
- data/lib/cosmo/web/views/shared/unavailable.erb +7 -0
- data/lib/cosmo/web/views/streams/_info.erb +29 -86
- data/lib/cosmo/web/views/streams/_list.erb +7 -0
- data/lib/cosmo/web/views/streams/_pause_banner.erb +8 -16
- data/lib/cosmo/web/views/streams/_stream.erb +53 -0
- data/lib/cosmo/web/views/streams/index.erb +3 -11
- data/lib/cosmo/web/views/streams/info.erb +3 -11
- data/lib/cosmo/web.rb +73 -35
- data/lib/cosmo.rb +33 -0
- data/sig/cosmo/active_job/adapter.rbs +3 -3
- data/sig/cosmo/active_job/options.rbs +4 -2
- data/sig/cosmo/api/batch.rbs +5 -3
- data/sig/cosmo/api/counter.rbs +16 -6
- data/sig/cosmo/api/cron/entry.rbs +6 -3
- data/sig/cosmo/api/cron.rbs +10 -4
- data/sig/cosmo/api/kv.rbs +21 -4
- data/sig/cosmo/api/registry.rbs +10 -0
- data/sig/cosmo/api/stats/jobs.rbs +34 -0
- data/sig/cosmo/api/stats/metrics.rbs +4 -1
- data/sig/cosmo/api/stats/processes.rbs +9 -1
- data/sig/cosmo/api/stats.rbs +12 -2
- data/sig/cosmo/api/stream.rbs +12 -5
- data/sig/cosmo/batch/callback.rbs +1 -1
- data/sig/cosmo/batch/dispatcher.rbs +1 -1
- data/sig/cosmo/batch.rbs +5 -5
- data/sig/cosmo/cli.rbs +2 -0
- data/sig/cosmo/client.rbs +24 -4
- data/sig/cosmo/config/settings.rbs +6 -0
- data/sig/cosmo/config.rbs +5 -5
- data/sig/cosmo/engine.rbs +5 -0
- data/sig/cosmo/heartbeat.rbs +2 -0
- data/sig/cosmo/job/data.rbs +3 -1
- data/sig/cosmo/job/enqueuer.rbs +12 -0
- data/sig/cosmo/job/processor.rbs +18 -3
- data/sig/cosmo/job/setter.rbs +20 -0
- data/sig/cosmo/job.rbs +10 -4
- data/sig/cosmo/logger.rbs +5 -3
- data/sig/cosmo/middleware.rbs +0 -8
- data/sig/cosmo/processor.rbs +14 -2
- data/sig/cosmo/publisher.rbs +1 -0
- data/sig/cosmo/stream/processor.rbs +4 -0
- data/sig/cosmo/stream.rbs +4 -3
- data/sig/cosmo/utils/hash.rbs +2 -1
- data/sig/cosmo/utils/signal.rbs +5 -5
- data/sig/cosmo/utils/string.rbs +2 -2
- data/sig/cosmo/utils/thread_pool.rbs +1 -1
- data/sig/cosmo/web/cache.rbs +35 -0
- data/sig/cosmo/web/chart.rbs +48 -0
- data/sig/cosmo/web/circuit.rbs +29 -0
- data/sig/cosmo/web/context.rbs +15 -0
- data/sig/cosmo/web/controllers/application.rbs +32 -0
- data/sig/cosmo/web/controllers/batches.rbs +11 -0
- data/sig/cosmo/web/controllers/crons.rbs +23 -0
- data/sig/cosmo/web/controllers/jobs.rbs +47 -0
- data/sig/cosmo/web/controllers/metrics.rbs +21 -0
- data/sig/cosmo/web/controllers/overview.rbs +31 -0
- data/sig/cosmo/web/controllers/processes.rbs +13 -0
- data/sig/cosmo/web/controllers/streams.rbs +27 -0
- data/sig/cosmo/web/helpers/application.rbs +61 -0
- data/sig/cosmo/web/renderer.rbs +33 -0
- data/sig/cosmo/web/throughput.rbs +45 -0
- data/sig/cosmo/web.rbs +25 -0
- data/sig/cosmo.rbs +19 -0
- metadata +53 -23
- data/lib/cosmo/api/stats/busy.rb +0 -63
- data/lib/cosmo/middleware/busy.rb +0 -15
- data/lib/cosmo/utils/overrides.rb +0 -206
- data/lib/cosmo/utils/warnings.rb +0 -17
- data/lib/cosmo/web/controllers/actions.rb +0 -16
- data/lib/cosmo/web/views/actions/index.erb +0 -7
- data/lib/cosmo/web/views/jobs/_processes.erb +0 -145
- data/lib/cosmo/web/views/jobs/_stats.erb +0 -77
- data/lib/cosmo/web/views/jobs/_tabs.erb +0 -14
- data/lib/cosmo/web/views/jobs/busy.erb +0 -18
- data/lib/cosmo/web/views/jobs/dead.erb +0 -18
- data/lib/cosmo/web/views/jobs/enqueued.erb +0 -18
- data/lib/cosmo/web/views/jobs/scheduled.erb +0 -18
- data/lib/cosmo/web/views/streams/_stream_row.erb +0 -42
- data/lib/cosmo/web/views/streams/_table.erb +0 -25
- data/sig/cosmo/api/stats/busy.rbs +0 -31
data/sig/cosmo/processor.rbs
CHANGED
|
@@ -12,6 +12,8 @@ module Cosmo
|
|
|
12
12
|
@threads: Array[Thread]
|
|
13
13
|
@cache: Utils::TTLCache
|
|
14
14
|
@busy: untyped
|
|
15
|
+
@in_flight: untyped
|
|
16
|
+
@started_at: untyped
|
|
15
17
|
@options: Hash[Symbol, untyped]
|
|
16
18
|
@consumer_state: untyped
|
|
17
19
|
|
|
@@ -27,6 +29,12 @@ module Cosmo
|
|
|
27
29
|
|
|
28
30
|
def busy: () -> Integer
|
|
29
31
|
|
|
32
|
+
def jobs: () -> Array[Hash[Symbol, untyped]]
|
|
33
|
+
|
|
34
|
+
def release: () -> Integer
|
|
35
|
+
|
|
36
|
+
def interrupt: (::Integer | ::Float timeout) -> void
|
|
37
|
+
|
|
30
38
|
def stop: (?::Integer | ::Float timeout) -> void
|
|
31
39
|
|
|
32
40
|
private
|
|
@@ -47,13 +55,17 @@ module Cosmo
|
|
|
47
55
|
|
|
48
56
|
def fetch_subjects: (Hash[Symbol, untyped] config) -> untyped
|
|
49
57
|
|
|
50
|
-
def track_busy: [T] () { () -> T } -> T
|
|
58
|
+
def track_busy: [T] (Array[untyped] messages) { () -> T } -> T
|
|
59
|
+
|
|
60
|
+
def release_message: (untyped message) -> bool
|
|
61
|
+
|
|
62
|
+
def abandon: (untyped message) -> void
|
|
51
63
|
|
|
52
64
|
def running?: () -> bool
|
|
53
65
|
|
|
54
66
|
def quiet?: () -> bool
|
|
55
67
|
|
|
56
|
-
def fetch: (untyped subscription, batch_size: Integer
|
|
68
|
+
def fetch: (untyped subscription, batch_size: Integer?, timeout: Numeric) -> Array[untyped]?
|
|
57
69
|
|
|
58
70
|
def client: () -> Client
|
|
59
71
|
|
data/sig/cosmo/publisher.rbs
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
module Cosmo
|
|
2
2
|
module Stream
|
|
3
3
|
class Processor < ::Cosmo::Processor
|
|
4
|
+
RELEASE_DELAY: ::String
|
|
5
|
+
|
|
4
6
|
@configs: Array[Hash[Symbol, untyped]]
|
|
5
7
|
|
|
6
8
|
def subscriptions: () -> Array[::String]
|
|
7
9
|
|
|
8
10
|
private
|
|
9
11
|
|
|
12
|
+
def abandon: (untyped message) -> void
|
|
13
|
+
|
|
10
14
|
def setup: () -> void
|
|
11
15
|
|
|
12
16
|
def process: (Array[untyped] messages, untyped processor) -> void
|
data/sig/cosmo/stream.rbs
CHANGED
|
@@ -6,7 +6,7 @@ module Cosmo
|
|
|
6
6
|
@default_options: Hash[Symbol, untyped]
|
|
7
7
|
|
|
8
8
|
def options: (
|
|
9
|
-
?stream: Symbol?,
|
|
9
|
+
?stream: (Symbol | ::String)?,
|
|
10
10
|
?consumer_name: ::String?,
|
|
11
11
|
?batch_size: Integer?,
|
|
12
12
|
?fetch_timeout: (Integer | Float)?,
|
|
@@ -14,8 +14,9 @@ module Cosmo
|
|
|
14
14
|
?consumer: Hash[Symbol, untyped]?,
|
|
15
15
|
?publisher: Hash[Symbol, untyped]?
|
|
16
16
|
) -> Hash[Symbol, untyped]
|
|
17
|
+
alias cosmo_options options
|
|
17
18
|
|
|
18
|
-
def publish: (untyped data, ?subject: ::String?, **untyped options) ->
|
|
19
|
+
def publish: (untyped data, ?subject: ::String?, **untyped options) -> untyped
|
|
19
20
|
|
|
20
21
|
def default_options: () -> Hash[Symbol, untyped]
|
|
21
22
|
|
|
@@ -34,6 +35,6 @@ module Cosmo
|
|
|
34
35
|
|
|
35
36
|
def message: () -> Message?
|
|
36
37
|
|
|
37
|
-
def publish: (untyped data, ::String subject, **untyped options) ->
|
|
38
|
+
def publish: (untyped data, ::String? subject, **untyped options) -> untyped
|
|
38
39
|
end
|
|
39
40
|
end
|
data/sig/cosmo/utils/hash.rbs
CHANGED
|
@@ -5,6 +5,8 @@ module Cosmo
|
|
|
5
5
|
|
|
6
6
|
def self.stringify_keys: (untyped obj) -> (::Hash[String, untyped] | Array[untyped] | untyped)
|
|
7
7
|
|
|
8
|
+
def self.deep_merge: (::Hash[untyped, untyped] base, ::Hash[untyped, untyped] other) -> ::Hash[untyped, untyped]
|
|
9
|
+
|
|
8
10
|
def self.dup: [T] (T hash) -> T
|
|
9
11
|
|
|
10
12
|
def symbolize_keys!: (untyped obj) -> (::Hash[Symbol, untyped] | Array[untyped] | untyped)
|
|
@@ -14,7 +16,6 @@ module Cosmo
|
|
|
14
16
|
def deep_merge: (::Hash[untyped, untyped] base, ::Hash[untyped, untyped] other) -> ::Hash[untyped, untyped]
|
|
15
17
|
|
|
16
18
|
def dup: [T] (T hash) -> T
|
|
17
|
-
|
|
18
19
|
end
|
|
19
20
|
end
|
|
20
21
|
end
|
data/sig/cosmo/utils/signal.rbs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
module Cosmo
|
|
2
2
|
module Utils
|
|
3
3
|
class Signal
|
|
4
|
-
@queue: Queue[Symbol]
|
|
4
|
+
@queue: Thread::Queue[Symbol | ::String]
|
|
5
5
|
|
|
6
|
-
def self.trap: (*Symbol signals) -> Signal
|
|
6
|
+
def self.trap: (*(Symbol | ::String) signals) -> Signal
|
|
7
7
|
|
|
8
|
-
def initialize: (*Symbol signals) -> void
|
|
8
|
+
def initialize: (*(Symbol | ::String) signals) -> void
|
|
9
9
|
|
|
10
|
-
def push: (Symbol) -> void
|
|
10
|
+
def push: (Symbol | ::String signal) -> void
|
|
11
11
|
|
|
12
|
-
def wait: () -> Symbol
|
|
12
|
+
def wait: () -> (Symbol | ::String)
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
end
|
data/sig/cosmo/utils/string.rbs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
module Cosmo
|
|
2
2
|
module Utils
|
|
3
3
|
module String
|
|
4
|
-
def self.underscore: (
|
|
4
|
+
def self.underscore: (untyped value) -> ::String
|
|
5
5
|
|
|
6
6
|
def self.safe_constantize: (::String value) -> Class?
|
|
7
7
|
|
|
8
|
-
def underscore: (
|
|
8
|
+
def underscore: (untyped value) -> ::String
|
|
9
9
|
|
|
10
10
|
def safe_constantize: (::String value) -> Class?
|
|
11
11
|
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
module Cosmo
|
|
2
|
+
class Web
|
|
3
|
+
class Cache
|
|
4
|
+
TTL: ::Integer
|
|
5
|
+
LIMIT: ::Integer
|
|
6
|
+
|
|
7
|
+
self.@instance: Cache
|
|
8
|
+
|
|
9
|
+
@ttl: ::Numeric
|
|
10
|
+
@lock: Thread::Mutex
|
|
11
|
+
@entries: ::Hash[untyped, [untyped, ::Float]]
|
|
12
|
+
@gates: ::Hash[untyped, Thread::Mutex]
|
|
13
|
+
|
|
14
|
+
def self.instance: () -> Cache
|
|
15
|
+
|
|
16
|
+
def initialize: (?ttl: ::Numeric) -> void
|
|
17
|
+
|
|
18
|
+
def fetch: (untyped key) { () -> untyped } -> untyped
|
|
19
|
+
|
|
20
|
+
def clear: () -> void
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
def gate: (untyped key) -> Thread::Mutex
|
|
25
|
+
|
|
26
|
+
def read: (untyped key) -> [untyped, ::Float]?
|
|
27
|
+
|
|
28
|
+
def write: (untyped key, untyped value) -> [untyped, ::Float]
|
|
29
|
+
|
|
30
|
+
def prune: () -> void
|
|
31
|
+
|
|
32
|
+
def clock: () -> ::Float
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
module Cosmo
|
|
2
|
+
class Web
|
|
3
|
+
class Chart
|
|
4
|
+
WIDTH: ::Integer
|
|
5
|
+
HEIGHT: ::Integer
|
|
6
|
+
PLOT: ::Integer
|
|
7
|
+
TICKS: ::Integer
|
|
8
|
+
LABELS: ::Integer
|
|
9
|
+
BAR: ::Integer
|
|
10
|
+
|
|
11
|
+
@series: ::Array[::Hash[::Symbol, untyped]]
|
|
12
|
+
@count_top: ::Numeric
|
|
13
|
+
@exec_top: ::Numeric
|
|
14
|
+
|
|
15
|
+
def initialize: (::Array[::Hash[::Symbol, untyped]] series) -> void
|
|
16
|
+
|
|
17
|
+
def empty?: () -> bool
|
|
18
|
+
|
|
19
|
+
def bars: () -> ::String
|
|
20
|
+
|
|
21
|
+
def line: () -> ::String
|
|
22
|
+
|
|
23
|
+
def grid: () -> ::String
|
|
24
|
+
|
|
25
|
+
def ticks: () -> ::Array[::Hash[::Symbol, ::Integer]]
|
|
26
|
+
|
|
27
|
+
def labels: () -> ::Array[::Hash[::Symbol, ::Float | ::String]]
|
|
28
|
+
|
|
29
|
+
def points: () -> ::Array[::Hash[::Symbol, untyped]]
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def slot: () -> ::Float
|
|
34
|
+
|
|
35
|
+
def center: (::Integer index) -> ::Float
|
|
36
|
+
|
|
37
|
+
def exec_y: (::Numeric value) -> ::Float
|
|
38
|
+
|
|
39
|
+
def scale: (::Numeric value, ::Numeric top) -> ::Numeric
|
|
40
|
+
|
|
41
|
+
def percent: (::Numeric value, ?::Numeric total) -> ::Float
|
|
42
|
+
|
|
43
|
+
def top: (::Numeric max) -> ::Numeric
|
|
44
|
+
|
|
45
|
+
def label: (::String date) -> ::String
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module Cosmo
|
|
2
|
+
class Web
|
|
3
|
+
class Circuit
|
|
4
|
+
OPEN_FOR: ::Integer
|
|
5
|
+
ERRORS: ::Array[singleton(::StandardError)]
|
|
6
|
+
|
|
7
|
+
self.@instance: Circuit
|
|
8
|
+
|
|
9
|
+
@lock: Thread::Mutex
|
|
10
|
+
@tripped_at: ::Float?
|
|
11
|
+
|
|
12
|
+
def self.instance: () -> Circuit
|
|
13
|
+
|
|
14
|
+
def initialize: () -> void
|
|
15
|
+
|
|
16
|
+
def open?: () -> bool
|
|
17
|
+
|
|
18
|
+
def trip!: () -> void
|
|
19
|
+
|
|
20
|
+
private
|
|
21
|
+
|
|
22
|
+
def tripped?: () -> bool?
|
|
23
|
+
|
|
24
|
+
def connected?: () -> bool
|
|
25
|
+
|
|
26
|
+
def clock: () -> ::Float
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Cosmo
|
|
2
|
+
class Web
|
|
3
|
+
class Context
|
|
4
|
+
include Helpers::Application
|
|
5
|
+
|
|
6
|
+
@content_for: ::Hash[::Symbol, ::String]
|
|
7
|
+
|
|
8
|
+
def initialize: (::Hash[::Symbol, untyped] locals, ?::Hash[::Symbol, ::String]? content_for) -> void
|
|
9
|
+
|
|
10
|
+
def content_for: (::Symbol name) -> ::String?
|
|
11
|
+
|
|
12
|
+
def content_for?: (::Symbol name) -> bool
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
module Cosmo
|
|
2
|
+
class Web
|
|
3
|
+
module Controllers
|
|
4
|
+
class Application
|
|
5
|
+
include Renderer
|
|
6
|
+
|
|
7
|
+
MAX_LIMIT: ::Integer
|
|
8
|
+
|
|
9
|
+
@request: untyped
|
|
10
|
+
@content_for: ::Hash[::Symbol, ::String]?
|
|
11
|
+
|
|
12
|
+
def initialize: (untyped request) -> void
|
|
13
|
+
|
|
14
|
+
def content_for: (::Symbol name, ::String content) -> ::String
|
|
15
|
+
|
|
16
|
+
def render: (::String template, ?::Hash[::Symbol, untyped]? locals, ?layout: bool) -> ::String
|
|
17
|
+
|
|
18
|
+
def params: () -> ::Hash[::String, untyped]
|
|
19
|
+
|
|
20
|
+
def limit: (::Integer default) -> ::Integer
|
|
21
|
+
|
|
22
|
+
def path: () -> ::String
|
|
23
|
+
|
|
24
|
+
def hx_request?: () -> bool
|
|
25
|
+
|
|
26
|
+
def unavailable: () -> Web::response
|
|
27
|
+
|
|
28
|
+
def flash: (::String message) -> ::String
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Cosmo
|
|
2
|
+
class Web
|
|
3
|
+
module Controllers
|
|
4
|
+
class Crons < Application
|
|
5
|
+
@cron: API::Cron?
|
|
6
|
+
|
|
7
|
+
def index: () -> Web::response
|
|
8
|
+
|
|
9
|
+
def _table: () -> Web::response
|
|
10
|
+
|
|
11
|
+
def run_now: () -> Web::response
|
|
12
|
+
|
|
13
|
+
def delete: () -> Web::response
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def cron: () -> API::Cron
|
|
18
|
+
|
|
19
|
+
def label: (::String subject) -> ::String?
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
module Cosmo
|
|
2
|
+
class Web
|
|
3
|
+
module Controllers
|
|
4
|
+
class Jobs < Application
|
|
5
|
+
def index: () -> Web::response
|
|
6
|
+
|
|
7
|
+
def busy: () -> Web::response
|
|
8
|
+
|
|
9
|
+
def enqueued: () -> Web::response
|
|
10
|
+
|
|
11
|
+
def scheduled: () -> Web::response
|
|
12
|
+
|
|
13
|
+
def dead: () -> Web::response
|
|
14
|
+
|
|
15
|
+
def _queues: () -> Web::response
|
|
16
|
+
|
|
17
|
+
def retry: () -> Web::response
|
|
18
|
+
|
|
19
|
+
def delete: () -> Web::response
|
|
20
|
+
|
|
21
|
+
def delete_enqueued: () -> Web::response
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def tab: (::String name) -> Web::response
|
|
26
|
+
|
|
27
|
+
def panel: (::String name) -> ::String
|
|
28
|
+
|
|
29
|
+
def counts: () -> ::Hash[::Symbol, ::Integer]
|
|
30
|
+
|
|
31
|
+
def busy_locals: () -> ::Hash[::Symbol, untyped]
|
|
32
|
+
|
|
33
|
+
def enqueued_locals: () -> ::Hash[::Symbol, untyped]
|
|
34
|
+
|
|
35
|
+
def scheduled_locals: () -> ::Hash[::Symbol, untyped]
|
|
36
|
+
|
|
37
|
+
def dead_locals: () -> ::Hash[::Symbol, untyped]
|
|
38
|
+
|
|
39
|
+
def stored_locals: (::String name) -> ::Hash[::Symbol, untyped]
|
|
40
|
+
|
|
41
|
+
def paginate: (::Integer total, ::Integer default_limit) -> [::Integer, ::Integer, ::Integer]
|
|
42
|
+
|
|
43
|
+
def streams: () -> [::String?, ::Hash[::String, ::Integer]]
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module Cosmo
|
|
2
|
+
class Web
|
|
3
|
+
module Controllers
|
|
4
|
+
class Metrics < Application
|
|
5
|
+
RANGES: ::Hash[::Integer, ::String]
|
|
6
|
+
|
|
7
|
+
def index: () -> Web::response
|
|
8
|
+
|
|
9
|
+
def _panel: () -> Web::response
|
|
10
|
+
|
|
11
|
+
private
|
|
12
|
+
|
|
13
|
+
def charted: (::Array[::Hash[::Symbol, untyped]] rows) -> ::String?
|
|
14
|
+
|
|
15
|
+
def days: () -> ::Integer
|
|
16
|
+
|
|
17
|
+
def metrics: () -> API::Stats::Metrics
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module Cosmo
|
|
2
|
+
class Web
|
|
3
|
+
module Controllers
|
|
4
|
+
class Overview < Application
|
|
5
|
+
RANGES: ::Array[::Integer]
|
|
6
|
+
CELLS: ::Integer
|
|
7
|
+
RUNNING: ::Integer
|
|
8
|
+
PROCESSES: ::Integer
|
|
9
|
+
BATCHES: ::Integer
|
|
10
|
+
|
|
11
|
+
def index: () -> Web::response
|
|
12
|
+
|
|
13
|
+
def _kpis: () -> Web::response
|
|
14
|
+
|
|
15
|
+
def _throughput: () -> Web::response
|
|
16
|
+
|
|
17
|
+
def _workers: () -> Web::response
|
|
18
|
+
|
|
19
|
+
def _running: () -> Web::response
|
|
20
|
+
|
|
21
|
+
def _badges: () -> Web::response
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def worker_cells: (::Integer threads) -> [::Array[::String?], ::Integer]
|
|
26
|
+
|
|
27
|
+
def visible_streams: () -> ::Array[API::Stream]
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module Cosmo
|
|
2
|
+
class Web
|
|
3
|
+
module Controllers
|
|
4
|
+
class Streams < Application
|
|
5
|
+
def index: () -> Web::response
|
|
6
|
+
|
|
7
|
+
def info: () -> Web::response
|
|
8
|
+
|
|
9
|
+
def pause: () -> Web::response
|
|
10
|
+
|
|
11
|
+
def unpause: () -> Web::response
|
|
12
|
+
|
|
13
|
+
private
|
|
14
|
+
|
|
15
|
+
def name: () -> ::String
|
|
16
|
+
|
|
17
|
+
def list: () -> ::String
|
|
18
|
+
|
|
19
|
+
def toggled: (API::Stream stream, ::String verb) -> Web::response
|
|
20
|
+
|
|
21
|
+
def card: (API::Stream stream) -> ::Hash[::Symbol, untyped]
|
|
22
|
+
|
|
23
|
+
def info_locals: (API::Stream stream) -> ::Hash[::Symbol, untyped]
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
module Cosmo
|
|
2
|
+
class Web
|
|
3
|
+
module Helpers
|
|
4
|
+
module Application
|
|
5
|
+
include Renderer
|
|
6
|
+
|
|
7
|
+
POLL_INTERVAL: ::Integer
|
|
8
|
+
|
|
9
|
+
@poll_interval: ::Integer?
|
|
10
|
+
@hues: ::Hash[::String, ::Integer]?
|
|
11
|
+
@request: untyped
|
|
12
|
+
|
|
13
|
+
def poll_interval: () -> ::Integer
|
|
14
|
+
|
|
15
|
+
def render: (::String template, ?::Hash[::Symbol, untyped]? locals) -> ::String
|
|
16
|
+
|
|
17
|
+
def format_bytes: (untyped bytes) -> ::String
|
|
18
|
+
|
|
19
|
+
def format_numbers: (untyped num) -> ::String
|
|
20
|
+
|
|
21
|
+
def format_timestamp: (untyped value) -> ::String
|
|
22
|
+
|
|
23
|
+
def duration: (::Numeric? millis) -> ::String
|
|
24
|
+
|
|
25
|
+
def elapsed: (untyped value) -> ::String
|
|
26
|
+
|
|
27
|
+
def last_message: (untyped state) -> ::String
|
|
28
|
+
|
|
29
|
+
def time_until: (untyped value) -> ::String
|
|
30
|
+
|
|
31
|
+
def compact_number: (untyped num) -> ::String
|
|
32
|
+
|
|
33
|
+
def format_span: (::Numeric? seconds) -> ::String
|
|
34
|
+
|
|
35
|
+
def hue: (untyped name) -> ::String
|
|
36
|
+
|
|
37
|
+
def nav_items: () -> ::Array[::Hash[::Symbol, ::String]]
|
|
38
|
+
|
|
39
|
+
def current_section: () -> ::String
|
|
40
|
+
|
|
41
|
+
def nats_server: () -> ::Hash[::Symbol, ::String]
|
|
42
|
+
|
|
43
|
+
def h: (untyped value) -> ::String
|
|
44
|
+
|
|
45
|
+
def u: (untyped value) -> ::String
|
|
46
|
+
|
|
47
|
+
def pages: (::Integer page, ::Integer total_pages, ?window: ::Integer) -> ::Array[::Integer | :gap]
|
|
48
|
+
|
|
49
|
+
def current_page?: (::String path) -> bool
|
|
50
|
+
|
|
51
|
+
def path_prefix?: (*::String values) -> bool
|
|
52
|
+
|
|
53
|
+
def referrer?: (::String path) -> bool
|
|
54
|
+
|
|
55
|
+
private
|
|
56
|
+
|
|
57
|
+
def pagination_fill_gap: (::Array[::Integer | :gap] result, ::Integer? previous, ::Integer page) -> void
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module Cosmo
|
|
2
|
+
class Web
|
|
3
|
+
module Renderer
|
|
4
|
+
ASSETS_ROOT: ::String
|
|
5
|
+
VIEWS_ROOT: ::String
|
|
6
|
+
|
|
7
|
+
self.@templates: ::Hash[::String, ::String]
|
|
8
|
+
self.@lock: Thread::Mutex
|
|
9
|
+
|
|
10
|
+
@request: untyped
|
|
11
|
+
|
|
12
|
+
def self.template: (::String path) -> ::String
|
|
13
|
+
|
|
14
|
+
def redirect_to: (::String url, ?::Integer status) -> Web::response
|
|
15
|
+
|
|
16
|
+
def serve: (::String filename, ::String content_type, ?::Hash[::String, ::String]? headers) -> Web::response
|
|
17
|
+
|
|
18
|
+
def ok: (?::String body) -> Web::response
|
|
19
|
+
|
|
20
|
+
def no_content: () -> Web::response
|
|
21
|
+
|
|
22
|
+
def not_found: () -> Web::response
|
|
23
|
+
|
|
24
|
+
def url_for: (::String path, ?::Hash[untyped, untyped]? params) -> ::String
|
|
25
|
+
|
|
26
|
+
private
|
|
27
|
+
|
|
28
|
+
def respond_with: (::Integer status, ?headers: ::Hash[::String, ::String]?, ?body: ::String) -> Web::response
|
|
29
|
+
|
|
30
|
+
def erb: (::String path, ::Hash[::Symbol, untyped] locals, ?::Hash[::Symbol, ::String]? content_for) -> ::String
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
module Cosmo
|
|
2
|
+
class Web
|
|
3
|
+
class Throughput
|
|
4
|
+
WIDTH: ::Integer
|
|
5
|
+
HEIGHT: ::Integer
|
|
6
|
+
PLOT: ::Integer
|
|
7
|
+
FAILED: ::Integer
|
|
8
|
+
BAR: ::Integer
|
|
9
|
+
TICKS: ::Integer
|
|
10
|
+
LABELS: ::Integer
|
|
11
|
+
|
|
12
|
+
@series: ::Array[::Hash[::Symbol, untyped]]
|
|
13
|
+
@top: ::Numeric
|
|
14
|
+
@failed_top: ::Integer
|
|
15
|
+
|
|
16
|
+
def initialize: (::Array[::Hash[::Symbol, untyped]] series) -> void
|
|
17
|
+
|
|
18
|
+
def empty?: () -> bool
|
|
19
|
+
|
|
20
|
+
def line: () -> ::String
|
|
21
|
+
|
|
22
|
+
def area: () -> ::String
|
|
23
|
+
|
|
24
|
+
def failures: () -> ::String
|
|
25
|
+
|
|
26
|
+
def grid: () -> ::String
|
|
27
|
+
|
|
28
|
+
def ticks: () -> ::Array[::Integer]
|
|
29
|
+
|
|
30
|
+
def labels: () -> ::Array[::String]
|
|
31
|
+
|
|
32
|
+
def points: () -> ::Array[::Hash[::Symbol, untyped]]
|
|
33
|
+
|
|
34
|
+
private
|
|
35
|
+
|
|
36
|
+
def x: (::Integer index) -> ::Float
|
|
37
|
+
|
|
38
|
+
def y: (::Numeric value) -> ::Float
|
|
39
|
+
|
|
40
|
+
def top: (::Numeric max) -> ::Numeric
|
|
41
|
+
|
|
42
|
+
def label: (::String date) -> ::String
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
data/sig/cosmo/web.rbs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module Cosmo
|
|
2
|
+
class Web
|
|
3
|
+
type response = [::Integer, ::Hash[::String, ::String], ::Array[::String]]
|
|
4
|
+
|
|
5
|
+
include Renderer
|
|
6
|
+
|
|
7
|
+
FONT_HEADERS: ::Hash[::String, ::String]
|
|
8
|
+
|
|
9
|
+
@request: untyped
|
|
10
|
+
|
|
11
|
+
def self.call: (::Hash[::String, untyped] env) -> response
|
|
12
|
+
|
|
13
|
+
def call: (::Hash[::String, untyped] env) -> response
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def route: () -> response
|
|
18
|
+
|
|
19
|
+
def guarded: () -> response
|
|
20
|
+
|
|
21
|
+
def unavailable: () -> response
|
|
22
|
+
|
|
23
|
+
def handler: ([singleton(Controllers::Application), ::Symbol] | response route) -> response
|
|
24
|
+
end
|
|
25
|
+
end
|