karafka-web 1.0.0.beta1 → 1.0.0.rc1

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.
Files changed (178) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +27 -1
  3. data/Gemfile.lint.lock +8 -7
  4. data/Gemfile.lock +23 -29
  5. data/docker-compose.yml +1 -1
  6. data/karafka-web.gemspec +2 -2
  7. data/lib/karafka/web/deserializer.rb +1 -1
  8. data/lib/karafka/web/management/actions/create_initial_states.rb +1 -2
  9. data/lib/karafka/web/management/actions/enable.rb +28 -5
  10. data/lib/karafka/web/management/actions/migrate_states_data.rb +1 -2
  11. data/lib/karafka/web/management/migrations/base.rb +1 -2
  12. data/lib/karafka/web/pro/commanding/commands/base.rb +1 -0
  13. data/lib/karafka/web/pro/commanding/commands/consumers/quiet.rb +0 -1
  14. data/lib/karafka/web/pro/commanding/commands/consumers/stop.rb +0 -1
  15. data/lib/karafka/web/pro/commanding/commands/consumers/trace.rb +0 -1
  16. data/lib/karafka/web/pro/commanding/handlers/group_id_extractor.rb +49 -0
  17. data/lib/karafka/web/pro/commanding/handlers/partitions/commands/base.rb +0 -1
  18. data/lib/karafka/web/pro/commanding/handlers/partitions/listener.rb +4 -2
  19. data/lib/karafka/web/pro/commanding/handlers/topics/listener.rb +4 -2
  20. data/lib/karafka/web/pro/commanding/listener.rb +0 -4
  21. data/lib/karafka/web/pro/commanding/matchers/consumer_group_id.rb +1 -1
  22. data/lib/karafka/web/pro/ui/controllers/cluster_controller.rb +0 -1
  23. data/lib/karafka/web/pro/ui/controllers/consumers/base_controller.rb +15 -0
  24. data/lib/karafka/web/pro/ui/controllers/consumers/partitions/base_controller.rb +1 -6
  25. data/lib/karafka/web/pro/ui/controllers/consumers/topics/pauses_controller.rb +1 -6
  26. data/lib/karafka/web/pro/ui/controllers/scheduled_messages/schedules_controller.rb +0 -1
  27. data/lib/karafka/web/pro/ui/lib/patterns_detector.rb +1 -1
  28. data/lib/karafka/web/pro/ui/lib/policies/contracts/config.rb +0 -1
  29. data/lib/karafka/web/pro/ui/lib/search/contracts/config.rb +0 -1
  30. data/lib/karafka/web/pro/ui/views/cluster/_breadcrumbs.erb +1 -1
  31. data/lib/karafka/web/pro/ui/views/cluster/_config.erb +3 -3
  32. data/lib/karafka/web/pro/ui/views/cluster/_partition.erb +43 -0
  33. data/lib/karafka/web/pro/ui/views/cluster/index.erb +1 -1
  34. data/lib/karafka/web/pro/ui/views/consumers/commands/_empty.erb +1 -3
  35. data/lib/karafka/web/pro/ui/views/consumers/consumers/consumer/_no_subscriptions.erb +1 -7
  36. data/lib/karafka/web/pro/ui/views/consumers/consumers/consumer/_subscription_group.erb +1 -3
  37. data/lib/karafka/web/pro/ui/views/consumers/consumers/index.erb +5 -5
  38. data/lib/karafka/web/pro/ui/views/consumers/jobs/_no_jobs.erb +1 -3
  39. data/lib/karafka/web/pro/ui/views/dashboard/_counters.erb +96 -0
  40. data/lib/karafka/web/pro/ui/views/dlq/_breadcrumbs.erb +1 -1
  41. data/lib/karafka/web/pro/ui/views/dlq/_no_topics.erb +1 -1
  42. data/lib/karafka/web/pro/ui/views/dlq/_topic.erb +5 -1
  43. data/lib/karafka/web/pro/ui/views/errors/_detail.erb +68 -0
  44. data/lib/karafka/web/pro/ui/views/errors/_table.erb +2 -2
  45. data/lib/karafka/web/pro/ui/views/explorer/explorer/_filtered.erb +3 -16
  46. data/lib/karafka/web/pro/ui/views/explorer/explorer/_no_topics.erb +1 -1
  47. data/lib/karafka/web/pro/ui/views/explorer/explorer/_topic.erb +5 -1
  48. data/lib/karafka/web/pro/ui/views/explorer/explorer/partition/_cleaned.erb +1 -3
  49. data/lib/karafka/web/pro/ui/views/explorer/explorer/partition/_empty.erb +1 -3
  50. data/lib/karafka/web/pro/ui/views/explorer/explorer/topic/_empty.erb +1 -3
  51. data/lib/karafka/web/pro/ui/views/explorer/search/_no_results.erb +1 -3
  52. data/lib/karafka/web/pro/ui/views/explorer/search/_no_search_criteria.erb +1 -3
  53. data/lib/karafka/web/pro/ui/views/health/_breadcrumbs.erb +1 -1
  54. data/lib/karafka/web/pro/ui/views/health/_no_data.erb +1 -1
  55. data/lib/karafka/web/pro/ui/views/health/_tabs.erb +1 -1
  56. data/lib/karafka/web/pro/ui/views/jobs/_no_jobs.erb +1 -1
  57. data/lib/karafka/web/pro/ui/views/recurring_tasks/_actions.erb +1 -1
  58. data/lib/karafka/web/pro/ui/views/recurring_tasks/_not_active.erb +3 -5
  59. data/lib/karafka/web/pro/ui/views/recurring_tasks/_tabs.erb +1 -1
  60. data/lib/karafka/web/pro/ui/views/recurring_tasks/logs.erb +1 -1
  61. data/lib/karafka/web/pro/ui/views/routing/show.erb +1 -1
  62. data/lib/karafka/web/pro/ui/views/scheduled_messages/explorer/message/_schedule.erb +1 -1
  63. data/lib/karafka/web/pro/ui/views/scheduled_messages/schedules/_no_groups.erb +3 -5
  64. data/lib/karafka/web/pro/ui/views/scheduled_messages/schedules/show.erb +2 -2
  65. data/lib/karafka/web/pro/ui/views/topics/configs/_config.erb +1 -1
  66. data/lib/karafka/web/pro/ui/views/topics/configs/_edit_plan.erb +10 -13
  67. data/lib/karafka/web/pro/ui/views/topics/distributions/_edit_hints.erb +9 -12
  68. data/lib/karafka/web/pro/ui/views/topics/distributions/_empty_partitions.erb +1 -1
  69. data/lib/karafka/web/pro/ui/views/topics/replications/_warning_low_durability.erb +1 -1
  70. data/lib/karafka/web/pro/ui/views/topics/replications/_warning_no_redundancy.erb +1 -1
  71. data/lib/karafka/web/pro/ui/views/topics/replications/_warning_zero_fault_tolerance.erb +1 -1
  72. data/lib/karafka/web/pro/ui/views/topics/topics/_delete_hints.erb +8 -12
  73. data/lib/karafka/web/pro/ui/views/topics/topics/_topic.erb +5 -1
  74. data/lib/karafka/web/processing/consumers/aggregators/metrics.rb +1 -1
  75. data/lib/karafka/web/processing/consumers/aggregators/state/context.rb +39 -0
  76. data/lib/karafka/web/processing/consumers/aggregators/state/steps/base.rb +41 -0
  77. data/lib/karafka/web/processing/consumers/aggregators/state/steps/evict_expired_processes.rb +38 -0
  78. data/lib/karafka/web/processing/consumers/aggregators/state/steps/increment_counters.rb +26 -0
  79. data/lib/karafka/web/processing/consumers/aggregators/state/steps/refresh_current_stats.rb +89 -0
  80. data/lib/karafka/web/processing/consumers/aggregators/state/steps/register_process.rb +32 -0
  81. data/lib/karafka/web/processing/consumers/aggregators/state.rb +34 -103
  82. data/lib/karafka/web/processing/consumers/contracts/aggregated_stats.rb +1 -1
  83. data/lib/karafka/web/tracking/consumers/contracts/consumer_group.rb +1 -2
  84. data/lib/karafka/web/tracking/consumers/contracts/subscription_group.rb +1 -2
  85. data/lib/karafka/web/tracking/consumers/listeners/base.rb +6 -0
  86. data/lib/karafka/web/tracking/consumers/listeners/connections.rb +1 -1
  87. data/lib/karafka/web/tracking/consumers/listeners/errors.rb +3 -3
  88. data/lib/karafka/web/tracking/consumers/listeners/processing.rb +1 -1
  89. data/lib/karafka/web/tracking/consumers/listeners/statistics.rb +1 -1
  90. data/lib/karafka/web/tracking/consumers/sampler/metrics/container.rb +1 -2
  91. data/lib/karafka/web/tracking/consumers/sampler/metrics/os.rb +2 -3
  92. data/lib/karafka/web/tracking/helpers/error_info.rb +0 -1
  93. data/lib/karafka/web/ui/base.rb +1 -1
  94. data/lib/karafka/web/ui/controllers/errors_controller.rb +2 -3
  95. data/lib/karafka/web/ui/controllers/requests/params.rb +1 -2
  96. data/lib/karafka/web/ui/helpers/application_helper.rb +39 -3
  97. data/lib/karafka/web/ui/lib/cache.rb +2 -3
  98. data/lib/karafka/web/ui/lib/paginations/paginators/arrays.rb +5 -1
  99. data/lib/karafka/web/ui/lib/sorter.rb +1 -2
  100. data/lib/karafka/web/ui/models/metrics/aggregated.rb +4 -1
  101. data/lib/karafka/web/ui/models/status/checks/replication.rb +3 -4
  102. data/lib/karafka/web/ui/models/subscription_group.rb +0 -1
  103. data/lib/karafka/web/ui/public/javascripts/application.js +1 -0
  104. data/lib/karafka/web/ui/public/javascripts/application.min.js +3 -2
  105. data/lib/karafka/web/ui/public/javascripts/application.min.js.br +0 -0
  106. data/lib/karafka/web/ui/public/javascripts/application.min.js.gz +0 -0
  107. data/lib/karafka/web/ui/public/javascripts/components/modal_opener.js +19 -0
  108. data/lib/karafka/web/ui/public/javascripts/components/tabs_manager.js +8 -3
  109. data/lib/karafka/web/ui/public/stylesheets/application.min.css +3510 -4095
  110. data/lib/karafka/web/ui/public/stylesheets/application.min.css.br +0 -0
  111. data/lib/karafka/web/ui/public/stylesheets/application.min.css.gz +0 -0
  112. data/lib/karafka/web/ui/public/stylesheets/libs/highlight_dark.min.css.gz +0 -0
  113. data/lib/karafka/web/ui/public/stylesheets/libs/highlight_light.min.css.gz +0 -0
  114. data/lib/karafka/web/ui/public/stylesheets/libs/tailwind.css +30 -61
  115. data/lib/karafka/web/ui/routes/assets.rb +0 -1
  116. data/lib/karafka/web/ui/views/cluster/_breadcrumbs.erb +1 -1
  117. data/lib/karafka/web/ui/views/cluster/_no_partitions.erb +1 -1
  118. data/lib/karafka/web/ui/views/cluster/_partition.erb +2 -6
  119. data/lib/karafka/web/ui/views/cluster/brokers.erb +1 -1
  120. data/lib/karafka/web/ui/views/cluster/replication.erb +2 -2
  121. data/lib/karafka/web/ui/views/consumers/_consumer.erb +1 -3
  122. data/lib/karafka/web/ui/views/consumers/_no_consumers.erb +2 -2
  123. data/lib/karafka/web/ui/views/consumers/_tabs.erb +6 -19
  124. data/lib/karafka/web/ui/views/consumers/index.erb +4 -4
  125. data/lib/karafka/web/ui/views/dashboard/_counters.erb +8 -12
  126. data/lib/karafka/web/ui/views/dashboard/_feature_pro.erb +1 -1
  127. data/lib/karafka/web/ui/views/dashboard/_not_enough_data.erb +1 -1
  128. data/lib/karafka/web/ui/views/errors/_cleaned.erb +1 -1
  129. data/lib/karafka/web/ui/views/errors/_detail.erb +0 -12
  130. data/lib/karafka/web/ui/views/errors/_no_errors.erb +1 -1
  131. data/lib/karafka/web/ui/views/jobs/_job.erb +1 -3
  132. data/lib/karafka/web/ui/views/jobs/_no_jobs.erb +1 -1
  133. data/lib/karafka/web/ui/views/layout.erb +0 -1
  134. data/lib/karafka/web/ui/views/routing/_breadcrumbs.erb +1 -1
  135. data/lib/karafka/web/ui/views/routing/_topic.erb +5 -3
  136. data/lib/karafka/web/ui/views/routing/show.erb +1 -1
  137. data/lib/karafka/web/ui/views/shared/_compacted_message_info.erb +5 -5
  138. data/lib/karafka/web/ui/views/shared/_empty_state.erb +26 -0
  139. data/lib/karafka/web/ui/views/shared/_gated_nav_item.erb +11 -0
  140. data/lib/karafka/web/ui/views/shared/_navigation.erb +7 -60
  141. data/lib/karafka/web/ui/views/shared/_no_paginated_data.erb +4 -3
  142. data/lib/karafka/web/ui/views/shared/_tab_nav.erb +16 -3
  143. data/lib/karafka/web/ui/views/shared/_title.erb +2 -2
  144. data/lib/karafka/web/ui/views/shared/alerts/_box_primary.erb +1 -1
  145. data/lib/karafka/web/ui/views/shared/alerts/_box_secondary.erb +1 -1
  146. data/lib/karafka/web/ui/views/shared/exceptions/pro_only.erb +6 -6
  147. data/lib/karafka/web/ui/views/shared/icons/_document.erb +4 -0
  148. data/lib/karafka/web/ui/views/shared/icons/_folder.erb +4 -0
  149. data/lib/karafka/web/ui/views/shared/icons/_gear.erb +2 -1
  150. data/lib/karafka/web/ui/views/shared/icons/_inbox.erb +4 -0
  151. data/lib/karafka/web/ui/views/shared/icons/_key.erb +4 -0
  152. data/lib/karafka/web/ui/views/shared/icons/_magnifying_glass.erb +2 -1
  153. data/lib/karafka/web/ui/views/status/failures/_state_calculation.erb +1 -1
  154. data/lib/karafka/web/ui/views/status/failures/_topics.erb +1 -1
  155. data/lib/karafka/web/ui/views/status/warnings/_commands_topic_presence.erb +1 -1
  156. data/lib/karafka/web/ui/views/status/warnings/_pro_subscription.erb +1 -1
  157. data/lib/karafka/web/ui/views/support/show.erb +12 -4
  158. data/lib/karafka/web/ui/views/ux/_badges.erb +32 -0
  159. data/lib/karafka/web/ui/views/ux/_breadcrumbs_showcase.erb +24 -0
  160. data/lib/karafka/web/ui/views/ux/_buttons.erb +24 -0
  161. data/lib/karafka/web/ui/views/ux/_card_support.erb +2 -2
  162. data/lib/karafka/web/ui/views/ux/_cards.erb +6 -0
  163. data/lib/karafka/web/ui/views/ux/_data_table.erb +3 -3
  164. data/lib/karafka/web/ui/views/ux/_dropdowns.erb +16 -0
  165. data/lib/karafka/web/ui/views/ux/_empty_states.erb +41 -0
  166. data/lib/karafka/web/ui/views/ux/_modals.erb +31 -0
  167. data/lib/karafka/web/ui/views/ux/_status_rows.erb +1 -1
  168. data/lib/karafka/web/ui/views/ux/_text.erb +18 -0
  169. data/lib/karafka/web/ui/views/ux/_tooltips.erb +4 -0
  170. data/lib/karafka/web/ui/views/ux/show.erb +6 -1
  171. data/lib/karafka/web/version.rb +1 -1
  172. data/lib/karafka/web.rb +1 -7
  173. data/package-lock.json +149 -198
  174. data/package.json +3 -0
  175. metadata +29 -9
  176. data/config/locales/slogans.yml +0 -62
  177. data/lib/karafka/web/ui/views/shared/_become_pro.erb +0 -13
  178. data/lib/karafka/web/ui/views/ux/_row_table.erb +0 -52
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 27e32327bc795732ee58f5dc757bd1fbe1dbc24198a8561f67cffbb48c5a4eb3
4
- data.tar.gz: 81bb5e628233f6acf7d9cf0527ed07517271cc87f4b19cef925dd2e4e3887ef0
3
+ metadata.gz: 64a1fc3668da51d60226e170e3942d77e9da1dc440d85a16e5678d0bb54ca592
4
+ data.tar.gz: efa56ac32d1591a5a47fb220f295909796e2b891bb26ab26ced879f55f0c8484
5
5
  SHA512:
6
- metadata.gz: 935b6515910e2eaf6871c5cb00920cda705935d06449de61410e941dfdb185c7437a2e7fa388244997dcb338efd0221ad7cf9c9e207d0b2fa4237fd9f63166e0
7
- data.tar.gz: 9d3fe3b1c638b6a72b729464a2dc5178202fe9158f88aa3d5c692498d82eda3e65760141d5233e43e7bfd083ecd68bbaf2881f97db6a828825498e1771b4bdcf
6
+ metadata.gz: aacdce1efe87f6d288f6167e980418def9d1f5c17c51fc255c2bdce025caf3bd80466d946b48972c5f33259a5e6aff3d38f1b529133688b0698e6e6f86b8f21c
7
+ data.tar.gz: db6a64d3fefd229472b6b67c96844328e7e926e9bc145602c8d72b8f40cbf2911bc7092e8401fab30dad6cdc39a09fb7e020ddc279d4c103d3425a58041db422
data/CHANGELOG.md CHANGED
@@ -1,7 +1,11 @@
1
1
  # Karafka Web Changelog
2
2
 
3
3
  ## 1.0.0 (Unreleased)
4
- - [Fix] Add `initialize` to `Status::Context` that defines all instance variables upfront in a consistent order, giving every instance the same Ruby object shape and eliminating the `:performance` shape-variation warning.
4
+ - [Fix] Fix two precision bugs in `Aggregators::State`/`Aggregators::Metrics` process eviction and utilization, both caught by a Copilot PR review and confirmed on the merged pipeline refactor. `evict_expired_processes` computed the ttl window via integer division (`config.ttl / 1_000`), truncating any non-multiple-of-1000 millisecond ttl and evicting processes up to ~999ms earlier than configured; it now uses float division. `RefreshCurrentStats#call` computed average utilization via `utilization / (stats[:processes] + 0.0001)`, an epsilon guard against division by zero that also systematically underestimated utilization for any nonzero process count; it now divides exactly and returns `0.0` only when there are zero active processes.
5
+ - [Fix] Fix the real cause of the intermittent, seemingly-unrelated CI-only Pro Explorer flakes finally surfaced by the `assert_ok` diagnostic below: not a Kafka broker/timing race, but Ruby's object-shape warning (a controller class crossing 8 distinct instance-variable shapes) being turned into a hard failure by the test suite's `Warning.process` hook. Controllers, like the Roda app classes already exempted, legitimately accumulate many shapes because they conditionally set a handful of instance variables depending on the specific request branch taken (e.g. Explorer's `#show` only sets `@safe_key`/`@safe_headers`/`@safe_payload` when the message isn't a compacted/system entry). Which controller happens to cross the threshold depends on minitest's random run order, which is why it surfaced as an unrelated-looking flake instead of a stable, reproducible failure. Widened the existing `Ui::App` shape-variation exception to cover controller classes too.
6
+ - [Enhancement] Make `assert_ok` surface the actual captured exception (class, message, backtrace) on a 500, not just the generic static error page body. Subscribes to the same `error.occurred` monitor event the production error handler already dispatches web UI errors through, capturing the last one per test. This has been the main blocker in diagnosing rare CI-only flakes in the Pro Explorer controller specs, where a failure only ever showed the generic HTML error page with no indication of what actually broke.
7
+ - [Enhancement] Remove the OSS "support Karafka Pro" banner that was rendered on every Web UI page for non-Pro users. It's no longer needed at this stage since users are already aware of the Pro offering.
8
+ - [Enhancement] Migrate the Web UI topic declarations to Karafka's new standalone `Karafka::App.declaratives.draw` API (Karafka `2.6.0.beta1`). The Web UI topics are declared as `active false` (Web UI manages their creation and runtime replication factor itself), replacing the deprecated routing-based `config(active: false)` bridge that was previously called on each routing topic.
5
9
  - [Enhancement] Add `Warning.process` block to the test helper to turn Ruby warnings originating from the project code into test failures.
6
10
  - [Enhancement] Enable all opt-in Ruby warning categories in the test helper via `Warning.categories` (available since Ruby 3.4), so any new categories added in future Ruby versions are automatically enabled without code changes.
7
11
  - [Enhancement] Replace sequential per-partition `query_watermark_offsets` consumer calls in `Counters#estimate_errors_count` with a single targeted `topic_info` metadata call followed by a batch `read_watermark_offsets` admin call. This eliminates the consumer connection overhead and reduces Kafka roundtrips from up to N+1 sequential calls to 3 regardless of partition count.
@@ -11,6 +15,16 @@
11
15
  - [Enhancement] Replace token-based CSRF protection (`route_csrf` plugin) with header-based protection using `Sec-Fetch-Site` header (`sec_fetch_site_csrf` plugin). This eliminates the need for CSRF tokens by leveraging browser-enforced headers that cannot be forged from cross-origin requests. Modern browsers automatically include this header, providing simpler and more robust CSRF protection.
12
16
  - [Enhancement] Include a short spec file hash in generated test topic names for traceability. Topic names now follow the `it-{hash}-{uuid}` format, making it easy to identify which test file created a given topic in Kafka logs.
13
17
  - [Change] Require Roda `>= 3.100` (previously `~> 3.69`).
18
+ - [Fix] Harden the `wait_for_offset_visible` test helper (used after a transactional produce) to also exercise the Web UI's own message-read path, not just the admin watermark offset. The admin watermark advancing only proves the broker appended the control record; the Web UI reads with a much shorter `fetch.wait.max.ms` than the admin client and could still intermittently raise or return stale results on that exact offset (e.g. the flaky Pro Explorer `system entry` spec), even after the watermark-only wait introduced previously. The helper now also polls the same `Karafka::Web::Ui::Lib::Admin.read_topic` call the Web UI performs and requires it to complete without error before returning.
19
+ - [Fix] Fix two more flaky Pro Explorer `#recent` specs (`when getting recent for the whole topic` / `when recent is on the first partition` and `when recent is on another partition`). Both produced a message to one partition, then a fixed `sleep(0.1)` before producing the message that should be "most recent" to another partition and immediately requesting the endpoint, racing broker propagation under CI load the same way the already-fixed single-partition `#recent` spec did. Replaced the fixed sleep with a `wait_for_message` poll on the second produce's own offset, matching the existing pattern used by the sibling spec right below it.
20
+ - [Fix] Stop a long, unbreakable page title (e.g. a long topic name on the Pro Explorer topic page) and the breadcrumbs bar above it from overflowing the page. A grid/flex item's default `min-width: auto` let the title and breadcrumbs blow out past the viewport instead of shrinking, which pushed layout wide enough to force an unexpected page scrollbar. The title wrapper and `breadcrumbs-wrapper` now set `min-width: 0`, the title text wraps via `overflow-wrap: anywhere`, and the breadcrumbs list now wraps onto multiple lines instead of relying on an easy-to-miss horizontal scroll.
21
+ - [Fix] Stop long, unbreakable flash messages (e.g. a long dotted/underscored topic name in a "successfully created" notice) from overflowing their alert box. DaisyUI's `.alert` grid track sized the message column to its content's intrinsic width, so long single-token strings pushed past the box edge instead of wrapping. The message `span` now sets `overflow-wrap: anywhere` and `min-width: 0` so it wraps within the alert instead.
22
+ - [Fix] Stop long, dotted/underscored Pro Explorer, DLQ, and Topics topic-tile names from overflowing or overlapping their tile. `topic-tile-text` now sets `overflow-wrap: anywhere` so unbreakable names wrap inside the tile instead of spilling out, and the topic-tile link in those three views now carries a `title` attribute showing the full topic name on hover.
23
+ - [Fix] Make the `create_topic` test helper wait until a freshly created topic's partitions are actually readable (expected partition count visible and watermark offsets queryable), not just until the topic name appears in cluster metadata. This removes a flaky failure in multi-partition specs (e.g. the topics distribution controller) that intermittently 404'd because watermark offsets were read before the partition leaders had propagated.
24
+ - [Fix] Stop the array paginator from offering a "Next" link to an empty page when the last page is exactly full. `Paginators::Arrays` decided "is there a next page?" from whether the current page was full, so any list whose total size was an exact multiple of `per_page` (25/50/75/...) surfaced a Next link leading to an empty page. It now reports the last page based on whether a further slice actually exists.
25
+ - [Fix] Compute the dashboard average batch size with float division so it is no longer floored. `Metrics::Aggregated` divided the per-window message delta by the batch delta using integer division, so e.g. 1000 messages over 47 batches charted as `21` instead of `21.28`, systematically under-reporting the average. It now uses float division rounded to 2 decimals.
26
+ - [Fix] Include jobs in the `waiting` state when aggregating the dashboard "Pending" counter. `State#refresh_current_stats` now resets and sums `stats[:waiting]` from incoming consumer reports (previously it was never aggregated and stayed `0`), so `Counters#pending` (`enqueued + waiting`) no longer undercounts jobs sitting in advanced/recurring/scheduled-message schedulers. `:waiting` is now also validated by the `AggregatedStats` contract.
27
+ - [Fix] Add `initialize` to `Status::Context` that defines all instance variables upfront in a consistent order, giving every instance the same Ruby object shape and eliminating the `:performance` shape-variation warning.
14
28
  - [Fix] Accept (and ignore) a block in `Karafka::Web::Producer#__getobj__` to silence Ruby 3.4's `strict_unused_block` warning emitted via `SimpleDelegator#method_missing` on every delegated producer call.
15
29
  - [Fix] Remove `cgi` as no longer needed.
16
30
  - [Fix] Exclude `test/` directory from gem releases to reduce package size.
@@ -18,6 +32,18 @@
18
32
  - [Fix] Fix alerts formatting for the distribution view.
19
33
  - [Fix] Fix 500 error in the Pro Explorer when a message payload parses as valid JSON but contains strings with invalid UTF-8 byte sequences. `JSON.pretty_generate` would raise `JSON::GeneratorError` outside of any error boundary and propagate as an unhandled 500. The pretty-print step is now wrapped in a dedicated `@safe_pretty_payload` SafeRunner; on failure the raw bytes are displayed alongside a deserialization warning.
20
34
  - [Fix] Fix 500 error in the Pro Explorer message JSON export when a payload deserializes correctly but cannot be serialized back to JSON (for example when it contains strings with invalid UTF-8 byte sequences). The export endpoint now responds with 404 in such cases and the export action button is no longer rendered for such messages.
35
+ - [Fix] Normalize a batch of styling inconsistencies found while auditing #906: a `data-table-wraper` typo left the Cluster replication table unstyled, `Cluster::_config` rendered raw `true`/`false` instead of badges (unlike the identical `Topics::Configs` table), a Recurring Tasks "Trigger" button's disabled state was computed but never applied to its class, several views carried dead pre-Tailwind Bootstrap classes (`col-sm-*`, `col-lg-*`, `row`, `container-wrapper`) with no effect, one Topics Configs action cell was missing the `options` column class, a handful of breadcrumb/title labels had grammar or casing inconsistencies ("Cluster informations", "Consumers Groups Health", "Dead Letter Queue topics"), the OSS Routing topic list hand-rolled a `badge-warning` for inactive topics instead of the `badge_secondary` used by the identical Pro table, the filtered-payload notice used unstyled Bootstrap-era markup instead of the shared `alert_box_warning` primitive, `status-row-stopping` was colored red (`border-l-error`) while `status_badge` treats "stopping" as the same warning tier as "quiet"/"quieting", three Pro Topics checklist notices (before deleting a topic, increasing partitions, or editing a config value) hand-rolled a bare `alert` div with no severity color or icon instead of the shared `alert_box_warning` primitive used by their sibling warning boxes on the same pages, `alert_box_primary`/`alert_box_secondary` displayed the success checkmark icon (copy-pasted from `alert_box_success`) instead of matching their non-box `info_circle`/`pause_circle` siblings, the internal style-guide page demoed the wrong pencil icon for edit actions, and a scheduled message's "Cancel dispatch" button used a passive error-status icon instead of the `trash` icon already used for every other removal action.
36
+ - [Fix] Continue normalizing styling inconsistencies from the #906 audit: Health and Recurring Tasks tab bars hand-rolled `col-span-12 mb-9` instead of the shared `tab-container-wrapper` class, and the Scheduled Messages per-partition schedule heading used `h3`/`.h3` where the equivalent per-group heading on Health pages uses `h2`/`.h2`.
37
+ - [Fix] Retire the `.row-table`/`.row-table-wrapper` table primitive, which had drifted to a single real caller (the Pro per-topic Errors table) against 45+ real uses of `.data-table`, and additionally used a different button-alignment convention (`text-center` vs. `.data-table`'s `text-right`) than every other action column in the app. Switched that one table to `.data-table`, removed the now fully unused CSS utilities and their style-guide demo, and fixed a stale ".row-table" label left over in an unrelated `.data-table` demo section.
38
+ - [Enhancement] Add a standardized `empty_state` helper/component (icon, message, optional description, and optional call-to-action) and replace the ad hoc `alert_info`/`alert_box_info` "There are no X" messages across every empty-list view (Jobs, DLQ, Explorer, Health, Errors, Consumers, Recurring Tasks, Scheduled Messages, dashboard, and paginated tables) with it, for a consistent look across the Web UI. Demoed on the internal style-guide `/ux` page.
39
+ - [Fix] Fix unreadable `.btn-outline.btn-active` buttons (e.g. the dashboard time-range selector) in both the light and dark themes. The daisyUI 5.6 upgrade left the active state's background color computed from the same `--btn-color` variable as the outline's text color, so the two nearly matched; the button now switches to the color-variant's contrasting foreground color when active, matching its existing `:hover` behavior.
40
+ - [Enhancement] Expand the internal `/ux` style-guide page to cover every UI component actually used across the app, so upgrades (daisyUI, Tailwind, etc.) can be visually spot-checked in one place: plain `.card`/`.card-body`, `.modal`/`dialog`, `.dropdown`, `.tooltip`, the `.btn-ghost`/`.btn-square`/`.btn-action`/`.btn-lockable`/`.confirm-action` button modifiers, the breadcrumbs component, and the `status_badge`/`lag_trend_badge`/`kafka_state_badge`/`lso_risk_state_badge`/`truncate`/`lag_with_label`/`offset_with_label` helper methods (previously only their raw CSS classes were demoed). Adds a small reusable `ModalOpener` JS component (`[data-modal-open]`) since the CSP disallows the inline `onclick` handler style used by the existing search modal trigger.
41
+ - [Fix] Fix a flaky Pro Explorer spec (`when requested message exists but is a system entry`) caused by the `produce` test helper's transactional flow: it only waited a fixed `sleep(0.1)` for a transactional produce's commit control record to become visible before the test reads it back, which is too short under CI load and made the spec intermittently 404 or see stale content. Replaced the fixed sleep with a `wait_for_offset_visible` poll that waits until the control record's offset is actually part of the readable watermark range, mirroring the existing `wait_for_message`/`create_topic` readiness-polling pattern instead of a fixed delay.
42
+ - [Fix] Stop a misclick on a Pro-gated OSS element from fully navigating away to the standalone "Pro Feature" upsell page. This affected the sidebar (Health, Explorer, Cron, Schedules, Dead, Topics), the Consumers tabs (Performance, Controls, Commands), the dashboard's "Data transfers" chart tab, and several unguarded links with no visual gating indicator at all: the dashboard's "Total lag"/"Dead" counters, Cluster topic/partition names, per-message Explorer offset links on the Errors detail page, and consumer process IDs on the Consumers and Jobs list pages. Gated sidebar/tab items are now truly inert `disabled` buttons with an "Available in Karafka Pro" hover tooltip instead of `<a href>` links (or, for the dashboard chart tab, a JS-clickable `<span>`) pointing at the real Pro-only content; the previously-unguarded inline links are now plain text in the OSS templates, with a matching Pro-only view override (`dashboard/_counters`, `cluster/_partition`, `errors/_detail`) restoring the links for Pro users, keeping the OSS templates free of any `Karafka.pro?` branching. Also fixes the sidebar's collapse/expand toggle showing the default arrow cursor instead of a pointer on hover, and hardens `TabsManager` (the chart-tab-switching JS) to no-op instead of throwing when a tab's target content or a previously-active tab is missing/disabled, which had broken tab-switching for the Utilization/RSS/Concurrency charts for anyone who had the now-disabled "Data transfers" tab persisted as their last-active tab. Closes #1106.
43
+ - [Fix] Add `rel="noopener noreferrer"` to every `target="_blank"` link across the Web UI (docs, Slack, GitHub, and "become Pro" links in the support, status, dashboard, and Pro topic-replication warning views). Without it, the opened external page could access `window.opener` and redirect the original Web UI tab to an arbitrary page (reverse tabnabbing).
44
+ - [Fix] Fix a flaky Pro Explorer spec (`ExplorerController#recent::when getting recent for the partition`) that produced a message and immediately requested the "recent" endpoint with no readiness wait, occasionally racing the broker's propagation of the just-produced message under CI load. Added a `wait_for_message` poll before the request, matching the existing readiness-polling pattern used elsewhere in the suite.
45
+ - [Enhancement] Replace the bare `assert(response.ok?)` pattern with a new `assert_ok` test helper across the whole controller test suite (381 call sites). On failure it now prints the actual response status and a body excerpt instead of a generic "Expected false to be truthy", making intermittent CI-only non-200 failures actually diagnosable.
46
+ - [Change] Switch to Karafka 2.6's new, group-type-agnostic `#group`/`group_id` accessors instead of `#consumer_group`/`consumer_group_id` when reading from Karafka's own routing and instrumentation APIs (`topic.group`, `subscription_group.group`, `event[:group_id]`), preparing for upcoming Kafka share group support (KIP-932). `consumer_group`/`consumer_group_id` remain as karafka-web's own internal naming (tracking payloads, commanding schema, UI labels) — only the calls into Karafka's own API surface changed. Closes #1022.
21
47
 
22
48
  ## 0.11.6 (2026-02-01)
23
49
  - **[Feature]** Provide ability to pause/resume all partitions of a topic at once across all consumer processes via the Health Overview page (Pro). Topic-level commands are broadcast to all processes, and each process applies the command to partitions it owns within the specified consumer group. This simplifies bulk operations compared to pausing/resuming individual partitions one by one.
data/Gemfile.lint.lock CHANGED
@@ -58,11 +58,11 @@ GEM
58
58
  unicode-display_width (3.2.0)
59
59
  unicode-emoji (~> 4.1)
60
60
  unicode-emoji (4.2.0)
61
- yard (0.9.38)
62
- yard-lint (1.4.0)
61
+ yard (0.9.45)
62
+ yard-lint (1.10.1)
63
63
  yard (~> 0.9)
64
64
  zeitwerk (~> 2.6)
65
- zeitwerk (2.7.4)
65
+ zeitwerk (2.8.2)
66
66
 
67
67
  PLATFORMS
68
68
  ruby
@@ -79,6 +79,7 @@ DEPENDENCIES
79
79
 
80
80
  CHECKSUMS
81
81
  ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
82
+ bundler (4.0.17) sha256=214e21431b5665dd2f99df8a5511c6b151d7a72e8015c8b38f8b775b61cbb6c1
82
83
  json (2.18.0) sha256=b10506aee4183f5cf49e0efc48073d7b75843ce3782c68dbeb763351c08fd505
83
84
  language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc
84
85
  lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
@@ -100,9 +101,9 @@ CHECKSUMS
100
101
  standard-performance (1.9.0) sha256=49483d31be448292951d80e5e67cdcb576c2502103c7b40aec6f1b6e9c88e3f2
101
102
  unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
102
103
  unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f
103
- yard (0.9.38) sha256=721fb82afb10532aa49860655f6cc2eaa7130889df291b052e1e6b268283010f
104
- yard-lint (1.4.0) sha256=7dd88fbb08fd77cb840bea899d58812817b36d92291b5693dd0eeb3af9f91f0f
105
- zeitwerk (2.7.4) sha256=2bef90f356bdafe9a6c2bd32bcd804f83a4f9b8bc27f3600fff051eb3edcec8b
104
+ yard (0.9.45) sha256=52e211493f7cb8a3ebf7e104a25a1e73937a3103092545d34cb88fafebb3dc51
105
+ yard-lint (1.10.1) sha256=172ea1905304580bd515c093d82831ec4889e725100c49d5bf77e62101f49129
106
+ zeitwerk (2.8.2) sha256=7212a61311083c604184b1ea2574b9aa05cd14f855a0841c06985cabe9181d12
106
107
 
107
108
  BUNDLED WITH
108
- 4.0.3
109
+ 4.0.17
data/Gemfile.lock CHANGED
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- karafka-web (1.0.0.beta1)
4
+ karafka-web (1.0.0.rc1)
5
5
  erubi (~> 1.4)
6
- karafka (>= 2.5.10.rc1, < 2.7.0)
7
- karafka-core (>= 2.5.0, < 2.7.0)
6
+ karafka (>= 2.6.0.beta1, < 2.7.0)
7
+ karafka-core (>= 2.6.0, < 2.7.0)
8
8
  roda (>= 3.100, < 4.0)
9
9
  tilt (~> 2.0)
10
10
 
@@ -13,8 +13,7 @@ GEM
13
13
  specs:
14
14
  byebug (13.0.0)
15
15
  reline (>= 0.6.0)
16
- concurrent-ruby (1.3.6)
17
- docile (1.4.1)
16
+ concurrent-ruby (1.3.7)
18
17
  drb (2.2.3)
19
18
  erubi (1.13.1)
20
19
  et-orbi (1.4.0)
@@ -30,17 +29,17 @@ GEM
30
29
  ffi (1.17.4-x86_64-darwin)
31
30
  ffi (1.17.4-x86_64-linux-gnu)
32
31
  ffi (1.17.4-x86_64-linux-musl)
33
- fugit (1.12.2)
32
+ fugit (1.13.0)
34
33
  et-orbi (~> 1.4)
35
34
  raabro (~> 1.4)
36
35
  io-console (0.8.2)
37
- json (2.19.7)
38
- karafka (2.5.10.rc1)
39
- karafka-core (>= 2.5.13, < 2.6.0)
40
- karafka-rdkafka (>= 0.26.1)
41
- waterdrop (>= 2.8.14, < 3.0.0)
36
+ json (2.20.0)
37
+ karafka (2.6.0.beta1)
38
+ karafka-core (>= 2.6.0, < 2.7.0)
39
+ karafka-rdkafka (>= 0.27.2)
40
+ waterdrop (>= 2.10.1, < 3.0.0)
42
41
  zeitwerk (~> 2.3)
43
- karafka-core (2.5.13)
42
+ karafka-core (2.6.2)
44
43
  karafka-rdkafka (>= 0.20.0)
45
44
  logger (>= 1.6.0)
46
45
  karafka-rdkafka (0.27.2)
@@ -86,24 +85,24 @@ GEM
86
85
  prism (~> 1.5)
87
86
  mocha (3.1.0)
88
87
  ruby2_keywords (>= 0.0.5)
89
- nokogiri (1.19.3)
88
+ nokogiri (1.19.4)
90
89
  mini_portile2 (~> 2.8.2)
91
90
  racc (~> 1.4)
92
- nokogiri (1.19.3-aarch64-linux-gnu)
91
+ nokogiri (1.19.4-aarch64-linux-gnu)
93
92
  racc (~> 1.4)
94
- nokogiri (1.19.3-aarch64-linux-musl)
93
+ nokogiri (1.19.4-aarch64-linux-musl)
95
94
  racc (~> 1.4)
96
- nokogiri (1.19.3-arm-linux-gnu)
95
+ nokogiri (1.19.4-arm-linux-gnu)
97
96
  racc (~> 1.4)
98
- nokogiri (1.19.3-arm-linux-musl)
97
+ nokogiri (1.19.4-arm-linux-musl)
99
98
  racc (~> 1.4)
100
- nokogiri (1.19.3-arm64-darwin)
99
+ nokogiri (1.19.4-arm64-darwin)
101
100
  racc (~> 1.4)
102
- nokogiri (1.19.3-x86_64-darwin)
101
+ nokogiri (1.19.4-x86_64-darwin)
103
102
  racc (~> 1.4)
104
- nokogiri (1.19.3-x86_64-linux-gnu)
103
+ nokogiri (1.19.4-x86_64-linux-gnu)
105
104
  racc (~> 1.4)
106
- nokogiri (1.19.3-x86_64-linux-musl)
105
+ nokogiri (1.19.4-x86_64-linux-musl)
107
106
  racc (~> 1.4)
108
107
  ostruct (0.6.3)
109
108
  prism (1.9.0)
@@ -118,20 +117,15 @@ GEM
118
117
  rake (13.4.2)
119
118
  reline (0.6.3)
120
119
  io-console (~> 0.5)
121
- roda (3.104.0)
120
+ roda (3.105.0)
122
121
  rack
123
122
  ruby2_keywords (0.0.5)
124
- simplecov (0.22.0)
125
- docile (~> 1.1)
126
- simplecov-html (~> 0.11)
127
- simplecov_json_formatter (~> 0.1)
128
- simplecov-html (0.13.2)
129
- simplecov_json_formatter (0.1.4)
123
+ simplecov (1.0.2)
130
124
  tilt (2.7.0)
131
125
  tzinfo (2.0.6)
132
126
  concurrent-ruby (~> 1.0)
133
127
  warning (1.6.0)
134
- waterdrop (2.10.1)
128
+ waterdrop (2.10.2)
135
129
  karafka-core (>= 2.5.12, < 3.0.0)
136
130
  karafka-rdkafka (>= 0.24.0)
137
131
  zeitwerk (~> 2.3)
data/docker-compose.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  services:
2
2
  kafka:
3
3
  container_name: kafka
4
- image: confluentinc/cp-kafka:8.2.1
4
+ image: confluentinc/cp-kafka:8.3.0
5
5
 
6
6
  ports:
7
7
  - 9092:9092
data/karafka-web.gemspec CHANGED
@@ -17,8 +17,8 @@ Gem::Specification.new do |spec|
17
17
  spec.licenses = %w[LGPL-3.0-only Commercial]
18
18
 
19
19
  spec.add_dependency "erubi", "~> 1.4"
20
- spec.add_dependency "karafka", ">= 2.5.10.rc1", "< 2.7.0"
21
- spec.add_dependency "karafka-core", ">= 2.5.0", "< 2.7.0"
20
+ spec.add_dependency "karafka", ">= 2.6.0.beta1", "< 2.7.0"
21
+ spec.add_dependency "karafka-core", ">= 2.6.0", "< 2.7.0"
22
22
  spec.add_dependency "roda", ">= 3.100", "< 4.0"
23
23
  spec.add_dependency "tilt", "~> 2.0"
24
24
 
@@ -25,7 +25,7 @@ module Karafka
25
25
  # We allow duplicates keys because of a fixed bug that was causing duplicated process
26
26
  # ids to leak into the consumers states data. Once a proper migration is written, this
27
27
  # can be retired
28
- # @see https://github.com/karafka/karafka-web/issues/741
28
+ # See https://github.com/karafka/karafka-web/issues/741
29
29
  allow_duplicate_key: true
30
30
  )
31
31
  end
@@ -7,8 +7,7 @@ module Karafka
7
7
  # Creates the records needed for the Web-UI to operate.
8
8
  # It creates "almost" empty states because the rest is handled via migrations
9
9
  class CreateInitialStates < Base
10
- # Whole default empty state
11
- # This will be further migrated by the migrator
10
+ # Whole default empty state. This will be further migrated by the migrator
12
11
  DEFAULT_STATE = {
13
12
  schema_version: "0.0.0"
14
13
  }.freeze
@@ -18,6 +18,7 @@ module Karafka
18
18
  ::Karafka::Web.config.enabled = true
19
19
 
20
20
  extend_routing
21
+ extend_declaratives
21
22
  setup_tracking_activity
22
23
 
23
24
  # Do not subscribe monitors or do anything else if tracking is disabled
@@ -56,7 +57,6 @@ module Karafka
56
57
  consumer_group ::Karafka::Web.config.group_id do
57
58
  # Topic we listen on to materialize the states
58
59
  topic ::Karafka::Web.config.topics.consumers.reports.name do
59
- config(active: false)
60
60
  active ::Karafka::Web.config.processing.active
61
61
  # Since we materialize state in intervals, we can poll for half of this time
62
62
  # without impacting the reporting responsiveness
@@ -87,25 +87,21 @@ module Karafka
87
87
  # We define those three here without consumption, so Web understands how to
88
88
  # deserialize them when used / viewed
89
89
  topic ::Karafka::Web.config.topics.consumers.states.name do
90
- config(active: false)
91
90
  active false
92
91
  deserializers(payload: payload_deserializer)
93
92
  end
94
93
 
95
94
  topic ::Karafka::Web.config.topics.consumers.metrics.name do
96
- config(active: false)
97
95
  active false
98
96
  deserializers(payload: payload_deserializer)
99
97
  end
100
98
 
101
99
  topic ::Karafka::Web.config.topics.consumers.commands.name do
102
- config(active: false)
103
100
  active false
104
101
  deserializers(payload: payload_deserializer)
105
102
  end
106
103
 
107
104
  topic ::Karafka::Web.config.topics.errors.name do
108
- config(active: false)
109
105
  active false
110
106
  deserializers(payload: payload_deserializer)
111
107
  end
@@ -113,6 +109,33 @@ module Karafka
113
109
  end
114
110
  end
115
111
 
112
+ # Registers the Web UI topics in the standalone declaratives repository.
113
+ #
114
+ # They are all declared as `active false` on purpose. Web UI manages the creation and
115
+ # configuration of its topics on its own (via `karafka-web install` / `karafka-web
116
+ # migrate`), because it computes the replication factor at runtime based on the cluster
117
+ # size and populates the initial states right after the topics are created. Declaring
118
+ # them here (rather than relying on the legacy routing `config(...)` bridge) makes their
119
+ # existence explicit in the new declaratives subsystem while keeping them out of the
120
+ # generic `karafka declaratives` CLI management.
121
+ def extend_declaratives
122
+ topics = [
123
+ ::Karafka::Web.config.topics.errors,
124
+ ::Karafka::Web.config.topics.consumers.reports,
125
+ ::Karafka::Web.config.topics.consumers.states,
126
+ ::Karafka::Web.config.topics.consumers.metrics,
127
+ ::Karafka::Web.config.topics.consumers.commands
128
+ ]
129
+
130
+ ::Karafka::App.declaratives.draw do
131
+ topics.each do |web_topic|
132
+ topic web_topic.name do
133
+ active false
134
+ end
135
+ end
136
+ end
137
+ end
138
+
116
139
  # Subscribes with all needed listeners
117
140
  def subscribe_to_monitor
118
141
  # Installs all the consumer related listeners
@@ -4,8 +4,7 @@ module Karafka
4
4
  module Web
5
5
  module Management
6
6
  module Actions
7
- # Command to migrate states data
8
- # Useful when we have older schema and need to move forward
7
+ # Command to migrate states data. Useful when we have older schema and need to move forward
9
8
  class MigrateStatesData < Base
10
9
  # Runs needed migrations (if any) on the states topics
11
10
  def call
@@ -15,8 +15,7 @@ module Karafka
15
15
  class << self
16
16
  # First version that should **NOT** be affected by this migration
17
17
  attr_accessor :versions_until
18
- # What resource does it relate it
19
- # One migration should modify only one resource type
18
+ # What resource does it relate it. One migration should modify only one resource type
20
19
  attr_accessor :type
21
20
 
22
21
  # @param version [String] sem-ver version
@@ -27,6 +27,7 @@
27
27
  #
28
28
  # License: https://karafka.io/docs/Pro-License-Comm/
29
29
  # Contact: contact@karafka.io
30
+
30
31
  module Karafka
31
32
  module Web
32
33
  module Pro
@@ -32,7 +32,6 @@ module Karafka
32
32
  module Web
33
33
  module Pro
34
34
  module Commanding
35
- # Namespace for commands the process can react to
36
35
  module Commands
37
36
  # Namespace for commands related to consumers themselves
38
37
  module Consumers
@@ -32,7 +32,6 @@ module Karafka
32
32
  module Web
33
33
  module Pro
34
34
  module Commanding
35
- # Namespace for commands the process can react to
36
35
  module Commands
37
36
  module Consumers
38
37
  # Sends a signal to stop the process
@@ -32,7 +32,6 @@ module Karafka
32
32
  module Web
33
33
  module Pro
34
34
  module Commanding
35
- # Namespace for commands the process can react to
36
35
  module Commands
37
36
  module Consumers
38
37
  # Collects all backtraces from the available Ruby threads and publishes their details
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Karafka Pro - Source Available Commercial Software
4
+ # Copyright (c) 2017-present Maciej Mensfeld. All rights reserved.
5
+ #
6
+ # This software is NOT open source. It is source-available commercial software
7
+ # requiring a paid license for use. It is NOT covered by LGPL.
8
+ #
9
+ # The author retains all right, title, and interest in this software,
10
+ # including all copyrights, patents, and other intellectual property rights.
11
+ # No patent rights are granted under this license.
12
+ #
13
+ # PROHIBITED:
14
+ # - Use without a valid commercial license
15
+ # - Redistribution, modification, or derivative works without authorization
16
+ # - Reverse engineering, decompilation, or disassembly of this software
17
+ # - Use as training data for AI/ML models or inclusion in datasets
18
+ # - Scraping, crawling, or automated collection for any purpose
19
+ #
20
+ # PERMITTED:
21
+ # - Reading, referencing, and linking for personal or commercial use
22
+ # - Runtime retrieval by AI assistants, coding agents, and RAG systems
23
+ # for the purpose of providing contextual help to Karafka users
24
+ #
25
+ # Receipt, viewing, or possession of this software does not convey or
26
+ # imply any license or right beyond those expressly stated above.
27
+ #
28
+ # License: https://karafka.io/docs/Pro-License-Comm/
29
+ # Contact: contact@karafka.io
30
+
31
+ module Karafka
32
+ module Web
33
+ module Pro
34
+ module Commanding
35
+ module Handlers
36
+ # Module containing a helper for extracting the consumer group id out of a
37
+ # subscription group, shared by the commanding fetch-loop listeners
38
+ module GroupIdExtractor
39
+ # @param subscription_group [Karafka::Routing::SubscriptionGroup]
40
+ # @return [String] id of the consumer group the subscription group belongs to
41
+ def group_id_of(subscription_group)
42
+ subscription_group.group.id
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -33,7 +33,6 @@ module Karafka
33
33
  module Pro
34
34
  module Commanding
35
35
  module Handlers
36
- # Namespace for commands related to specific partitions
37
36
  module Partitions
38
37
  # Namespace for partitions related commands
39
38
  module Commands
@@ -37,6 +37,8 @@ module Karafka
37
37
  # Listener that hooks to the connection listener fetch loop flow to adjust it prior
38
38
  # to the next polling or on rebalances to execute the partition specific commands.
39
39
  class Listener
40
+ include Handlers::GroupIdExtractor
41
+
40
42
  def initialize
41
43
  @tracker = Tracker.instance
42
44
  @executor = Executor.new
@@ -50,7 +52,7 @@ module Karafka
50
52
  listener = event[:caller]
51
53
  client = event[:client]
52
54
  subscription_group = listener.subscription_group
53
- consumer_group_id = subscription_group.consumer_group.id
55
+ consumer_group_id = group_id_of(subscription_group)
54
56
 
55
57
  # Get current partition assignments from the client
56
58
  assignments = client.assignment.to_h
@@ -74,7 +76,7 @@ module Karafka
74
76
  # @param event [Karafka::Core::Monitoring::Event]
75
77
  def on_rebalance_partitions_assigned(event)
76
78
  subscription_group = event[:subscription_group]
77
- consumer_group_id = subscription_group.consumer_group.id
79
+ consumer_group_id = group_id_of(subscription_group)
78
80
 
79
81
  # On rebalance, reject any pending commands for all topics and partitions
80
82
  # that were assigned to this subscription group
@@ -37,6 +37,8 @@ module Karafka
37
37
  # Listener that hooks to the connection listener fetch loop flow to adjust it prior
38
38
  # to the next polling or on rebalances to execute the topic specific commands.
39
39
  class Listener
40
+ include Handlers::GroupIdExtractor
41
+
40
42
  def initialize
41
43
  @tracker = Tracker.instance
42
44
  @executor = Executor.new
@@ -50,7 +52,7 @@ module Karafka
50
52
  listener = event[:caller]
51
53
  client = event[:client]
52
54
  subscription_group = listener.subscription_group
53
- consumer_group_id = subscription_group.consumer_group.id
55
+ consumer_group_id = group_id_of(subscription_group)
54
56
 
55
57
  # Iterate over all topics in this subscription group and check for commands
56
58
  subscription_group.topics.each do |topic|
@@ -67,7 +69,7 @@ module Karafka
67
69
  # @param event [Karafka::Core::Monitoring::Event]
68
70
  def on_rebalance_partitions_assigned(event)
69
71
  subscription_group = event[:subscription_group]
70
- consumer_group_id = subscription_group.consumer_group.id
72
+ consumer_group_id = group_id_of(subscription_group)
71
73
 
72
74
  subscription_group.topics.each do |topic|
73
75
  @tracker.each_for(consumer_group_id, topic.name) do |command|
@@ -31,10 +31,6 @@
31
31
  module Karafka
32
32
  module Web
33
33
  module Pro
34
- # Namespace for things related to consumers commanding (management)
35
- #
36
- # This feature allows for basic of consumers. They can be stopped, moved to quiet or traced
37
- # via the Web UI
38
34
  module Commanding
39
35
  # Wrapper around the Pro Iterator that yields messages with commands when needed for
40
36
  # further processing.
@@ -48,7 +48,7 @@ module Karafka
48
48
  # @return [Boolean] true if this process has partitions assigned for the consumer group
49
49
  def matches?
50
50
  ::Karafka::App.assignments.any? do |topic, _partitions|
51
- topic.consumer_group.id == consumer_group_id
51
+ topic.group.id == consumer_group_id
52
52
  end
53
53
  end
54
54
 
@@ -32,7 +32,6 @@ module Karafka
32
32
  module Web
33
33
  module Pro
34
34
  module Ui
35
- # Namespace for Pro controllers
36
35
  module Controllers
37
36
  # Cluster details controller
38
37
  class ClusterController < Web::Ui::Controllers::ClusterController
@@ -37,6 +37,21 @@ module Karafka
37
37
  module Consumers
38
38
  # Base controller for all consumer related controllers
39
39
  class BaseController < Controllers::BaseController
40
+ private
41
+
42
+ # Finds the routing topic instance matching a given consumer group and topic name
43
+ #
44
+ # @param consumer_group_id [String] consumer group id to match
45
+ # @param topic_name [String] topic name to match
46
+ # @return [Karafka::Routing::Topic, nil] matching routing topic or nil if not
47
+ # found (may happen when not all routing is available)
48
+ def find_routing_topic(consumer_group_id, topic_name)
49
+ Karafka::App
50
+ .routes
51
+ .flat_map(&:topics)
52
+ .flat_map(&:to_a)
53
+ .find { |r_topic| r_topic.group.id == consumer_group_id && r_topic.name == topic_name }
54
+ end
40
55
  end
41
56
  end
42
57
  end
@@ -69,12 +69,7 @@ module Karafka
69
69
  @partition_stats || raise(Karafka::Web::Errors::Ui::NotFoundError)
70
70
 
71
71
  # Check if topic is LRJ from routing
72
- routing_topics = Karafka::App.routes.flat_map(&:topics).flat_map(&:to_a)
73
-
74
- @routing_topic = routing_topics.find do |r_topic|
75
- r_topic.consumer_group.id == @consumer_group_id &&
76
- r_topic.name == @topic
77
- end
72
+ @routing_topic = find_routing_topic(@consumer_group_id, @topic)
78
73
 
79
74
  # May not be found when not all routing is available. In such cases we assume
80
75
  # that topic is not LRJ and it's up to the end user to handle this correctly.
@@ -146,12 +146,7 @@ module Karafka
146
146
  @topic_stats || raise(Karafka::Web::Errors::Ui::NotFoundError)
147
147
 
148
148
  # Check if topic is LRJ from routing
149
- routing_topics = Karafka::App.routes.flat_map(&:topics).flat_map(&:to_a)
150
-
151
- @routing_topic = routing_topics.find do |r_topic|
152
- r_topic.consumer_group.id == @consumer_group_id &&
153
- r_topic.name == @topic
154
- end
149
+ @routing_topic = find_routing_topic(@consumer_group_id, @topic)
155
150
 
156
151
  # May not be found when not all routing is available. In such cases we assume
157
152
  # that topic is not LRJ and it's up to the end user to handle this correctly.
@@ -33,7 +33,6 @@ module Karafka
33
33
  module Pro
34
34
  module Ui
35
35
  module Controllers
36
- # Namespace for all controllers related to scheduled messages
37
36
  module ScheduledMessages
38
37
  # Controller to display list of schedules (groups) and details about each
39
38
  class SchedulesController < BaseController
@@ -43,7 +43,7 @@ module Karafka
43
43
  class PatternsDetector
44
44
  # Run the detection
45
45
  def call
46
- detector = ::Karafka::Pro::Routing::Features::Patterns::Detector.new
46
+ detector = ::Karafka::Pro::Routing::Features::ConsumerGroups::Patterns::Detector.new
47
47
  topics_names = Web::Ui::Models::ClusterInfo.topics.map(&:topic_name)
48
48
 
49
49
  Karafka::App
@@ -33,7 +33,6 @@ module Karafka
33
33
  module Pro
34
34
  module Ui
35
35
  module Lib
36
- # Policies related contracts
37
36
  module Policies
38
37
  # Namespace with policies related contracts
39
38
  module Contracts