pg_eventstore 3.0.1 → 3.1.1
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/CHANGELOG.md +25 -8
- data/README.md +1 -0
- data/docs/admin_ui.md +5 -0
- data/docs/metrics.md +233 -0
- data/lib/pg_eventstore/chunks/subscription_events_index_chunk.rb +1 -3
- data/lib/pg_eventstore/queries/replica_queries.rb +8 -5
- data/lib/pg_eventstore/sql_builder.rb +1 -1
- data/lib/pg_eventstore/subscriptions/callback_handlers/subscription_runner_handlers.rb +1 -1
- data/lib/pg_eventstore/subscriptions/runner_recovery_strategies/report_subscription_unrecoverable_error.rb +31 -0
- data/lib/pg_eventstore/subscriptions/runner_recovery_strategies.rb +1 -0
- data/lib/pg_eventstore/subscriptions/subscriptions_manager.rb +5 -0
- data/lib/pg_eventstore/utils.rb +2 -0
- data/lib/pg_eventstore/version.rb +1 -1
- data/lib/pg_eventstore/web/application.rb +7 -0
- data/lib/pg_eventstore/web/metrics/application.rb +64 -0
- data/lib/pg_eventstore/web/metrics/collectors/base.rb +69 -0
- data/lib/pg_eventstore/web/metrics/collectors/subscriptions_health.rb +78 -0
- data/lib/pg_eventstore/web/metrics/collectors/subscriptions_latency.rb +161 -0
- data/lib/pg_eventstore/web/metrics/collectors/subscriptions_throughput.rb +59 -0
- data/lib/pg_eventstore/web/metrics/formatter.rb +45 -0
- data/lib/pg_eventstore/web/metrics/helpers.rb +30 -0
- data/lib/pg_eventstore/web/metrics/metric_family.rb +40 -0
- data/lib/pg_eventstore/web/paginator/helpers.rb +27 -23
- data/lib/pg_eventstore/web/views/home/partials/events.erb +8 -6
- data/lib/pg_eventstore/web/views/home/partials/stream_filter.erb +1 -1
- data/lib/pg_eventstore/web/views/streams/partials/streams.erb +1 -1
- data/lib/pg_eventstore/web.rb +8 -0
- data/rbs_collection.lock.yaml +1 -1
- data/sig/pg_eventstore/subscriptions/callback_handlers/subscription_runner_handlers.rbs +1 -1
- data/sig/pg_eventstore/subscriptions/runner_recovery_strategies/report_subscription_unrecoverable_error.rbs +15 -0
- data/sig/pg_eventstore/web/application.rbs +2 -0
- data/sig/pg_eventstore/web/metrics/application.rbs +11 -0
- data/sig/pg_eventstore/web/metrics/collectors/base.rbs +33 -0
- data/sig/pg_eventstore/web/metrics/collectors/subscriptions_health.rbs +15 -0
- data/sig/pg_eventstore/web/metrics/collectors/subscriptions_latency.rbs +31 -0
- data/sig/pg_eventstore/web/metrics/collectors/subscriptions_throughput.rbs +15 -0
- data/sig/pg_eventstore/web/metrics/formatter.rbs +19 -0
- data/sig/pg_eventstore/web/metrics/helpers.rbs +11 -0
- data/sig/pg_eventstore/web/metrics/metric_family.rbs +19 -0
- data/sig/pg_eventstore/web/paginator/helpers.rbs +5 -3
- metadata +20 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module PgEventstore
|
|
2
|
+
module Web
|
|
3
|
+
module Metrics
|
|
4
|
+
module Collectors
|
|
5
|
+
class Base
|
|
6
|
+
STATEMENT_TIMEOUT: Integer
|
|
7
|
+
|
|
8
|
+
@connection: Connection
|
|
9
|
+
|
|
10
|
+
@sets: Array[String]
|
|
11
|
+
|
|
12
|
+
attr_reader connection: Connection
|
|
13
|
+
|
|
14
|
+
attr_reader sets: Array[String]
|
|
15
|
+
|
|
16
|
+
def initialize: (Connection connection, ?sets: Array[String]) -> void
|
|
17
|
+
|
|
18
|
+
def call: -> Array[Web::Metrics::MetricFamily]
|
|
19
|
+
|
|
20
|
+
def subscriptions_sql_builder: -> SQLBuilder
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
def subscription_labels: (Hash[String, untyped] row) -> Hash[Symbol, untyped]
|
|
25
|
+
|
|
26
|
+
def transaction_queries: -> TransactionQueries
|
|
27
|
+
|
|
28
|
+
def with_safe_conn: () { (PgConnection conn) -> PG::Result } -> Array[Hash[String, untyped]]
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module PgEventstore
|
|
2
|
+
module Web
|
|
3
|
+
module Metrics
|
|
4
|
+
module Collectors
|
|
5
|
+
class SubscriptionsLatency < Base
|
|
6
|
+
def call: -> Array[MetricFamily]
|
|
7
|
+
|
|
8
|
+
private
|
|
9
|
+
|
|
10
|
+
def add_samples: (
|
|
11
|
+
Hash[String, untyped] row,
|
|
12
|
+
Hash[Integer, Time] created_at_by_position,
|
|
13
|
+
Time now,
|
|
14
|
+
MetricFamily lag_events,
|
|
15
|
+
MetricFamily lag_seconds
|
|
16
|
+
) -> void
|
|
17
|
+
|
|
18
|
+
def positions: -> [Integer, Integer]
|
|
19
|
+
|
|
20
|
+
def subscription_rows: (Integer frontier_position) -> Array[Hash[String, untyped]]
|
|
21
|
+
|
|
22
|
+
def resolve_created_at: (Array[Hash[String, untyped]] subscription_rows) -> Hash[Integer, Time]
|
|
23
|
+
|
|
24
|
+
def events_global_index_queries: -> EventsGlobalIndexQueries
|
|
25
|
+
|
|
26
|
+
def store_families: (Integer frontier_position, Integer head_global_position) -> Array[MetricFamily]
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module PgEventstore
|
|
2
|
+
module Web
|
|
3
|
+
module Metrics
|
|
4
|
+
class Formatter
|
|
5
|
+
CONTENT_TYPE: String
|
|
6
|
+
|
|
7
|
+
def call: (Array[MetricFamily] families) -> String
|
|
8
|
+
|
|
9
|
+
private
|
|
10
|
+
|
|
11
|
+
def format_family: (MetricFamily family) -> String
|
|
12
|
+
|
|
13
|
+
def format_labels: (Hash[Symbol, untyped] labels) -> String
|
|
14
|
+
|
|
15
|
+
def escape_label_value: (String value) -> String
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module PgEventstore
|
|
2
|
+
module Web
|
|
3
|
+
module Metrics
|
|
4
|
+
class MetricFamily
|
|
5
|
+
attr_reader name: String
|
|
6
|
+
|
|
7
|
+
attr_reader type: String
|
|
8
|
+
|
|
9
|
+
attr_reader help: String
|
|
10
|
+
|
|
11
|
+
attr_reader samples: Array[Hash[Symbol, untyped]]
|
|
12
|
+
|
|
13
|
+
def initialize: (name: String, type: String, help: String) -> void
|
|
14
|
+
|
|
15
|
+
def add_sample: (labels: Hash[Symbol, untyped], value: Integer | Float) -> void
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -4,7 +4,7 @@ module PgEventstore
|
|
|
4
4
|
module Helpers
|
|
5
5
|
def empty_characters_fallback: (String str)-> String
|
|
6
6
|
|
|
7
|
-
def
|
|
7
|
+
def event_marker_url: (String marker) -> String
|
|
8
8
|
|
|
9
9
|
def previous_page_link: (BaseCollection collection) -> String
|
|
10
10
|
|
|
@@ -14,17 +14,19 @@ module PgEventstore
|
|
|
14
14
|
|
|
15
15
|
def per_page_url: (String per_page) -> String
|
|
16
16
|
|
|
17
|
+
def resolve_link_tos_url: (bool should_resolve) -> String
|
|
18
|
+
|
|
17
19
|
def sort_url: (String order) -> String
|
|
18
20
|
|
|
19
21
|
def total_count: (Integer number) -> String
|
|
20
22
|
|
|
21
23
|
def number_with_delimiter: (Integer number, ?delimiter: String) -> String
|
|
22
24
|
|
|
23
|
-
def
|
|
25
|
+
def stream_url: (Stream stream) -> String
|
|
24
26
|
|
|
25
27
|
def build_starting_id_link: ((String | Integer)? starting_id) -> String
|
|
26
28
|
|
|
27
|
-
def build_path: ((::Hash[untyped, untyped] | ::Array[untyped]) params, ?
|
|
29
|
+
def build_path: ((::Hash[untyped, untyped] | ::Array[untyped]) params, ?base_path: String) -> String
|
|
28
30
|
end
|
|
29
31
|
end
|
|
30
32
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pg_eventstore
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ivan Dzyzenko
|
|
@@ -119,6 +119,7 @@ files:
|
|
|
119
119
|
- docs/how_it_works.md
|
|
120
120
|
- docs/linking_events.md
|
|
121
121
|
- docs/maintenance.md
|
|
122
|
+
- docs/metrics.md
|
|
122
123
|
- docs/multiple_commands.md
|
|
123
124
|
- docs/reading_events.md
|
|
124
125
|
- docs/reading_streams.md
|
|
@@ -265,6 +266,7 @@ files:
|
|
|
265
266
|
- lib/pg_eventstore/subscriptions/replica_subscription_handler.rb
|
|
266
267
|
- lib/pg_eventstore/subscriptions/replica_subscription_runner.rb
|
|
267
268
|
- lib/pg_eventstore/subscriptions/runner_recovery_strategies.rb
|
|
269
|
+
- lib/pg_eventstore/subscriptions/runner_recovery_strategies/report_subscription_unrecoverable_error.rb
|
|
268
270
|
- lib/pg_eventstore/subscriptions/runner_recovery_strategies/restore_connection.rb
|
|
269
271
|
- lib/pg_eventstore/subscriptions/runner_recovery_strategies/restore_subscription_feeder.rb
|
|
270
272
|
- lib/pg_eventstore/subscriptions/runner_recovery_strategies/restore_subscription_runner.rb
|
|
@@ -302,6 +304,14 @@ files:
|
|
|
302
304
|
- lib/pg_eventstore/version.rb
|
|
303
305
|
- lib/pg_eventstore/web.rb
|
|
304
306
|
- lib/pg_eventstore/web/application.rb
|
|
307
|
+
- lib/pg_eventstore/web/metrics/application.rb
|
|
308
|
+
- lib/pg_eventstore/web/metrics/collectors/base.rb
|
|
309
|
+
- lib/pg_eventstore/web/metrics/collectors/subscriptions_health.rb
|
|
310
|
+
- lib/pg_eventstore/web/metrics/collectors/subscriptions_latency.rb
|
|
311
|
+
- lib/pg_eventstore/web/metrics/collectors/subscriptions_throughput.rb
|
|
312
|
+
- lib/pg_eventstore/web/metrics/formatter.rb
|
|
313
|
+
- lib/pg_eventstore/web/metrics/helpers.rb
|
|
314
|
+
- lib/pg_eventstore/web/metrics/metric_family.rb
|
|
305
315
|
- lib/pg_eventstore/web/paginator/base_collection.rb
|
|
306
316
|
- lib/pg_eventstore/web/paginator/event_types_collection.rb
|
|
307
317
|
- lib/pg_eventstore/web/paginator/events_collection.rb
|
|
@@ -494,6 +504,7 @@ files:
|
|
|
494
504
|
- sig/pg_eventstore/subscriptions/queries/subscriptions_set_queries.rbs
|
|
495
505
|
- sig/pg_eventstore/subscriptions/replica_subscription_handler.rbs
|
|
496
506
|
- sig/pg_eventstore/subscriptions/replica_subscription_runner.rbs
|
|
507
|
+
- sig/pg_eventstore/subscriptions/runner_recovery_strategies/report_subscription_unrecoverable_error.rbs
|
|
497
508
|
- sig/pg_eventstore/subscriptions/runner_recovery_strategies/restore_connection.rbs
|
|
498
509
|
- sig/pg_eventstore/subscriptions/runner_recovery_strategies/restore_subscription_feeder.rbs
|
|
499
510
|
- sig/pg_eventstore/subscriptions/runner_recovery_strategies/restore_subscription_runner.rbs
|
|
@@ -529,6 +540,14 @@ files:
|
|
|
529
540
|
- sig/pg_eventstore/utils.rbs
|
|
530
541
|
- sig/pg_eventstore/version.rbs
|
|
531
542
|
- sig/pg_eventstore/web/application.rbs
|
|
543
|
+
- sig/pg_eventstore/web/metrics/application.rbs
|
|
544
|
+
- sig/pg_eventstore/web/metrics/collectors/base.rbs
|
|
545
|
+
- sig/pg_eventstore/web/metrics/collectors/subscriptions_health.rbs
|
|
546
|
+
- sig/pg_eventstore/web/metrics/collectors/subscriptions_latency.rbs
|
|
547
|
+
- sig/pg_eventstore/web/metrics/collectors/subscriptions_throughput.rbs
|
|
548
|
+
- sig/pg_eventstore/web/metrics/formatter.rbs
|
|
549
|
+
- sig/pg_eventstore/web/metrics/helpers.rbs
|
|
550
|
+
- sig/pg_eventstore/web/metrics/metric_family.rbs
|
|
532
551
|
- sig/pg_eventstore/web/paginator/base_collection.rbs
|
|
533
552
|
- sig/pg_eventstore/web/paginator/event_types_collection.rbs
|
|
534
553
|
- sig/pg_eventstore/web/paginator/events_collection.rbs
|