Module: Karafka::Web

Defined in:
lib/karafka/web.rb,
lib/karafka/web/app.rb,
lib/karafka/web/cli.rb,
lib/karafka/web/config.rb,
lib/karafka/web/errors.rb,
lib/karafka/web/ui/app.rb,
lib/karafka/web/ui/base.rb,
lib/karafka/web/version.rb,
lib/karafka/web/cli/base.rb,
lib/karafka/web/cli/help.rb,
lib/karafka/web/cli/reset.rb,
lib/karafka/web/inflector.rb,
lib/karafka/web/installer.rb,
lib/karafka/web/pro/loader.rb,
lib/karafka/web/pro/ui/app.rb,
lib/karafka/web/cli/install.rb,
lib/karafka/web/cli/migrate.rb,
lib/karafka/web/deserializer.rb,
lib/karafka/web/ui/lib/admin.rb,
lib/karafka/web/cli/uninstall.rb,
lib/karafka/web/ui/lib/sorter.rb,
lib/karafka/web/ui/models/job.rb,
lib/karafka/web/contracts/base.rb,
lib/karafka/web/pro/commanding.rb,
lib/karafka/web/ui/models/jobs.rb,
lib/karafka/web/ui/models/topic.rb,
lib/karafka/web/contracts/config.rb,
lib/karafka/web/tracking/sampler.rb,
lib/karafka/web/ui/lib/ttl_cache.rb,
lib/karafka/web/ui/models/broker.rb,
lib/karafka/web/ui/models/health.rb,
lib/karafka/web/ui/models/status.rb,
lib/karafka/web/pro/ui/lib/search.rb,
lib/karafka/web/tracking/reporter.rb,
lib/karafka/web/ui/lib/hash_proxy.rb,
lib/karafka/web/ui/models/message.rb,
lib/karafka/web/ui/models/process.rb,
lib/karafka/web/tracking/scheduler.rb,
lib/karafka/web/ui/models/counters.rb,
lib/karafka/web/management/migrator.rb,
lib/karafka/web/pro/ui/lib/branding.rb,
lib/karafka/web/pro/ui/lib/policies.rb,
lib/karafka/web/processing/consumer.rb,
lib/karafka/web/ui/models/partition.rb,
lib/karafka/web/ui/models/processes.rb,
lib/karafka/web/processing/publisher.rb,
lib/karafka/web/pro/commanding/config.rb,
lib/karafka/web/pro/commanding/manager.rb,
lib/karafka/web/pro/commanding/matcher.rb,
lib/karafka/web/pro/ui/lib/safe_runner.rb,
lib/karafka/web/ui/models/cluster_info.rb,
lib/karafka/web/management/actions/base.rb,
lib/karafka/web/pro/commanding/listener.rb,
lib/karafka/web/tracking/memoized_shell.rb,
lib/karafka/web/ui/helpers/paths_helper.rb,
lib/karafka/web/ui/lib/paginations/base.rb,
lib/karafka/web/pro/ui/lib/search/config.rb,
lib/karafka/web/pro/ui/lib/search/runner.rb,
lib/karafka/web/tracking/contracts/error.rb,
lib/karafka/web/ui/models/consumer_group.rb,
lib/karafka/web/ui/models/metrics/topics.rb,
lib/karafka/web/management/actions/enable.rb,
lib/karafka/web/pro/commanding/dispatcher.rb,
lib/karafka/web/ui/models/consumers_state.rb,
lib/karafka/web/management/migrations/base.rb,
lib/karafka/web/pro/ui/lib/branding/config.rb,
lib/karafka/web/pro/ui/lib/policies/config.rb,
lib/karafka/web/processing/consumers/state.rb,
lib/karafka/web/tracking/consumers/sampler.rb,
lib/karafka/web/tracking/helpers/ttls/hash.rb,
lib/karafka/web/tracking/producers/sampler.rb,
lib/karafka/web/ui/helpers/tailwind_helper.rb,
lib/karafka/web/tracking/consumers/reporter.rb,
lib/karafka/web/tracking/helpers/error_info.rb,
lib/karafka/web/tracking/helpers/ttls/array.rb,
lib/karafka/web/tracking/helpers/ttls/stats.rb,
lib/karafka/web/tracking/producers/reporter.rb,
lib/karafka/web/ui/models/consumers_metrics.rb,
lib/karafka/web/ui/models/watermark_offsets.rb,
lib/karafka/web/pro/commanding/commands/base.rb,
lib/karafka/web/pro/commanding/commands/stop.rb,
lib/karafka/web/pro/ui/lib/patterns_detector.rb,
lib/karafka/web/pro/ui/lib/policies/messages.rb,
lib/karafka/web/pro/ui/lib/policies/requests.rb,
lib/karafka/web/pro/ui/lib/search/normalizer.rb,
lib/karafka/web/processing/consumers/metrics.rb,
lib/karafka/web/ui/controllers/ux_controller.rb,
lib/karafka/web/ui/models/metrics/aggregated.rb,
lib/karafka/web/ui/models/subscription_group.rb,
lib/karafka/web/pro/commanding/commands/quiet.rb,
lib/karafka/web/pro/commanding/commands/trace.rb,
lib/karafka/web/tracking/helpers/ttls/windows.rb,
lib/karafka/web/ui/controllers/responses/file.rb,
lib/karafka/web/ui/helpers/application_helper.rb,
lib/karafka/web/ui/lib/paginations/page_based.rb,
lib/karafka/web/ui/models/recurring_tasks/log.rb,
lib/karafka/web/processing/time_series_tracker.rb,
lib/karafka/web/ui/controllers/base_controller.rb,
lib/karafka/web/ui/controllers/jobs_controller.rb,
lib/karafka/web/ui/controllers/requests/params.rb,
lib/karafka/web/ui/models/recurring_tasks/task.rb,
lib/karafka/web/pro/commanding/contracts/config.rb,
lib/karafka/web/pro/ui/lib/search/matchers/base.rb,
lib/karafka/web/ui/controllers/responses/render.rb,
lib/karafka/web/ui/lib/paginations/offset_based.rb,
lib/karafka/web/ui/models/metrics/charts/topics.rb,
lib/karafka/web/management/actions/create_topics.rb,
lib/karafka/web/management/actions/delete_topics.rb,
lib/karafka/web/pro/ui/controllers/ux_controller.rb,
lib/karafka/web/pro/ui/lib/search/contracts/form.rb,
lib/karafka/web/tracking/consumers/contracts/job.rb,
lib/karafka/web/ui/controllers/errors_controller.rb,
lib/karafka/web/ui/controllers/status_controller.rb,
lib/karafka/web/pro/ui/controllers/dlq_controller.rb,
lib/karafka/web/tracking/consumers/listeners/base.rb,
lib/karafka/web/tracking/consumers/listeners/tags.rb,
lib/karafka/web/tracking/producers/listeners/base.rb,
lib/karafka/web/ui/controllers/cluster_controller.rb,
lib/karafka/web/ui/controllers/responses/redirect.rb,
lib/karafka/web/ui/controllers/routing_controller.rb,
lib/karafka/web/ui/controllers/support_controller.rb,
lib/karafka/web/management/actions/clean_boot_file.rb,
lib/karafka/web/pro/ui/controllers/base_controller.rb,
lib/karafka/web/pro/ui/controllers/jobs_controller.rb,
lib/karafka/web/pro/ui/lib/search/contracts/config.rb,
lib/karafka/web/tracking/consumers/contracts/topic.rb,
lib/karafka/web/ui/lib/paginations/paginators/base.rb,
lib/karafka/web/ui/lib/paginations/paginators/sets.rb,
lib/karafka/web/ui/models/recurring_tasks/schedule.rb,
lib/karafka/web/management/actions/extend_boot_file.rb,
lib/karafka/web/processing/consumers/schema_manager.rb,
lib/karafka/web/tracking/consumers/contracts/report.rb,
lib/karafka/web/tracking/consumers/listeners/errors.rb,
lib/karafka/web/tracking/consumers/listeners/status.rb,
lib/karafka/web/tracking/producers/listeners/errors.rb,
lib/karafka/web/ui/controllers/consumers_controller.rb,
lib/karafka/web/ui/controllers/dashboard_controller.rb,
lib/karafka/web/ui/models/metrics/charts/aggregated.rb,
lib/karafka/web/pro/ui/controllers/errors_controller.rb,
lib/karafka/web/pro/ui/controllers/health_controller.rb,
lib/karafka/web/pro/ui/controllers/search_controller.rb,
lib/karafka/web/pro/ui/controllers/status_controller.rb,
lib/karafka/web/pro/ui/controllers/topics_controller.rb,
lib/karafka/web/pro/ui/lib/branding/contracts/config.rb,
lib/karafka/web/pro/ui/lib/policies/contracts/config.rb,
lib/karafka/web/processing/consumers/contracts/state.rb,
lib/karafka/web/tracking/consumers/listeners/booting.rb,
lib/karafka/web/tracking/consumers/listeners/pausing.rb,
lib/karafka/web/tracking/producers/listeners/booting.rb,
lib/karafka/web/ui/controllers/become_pro_controller.rb,
lib/karafka/web/ui/lib/paginations/paginators/arrays.rb,
lib/karafka/web/pro/ui/controllers/cluster_controller.rb,
lib/karafka/web/pro/ui/controllers/routing_controller.rb,
lib/karafka/web/pro/ui/controllers/support_controller.rb,
lib/karafka/web/processing/consumers/aggregators/base.rb,
lib/karafka/web/management/actions/migrate_states_data.rb,
lib/karafka/web/pro/ui/controllers/commands_controller.rb,
lib/karafka/web/pro/ui/controllers/explorer_controller.rb,
lib/karafka/web/pro/ui/controllers/messages_controller.rb,
lib/karafka/web/processing/consumers/aggregators/state.rb,
lib/karafka/web/processing/consumers/contracts/metrics.rb,
lib/karafka/web/processing/consumers/contracts/process.rb,
lib/karafka/web/tracking/consumers/contracts/partition.rb,
lib/karafka/web/pro/ui/controllers/consumers_controller.rb,
lib/karafka/web/pro/ui/controllers/dashboard_controller.rb,
lib/karafka/web/tracking/consumers/listeners/processing.rb,
lib/karafka/web/tracking/consumers/listeners/statistics.rb,
lib/karafka/web/management/actions/create_initial_states.rb,
lib/karafka/web/pro/ui/controllers/commanding_controller.rb,
lib/karafka/web/processing/consumers/aggregators/metrics.rb,
lib/karafka/web/tracking/consumers/listeners/connections.rb,
lib/karafka/web/ui/lib/paginations/paginators/partitions.rb,
lib/karafka/web/processing/consumers/contracts/topic_stats.rb,
lib/karafka/web/ui/lib/paginations/watermark_offsets_based.rb,
lib/karafka/web/pro/ui/lib/search/matchers/raw_key_includes.rb,
lib/karafka/web/tracking/consumers/contracts/consumer_group.rb,
lib/karafka/web/pro/ui/controllers/recurring_tasks_controller.rb,
lib/karafka/web/pro/ui/lib/search/matchers/raw_header_includes.rb,
lib/karafka/web/pro/ui/lib/search/matchers/raw_payload_includes.rb,
lib/karafka/web/processing/consumers/contracts/aggregated_stats.rb,
lib/karafka/web/tracking/consumers/contracts/subscription_group.rb,
lib/karafka/web/management/migrations/consumers_states/0_set_initial.rb,
lib/karafka/web/management/migrations/consumers_metrics/0_set_initial.rb,
lib/karafka/web/pro/ui/controllers/scheduled_messages/base_controller.rb,
lib/karafka/web/pro/ui/controllers/scheduled_messages/explorer_controller.rb,
lib/karafka/web/pro/ui/controllers/scheduled_messages/messages_controller.rb,
lib/karafka/web/pro/ui/controllers/scheduled_messages/schedules_controller.rb,
lib/karafka/web/management/migrations/consumers_states/1716218393_add_jobs_counter.rb,
lib/karafka/web/management/migrations/consumers_states/1700234522_introduce_waiting.rb,
lib/karafka/web/management/migrations/consumers_states/1700234522_remove_processing.rb,
lib/karafka/web/management/migrations/consumers_metrics/1700234522_introduce_waiting.rb,
lib/karafka/web/management/migrations/consumers_metrics/1700234522_remove_processing.rb,
lib/karafka/web/management/migrations/consumers_states/1706607960_introduce_lag_total.rb,
lib/karafka/web/management/migrations/consumers_metrics/1706607960_introduce_lag_total.rb,
lib/karafka/web/management/migrations/consumers_metrics/1716218393_populate_jobs_metrics.rb,
lib/karafka/web/management/migrations/consumers_states/1706611396_rename_lag_total_to_lag_hybrid.rb,
lib/karafka/web/management/migrations/consumers_metrics/1706611396_rename_lag_total_to_lag_hybrid.rb,
lib/karafka/web/management/migrations/consumers_states/1699543515_fill_missing_received_and_sent_bytes.rb,
lib/karafka/web/management/migrations/consumers_metrics/1699543515_fill_missing_received_and_sent_bytes.rb,
lib/karafka/web/management/migrations/consumers_states/1704722380_split_listeners_into_active_and_paused.rb,
lib/karafka/web/management/migrations/consumers_metrics/1704722380_split_listeners_into_active_and_paused.rb

Overview

Karafka Web UI + Karafka web monitoring

Defined Under Namespace

Modules: Contracts, Errors, Management, Pro, Processing, Tracking, Ui Classes: App, Cli, Config, Deserializer, Inflector, Installer

Constant Summary collapse

VERSION =

Current gem version

'0.10.4'

Class Method Summary collapse

Class Method Details

.configKarafka::Web::Config

Returns config instance.

Returns:



48
49
50
# File 'lib/karafka/web.rb', line 48

def config
  Config.config
end

.enable!Object

Activates all the needed routing and sets up listener, etc This needs to run after the optional configuration of the web component



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/karafka/web.rb', line 54

def enable!
  # Run the setup to initialize components if user did not run it prior himself
  setup unless @configured

  # Make sure config is as expected
  # It should be configured before enabling the Web UI
  Contracts::Config.new.validate!(config.to_h)

  Installer.new.enable!

  # Inject correct settings for the Web-UI sessions plugin based on the user configuration
  # We cannot configure this automatically like other Roda plugins because it requires safe
  # custom values provided by our user
  App.engine.plugin(:sessions, **config.ui.sessions.to_h)
end

.gem_rootString

Returns root path of this gem.

Returns:

  • (String)

    root path of this gem



26
27
28
# File 'lib/karafka/web.rb', line 26

def gem_root
  Pathname.new(File.expand_path('../..', __dir__))
end

.producerWaterDrop::Producer?

Note:

Do NOT memoize producer as it may be updated after forking

Returns waterdrop messages producer or nil if not yet fully initialized. It may not be fully initialized until the configuration is done.

Returns:

  • (WaterDrop::Producer, nil)

    waterdrop messages producer or nil if not yet fully initialized. It may not be fully initialized until the configuration is done



21
22
23
# File 'lib/karafka/web.rb', line 21

def producer
  Web.config.producer
end

.setup(&block) ⇒ Object

Sets up the whole configuration

Parameters:

  • block (Block)

    configuration block



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/karafka/web.rb', line 32

def setup(&block)
  if Karafka.pro?
    require_relative 'web/pro/loader'

    Pro::Loader.load_on_late_setup
    Pro::Loader.pre_setup_all(config)
  end

  Config.configure(&block)

  Pro::Loader.post_setup_all(config) if Karafka.pro?

  @configured = true
end

.slogansArray<String>

Returns Web UI slogans we use to encourage people to support Karafka.

Returns:

  • (Array<String>)

    Web UI slogans we use to encourage people to support Karafka



71
72
73
74
75
# File 'lib/karafka/web.rb', line 71

def slogans
  @slogans ||= YAML.load_file(
    gem_root.join('config', 'locales', 'slogans.yml')
  ).dig('en', 'slogans')
end