Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Stop management application if metrics collection is disabled #691

Merged
merged 1 commit into from
Apr 22, 2019

Conversation

dcorbacho
Copy link
Contributor

Depends on rabbitmq/rabbitmq-management-agent#78

[#164376052]

Types of Changes

  • Bugfix (non-breaking change which fixes issue #NNNN)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (correction or otherwise)
  • Cosmetics (whitespace, appearance)

Checklist

  • I have read the CONTRIBUTING.md document
  • I have signed the CA (see https://cla.pivotal.io/sign/rabbitmq)
  • All tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in related repositories

Further Comments

If this is a relatively large or complex change, kick off the
discussion by explaining why you chose the solution you did and what
alternatives you considered, etc.

@dcorbacho dcorbacho requested a review from gerhard April 10, 2019 19:39
Copy link
Contributor

@gerhard gerhard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the following rabbitmq.conf

management_agent.disable_metrics_collector = true

If rabbitmq_management plugin is enabled before the node is booted, the node will fail to boot with the following error:

BOOT FAILED
===========

Error description:
    init:do_boot/3
    init:start_em/1
    rabbit:start_it/1 line 464
    rabbit:broker_start/1 line 340
    rabbit:start_loaded_apps/2 line 580
    app_utils:manage_applications/6 line 126
    lists:foldl/3 line 1263
    rabbit:'-handle_app_error/1-fun-0-'/3 line 703
throw:{could_not_start,rabbitmq_management,
          {rabbitmq_management,
              {"Metrics collection disabled in management agent",
               {rabbit_mgmt_app,start,[normal,[]]}}}}
Log file(s) (may contain more information):
   /var/folders/d6/dt_lc3pn5qg8wd93w_tgmx7c0000gn/T/rabbitmq-test-instances/rabbit/log/rabbit.log
   /var/folders/d6/dt_lc3pn5qg8wd93w_tgmx7c0000gn/T/rabbitmq-test-instances/rabbit/log/rabbit_upgrade.log

{"init terminating in do_boot",{could_not_start,rabbitmq_management,{rabbitmq_management,{"Metrics collection disabled in management agent",{rabbit_mgmt_app,start,[normal,[]]}}}}}
init terminating in do_boot ({could_not_start,rabbitmq_management,{rabbitmq_management,{Metrics collection disabled in management agent,{rabbit_mgmt_app,start,[_]}}}})
gmake: *** [/Users/gerhard/github.com/rabbitmq/3.8-prometheus/deps/rabbit_common/mk/rabbitmq-run.mk:251: run-broker] Error 1

If enabling rabbitmq_management when this config option is set to true, we get the following expected error:

Enabling plugins on node rabbit@55e482b3fabb:
rabbitmq_management
The following plugins have been configured:
  rabbitmq_management
  rabbitmq_management_agent
  rabbitmq_prometheus
  rabbitmq_web_dispatch
Applying plugin configuration to rabbit@55e482b3fabb...
** (CaseClauseError) no case clause matching: {:could_not_start, :rabbitmq_management, {:rabbitmq_management, {'Metrics collection disabled in management agent', {:rabbit_mgmt_app, :start, [:normal, []]}}}}
    (rabbitmqctl) lib/rabbitmq/cli/plugins/plugins_helpers.ex:218: RabbitMQ.CLI.Plugins.Helpers.update_enabled_plugins/2
    (rabbitmqctl) lib/rabbitmq/cli/plugins/plugins_helpers.ex:115: RabbitMQ.CLI.Plugins.Helpers.update_enabled_plugins/4
    (rabbitmqctl) lib/rabbitmq/cli/plugins/commands/enable_command.ex:104: anonymous fn/6 in RabbitMQ.CLI.Plugins.Commands.EnableCommand.do_run/2
    (elixir) lib/stream.ex:1311: anonymous fn/2 in Stream.iterate/2
    (elixir) lib/stream.ex:1497: Stream.do_unfold/4
    (elixir) lib/stream.ex:1568: Enumerable.Stream.do_each/4
    (elixir) lib/stream.ex:936: Stream.do_enum_transform/7
    (elixir) lib/stream.ex:1568: Enumerable.Stream.do_each/4

@gerhard gerhard merged commit ee0f332 into master Apr 22, 2019
@gerhard gerhard deleted the disable-metrics-collection branch April 22, 2019 16:38
gerhard added a commit to rabbitmq/rabbitmq-prometheus that referenced this pull request Apr 22, 2019
This has support for disabling metrics_collector, as captured in
rabbitmq/rabbitmq-management-agent#78 & rabbitmq/rabbitmq-management#691

Since we want management to be enabled, this doesn't help our use-case,
but this option is perfect for users that want metrics, but don't want
to pay the overhead of Management - especially metric aggregations.

[#164376052]
@gerhard gerhard restored the disable-metrics-collection branch April 22, 2019 21:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants