Rework shovel_prometheus and federation_prometheus plugins
to structure them like applications. This updates Bazel files but not yet Make ones.
This commit is contained in:
parent
2766122836
commit
ed7e79cf92
|
@ -1,11 +1,13 @@
|
|||
load("@rules_erlang//:eunit2.bzl", "eunit")
|
||||
load("@rules_erlang//:xref2.bzl", "xref")
|
||||
load("@rules_erlang//:dialyze.bzl", "dialyze", "plt")
|
||||
load("//:rabbitmq_home.bzl", "rabbitmq_home")
|
||||
load("//:rabbitmq_run.bzl", "rabbitmq_run")
|
||||
load(
|
||||
"//:rabbitmq.bzl",
|
||||
"BROKER_VERSION_REQUIREMENTS_ANY",
|
||||
"RABBITMQ_DIALYZER_OPTS",
|
||||
"assert_suites",
|
||||
"broker_for_integration_suites",
|
||||
"rabbitmq_app",
|
||||
"rabbitmq_integration_suite",
|
||||
)
|
||||
|
@ -17,7 +19,9 @@ load(
|
|||
"test_suite_beam_files",
|
||||
)
|
||||
|
||||
# gazelle:erlang_always_generate_test_beam_files
|
||||
APP_NAME = "rabbitmq_federation_prometheus"
|
||||
|
||||
APP_DESCRIPTION = "Prometheus extension for the Federation plugin"
|
||||
|
||||
APP_ENV = """[
|
||||
]"""
|
||||
|
@ -41,15 +45,14 @@ rabbitmq_app(
|
|||
name = "erlang_app",
|
||||
srcs = [":all_srcs"],
|
||||
hdrs = [":public_hdrs"],
|
||||
app_description = "Exposes rabbitmq_federation metrics to Prometheus",
|
||||
app_description = APP_DESCRIPTION,
|
||||
app_env = APP_ENV,
|
||||
app_module = "rabbitmq_federation_prometheus",
|
||||
app_name = "rabbitmq_federation_prometheus",
|
||||
app_version = module_version(),
|
||||
app_extra_keys = BROKER_VERSION_REQUIREMENTS_ANY,
|
||||
app_module = "rabbit_federation_prometheus_app",
|
||||
app_name = APP_NAME,
|
||||
beam_files = [":beam_files"],
|
||||
extra_apps = [
|
||||
"crypto",
|
||||
"rabbit_common",
|
||||
],
|
||||
license_files = [":license_files"],
|
||||
priv = [":priv"],
|
||||
|
@ -60,12 +63,6 @@ rabbitmq_app(
|
|||
],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "rabbitmq_federation_prometheus",
|
||||
actual = ":erlang_app",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
xref(
|
||||
name = "xref",
|
||||
target = ":erlang_app",
|
||||
|
@ -75,9 +72,8 @@ plt(
|
|||
name = "deps_plt",
|
||||
for_target = ":erlang_app",
|
||||
ignore_warnings = True,
|
||||
libs = ["//deps/rabbitmq_cli:elixir"], # keep
|
||||
libs = ["@rules_elixir//elixir"], # keep
|
||||
plt = "//:base_plt",
|
||||
deps = ["//deps/rabbitmq_cli:erlang_app"], # keep
|
||||
)
|
||||
|
||||
dialyze(
|
||||
|
@ -87,7 +83,23 @@ dialyze(
|
|||
target = ":erlang_app",
|
||||
)
|
||||
|
||||
broker_for_integration_suites()
|
||||
eunit(
|
||||
name = "eunit",
|
||||
target = ":test_erlang_app",
|
||||
)
|
||||
|
||||
rabbitmq_home(
|
||||
name = "broker-for-tests-home",
|
||||
plugins = [
|
||||
"//deps/rabbit:erlang_app",
|
||||
":erlang_app",
|
||||
],
|
||||
)
|
||||
|
||||
rabbitmq_run(
|
||||
name = "rabbitmq-for-tests-run",
|
||||
home = ":broker-for-tests-home",
|
||||
)
|
||||
|
||||
rabbitmq_integration_suite(
|
||||
name = "prometheus_rabbitmq_federation_collector_SUITE",
|
||||
|
@ -98,7 +110,8 @@ rabbitmq_integration_suite(
|
|||
|
||||
assert_suites()
|
||||
|
||||
eunit(
|
||||
name = "eunit",
|
||||
target = ":test_erlang_app",
|
||||
alias(
|
||||
name = "rabbitmq_federation_prometheus",
|
||||
actual = ":erlang_app",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
|
|
@ -8,7 +8,11 @@ def all_beam_files(name = "all_beam_files"):
|
|||
)
|
||||
erlang_bytecode(
|
||||
name = "other_beam",
|
||||
srcs = ["src/rabbitmq_federation_prometheus.erl"],
|
||||
srcs = [
|
||||
"src/rabbit_federation_prometheus_app.erl",
|
||||
"src/rabbit_federation_prometheus_collector.erl",
|
||||
"src/rabbit_federation_prometheus_sup.erl",
|
||||
],
|
||||
hdrs = [":public_and_private_hdrs"],
|
||||
app_name = "rabbitmq_federation_prometheus",
|
||||
dest = "ebin",
|
||||
|
@ -32,7 +36,11 @@ def all_srcs(name = "all_srcs"):
|
|||
|
||||
filegroup(
|
||||
name = "srcs",
|
||||
srcs = ["src/rabbitmq_federation_prometheus.erl"],
|
||||
srcs = [
|
||||
"src/rabbit_federation_prometheus_app.erl",
|
||||
"src/rabbit_federation_prometheus_collector.erl",
|
||||
"src/rabbit_federation_prometheus_sup.erl",
|
||||
],
|
||||
)
|
||||
filegroup(
|
||||
name = "private_hdrs",
|
||||
|
@ -57,7 +65,11 @@ def all_test_beam_files(name = "all_test_beam_files"):
|
|||
erlang_bytecode(
|
||||
name = "test_other_beam",
|
||||
testonly = True,
|
||||
srcs = ["src/rabbitmq_federation_prometheus.erl"],
|
||||
srcs = [
|
||||
"src/rabbit_federation_prometheus_app.erl",
|
||||
"src/rabbit_federation_prometheus_collector.erl",
|
||||
"src/rabbit_federation_prometheus_sup.erl",
|
||||
],
|
||||
hdrs = [":public_and_private_hdrs"],
|
||||
app_name = "rabbitmq_federation_prometheus",
|
||||
dest = "test",
|
||||
|
|
27
deps/rabbitmq_federation_prometheus/src/rabbit_federation_prometheus_app.erl
vendored
Normal file
27
deps/rabbitmq_federation_prometheus/src/rabbit_federation_prometheus_app.erl
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
%% This Source Code Form is subject to the terms of the Mozilla Public
|
||||
%% License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
%%
|
||||
%% Copyright (c) 2007-2024 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
|
||||
%%
|
||||
-module(rabbit_federation_prometheus_app).
|
||||
|
||||
-behavior(application).
|
||||
|
||||
-export([start/0, stop/0, start/2, stop/1]).
|
||||
|
||||
start(normal, []) ->
|
||||
{ok, _} = application:ensure_all_started(prometheus),
|
||||
_ = rabbit_federation_prometheus_collector:start(),
|
||||
rabbit_federation_prometheus_sup:start_link().
|
||||
|
||||
stop(_State) ->
|
||||
_ = rabbit_federation_prometheus_collector:stop(),
|
||||
ok.
|
||||
|
||||
|
||||
start() ->
|
||||
_ = rabbit_federation_prometheus_collector:start().
|
||||
|
||||
stop() -> ok.
|
||||
|
|
@ -2,24 +2,21 @@
|
|||
%% License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
%%
|
||||
%% Copyright (c) 2007-2023 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
|
||||
%% Copyright (c) 2007-2024 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
|
||||
%%
|
||||
-module(rabbitmq_federation_prometheus).
|
||||
-module(rabbit_federation_prometheus_collector).
|
||||
|
||||
-behaviour(prometheus_collector).
|
||||
|
||||
-export([start/0, stop/0]).
|
||||
-export([deregister_cleanup/1,
|
||||
collect_mf/2]).
|
||||
|
||||
-import(prometheus_model_helpers, [create_mf/4]).
|
||||
|
||||
-behaviour(prometheus_collector).
|
||||
|
||||
-rabbit_boot_step({?MODULE, [
|
||||
{description, "rabbitmq_federation prometheus collector plugin"},
|
||||
{mfa, {?MODULE, start, []}},
|
||||
{cleanup, {?MODULE, stop, []}}
|
||||
]}).
|
||||
|
||||
%% API exports
|
||||
-export([start/0, stop/0]).
|
||||
%%====================================================================
|
||||
%% Collector API
|
||||
%%====================================================================
|
||||
|
||||
start() ->
|
||||
{ok, _} = application:ensure_all_started(prometheus),
|
||||
|
@ -41,7 +38,7 @@ collect_mf(_Registry, Callback) ->
|
|||
%% update with will take Init and put into Acc, wuthout calling fun
|
||||
maps:update_with(proplists:get_value(status, S), fun(C) -> C + 1 end, 1, Acc)
|
||||
end, #{}, Status),
|
||||
Metrics = [{rabbitmq_federation_links, gauge, "Current number of federation links",
|
||||
Metrics = [{rabbitmq_federation_links, gauge, "Number of federation links",
|
||||
[{[{status, S}], C} || {S, C} <- maps:to_list(StatusGroups)]}],
|
||||
_ = [add_metric_family(Metric, Callback) || Metric <- Metrics],
|
||||
ok.
|
20
deps/rabbitmq_federation_prometheus/src/rabbit_federation_prometheus_sup.erl
vendored
Normal file
20
deps/rabbitmq_federation_prometheus/src/rabbit_federation_prometheus_sup.erl
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
%% This Source Code Form is subject to the terms of the Mozilla Public
|
||||
%% License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
%%
|
||||
%% Copyright (c) 2007-2024 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
|
||||
%%
|
||||
-module(rabbit_federation_prometheus_sup).
|
||||
|
||||
-behaviour(supervisor).
|
||||
|
||||
-export([start_link/0]).
|
||||
-export([init/1]).
|
||||
|
||||
start_link() ->
|
||||
supervisor:start_link(?MODULE, []).
|
||||
|
||||
init(_Args) ->
|
||||
SupFlags = #{strategy => one_for_one, intensity => 1, period => 5},
|
||||
ChildSpecs = [],
|
||||
{ok, {SupFlags, ChildSpecs}}.
|
|
@ -14,21 +14,21 @@
|
|||
-compile(export_all).
|
||||
|
||||
-define(ONE_RUNNING_METRIC, #'MetricFamily'{name = <<"rabbitmq_federation_links">>,
|
||||
help = "Current number of federation links",
|
||||
help = "Number of federation links",
|
||||
type = 'GAUGE',
|
||||
metric = [#'Metric'{label = [#'LabelPair'{name = <<"status">>,
|
||||
value = <<"running">>}],
|
||||
gauge = #'Gauge'{value = 1}}]}).
|
||||
|
||||
-define(TWO_RUNNING_METRIC, #'MetricFamily'{name = <<"rabbitmq_federation_links">>,
|
||||
help = "Current number of federation links",
|
||||
help = "Number of federation links",
|
||||
type = 'GAUGE',
|
||||
metric = [#'Metric'{label = [#'LabelPair'{name = <<"status">>,
|
||||
value = <<"running">>}],
|
||||
gauge = #'Gauge'{value = 2}}]}).
|
||||
|
||||
-define(ONE_RUNNING_ONE_STARTING_METRIC, #'MetricFamily'{name = <<"rabbitmq_federation_links">>,
|
||||
help = "Current number of federation links",
|
||||
help = "Number of federation links",
|
||||
type = 'GAUGE',
|
||||
metric = [#'Metric'{label = [#'LabelPair'{name = <<"status">>,
|
||||
value = <<"running">>}],
|
||||
|
@ -142,7 +142,7 @@ upstream_downstream() ->
|
|||
get_metrics(Config) ->
|
||||
rabbit_ct_broker_helpers:rpc(Config, 0,
|
||||
?MODULE, collect_mf,
|
||||
[default, rabbitmq_federation_prometheus]).
|
||||
[default, rabbit_federation_prometheus_collector]).
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
load("@rules_erlang//:eunit2.bzl", "eunit")
|
||||
load("@rules_erlang//:xref2.bzl", "xref")
|
||||
load("@rules_erlang//:dialyze.bzl", "dialyze", "plt")
|
||||
load("//:rabbitmq_home.bzl", "rabbitmq_home")
|
||||
load("//:rabbitmq_run.bzl", "rabbitmq_run")
|
||||
load(
|
||||
"//:rabbitmq.bzl",
|
||||
"BROKER_VERSION_REQUIREMENTS_ANY",
|
||||
"RABBITMQ_DIALYZER_OPTS",
|
||||
"assert_suites",
|
||||
"broker_for_integration_suites",
|
||||
"rabbitmq_app",
|
||||
"rabbitmq_integration_suite",
|
||||
)
|
||||
|
@ -17,7 +19,9 @@ load(
|
|||
"test_suite_beam_files",
|
||||
)
|
||||
|
||||
# gazelle:erlang_always_generate_test_beam_files
|
||||
APP_NAME = "rabbitmq_shovel_prometheus"
|
||||
|
||||
APP_DESCRIPTION = "Prometheus extension for the Shovel plugin"
|
||||
|
||||
APP_ENV = """[
|
||||
]"""
|
||||
|
@ -31,25 +35,22 @@ all_test_beam_files(name = "all_test_beam_files")
|
|||
test_suite_beam_files(name = "test_suite_beam_files")
|
||||
|
||||
# gazelle:erlang_app_extra_app crypto
|
||||
|
||||
# gazelle:erlang_app_dep rabbit
|
||||
# gazelle:erlang_app_dep rabbitmq_prometheus
|
||||
|
||||
# gazelle:erlang_app_dep_exclude prometheus
|
||||
|
||||
rabbitmq_app(
|
||||
name = "erlang_app",
|
||||
srcs = [":all_srcs"],
|
||||
hdrs = [":public_hdrs"],
|
||||
app_description = "Exposes rabbitmq_shovel metrics to Prometheus",
|
||||
app_description = APP_DESCRIPTION,
|
||||
app_env = APP_ENV,
|
||||
app_module = "rabbitmq_shovel_prometheus",
|
||||
app_name = "rabbitmq_shovel_prometheus",
|
||||
app_version = module_version(),
|
||||
app_extra_keys = BROKER_VERSION_REQUIREMENTS_ANY,
|
||||
app_module = "rabbit_shovel_prometheus_app",
|
||||
app_name = APP_NAME,
|
||||
beam_files = [":beam_files"],
|
||||
extra_apps = [
|
||||
"crypto",
|
||||
"rabbit_common",
|
||||
],
|
||||
license_files = [":license_files"],
|
||||
priv = [":priv"],
|
||||
|
@ -60,12 +61,6 @@ rabbitmq_app(
|
|||
],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "rabbitmq_shovel_prometheus",
|
||||
actual = ":erlang_app",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
xref(
|
||||
name = "xref",
|
||||
target = ":erlang_app",
|
||||
|
@ -75,9 +70,8 @@ plt(
|
|||
name = "deps_plt",
|
||||
for_target = ":erlang_app",
|
||||
ignore_warnings = True,
|
||||
libs = ["//deps/rabbitmq_cli:elixir"], # keep
|
||||
libs = ["@rules_elixir//elixir"], # keep
|
||||
plt = "//:base_plt",
|
||||
deps = ["//deps/rabbitmq_cli:erlang_app"], # keep
|
||||
)
|
||||
|
||||
dialyze(
|
||||
|
@ -87,7 +81,23 @@ dialyze(
|
|||
target = ":erlang_app",
|
||||
)
|
||||
|
||||
broker_for_integration_suites()
|
||||
eunit(
|
||||
name = "eunit",
|
||||
target = ":test_erlang_app",
|
||||
)
|
||||
|
||||
rabbitmq_home(
|
||||
name = "broker-for-tests-home",
|
||||
plugins = [
|
||||
"//deps/rabbit:erlang_app",
|
||||
":erlang_app",
|
||||
],
|
||||
)
|
||||
|
||||
rabbitmq_run(
|
||||
name = "rabbitmq-for-tests-run",
|
||||
home = ":broker-for-tests-home",
|
||||
)
|
||||
|
||||
rabbitmq_integration_suite(
|
||||
name = "prometheus_rabbitmq_shovel_collector_SUITE",
|
||||
|
@ -98,7 +108,8 @@ rabbitmq_integration_suite(
|
|||
|
||||
assert_suites()
|
||||
|
||||
eunit(
|
||||
name = "eunit",
|
||||
target = ":test_erlang_app",
|
||||
alias(
|
||||
name = "rabbitmq_shovel_prometheus",
|
||||
actual = ":erlang_app",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
|
|
@ -8,7 +8,11 @@ def all_beam_files(name = "all_beam_files"):
|
|||
)
|
||||
erlang_bytecode(
|
||||
name = "other_beam",
|
||||
srcs = ["src/rabbitmq_shovel_prometheus.erl"],
|
||||
srcs = [
|
||||
"src/rabbit_shovel_prometheus_app.erl",
|
||||
"src/rabbit_shovel_prometheus_collector.erl",
|
||||
"src/rabbit_shovel_prometheus_sup.erl",
|
||||
],
|
||||
hdrs = [":public_and_private_hdrs"],
|
||||
app_name = "rabbitmq_shovel_prometheus",
|
||||
dest = "ebin",
|
||||
|
@ -32,7 +36,11 @@ def all_srcs(name = "all_srcs"):
|
|||
|
||||
filegroup(
|
||||
name = "srcs",
|
||||
srcs = ["src/rabbitmq_shovel_prometheus.erl"],
|
||||
srcs = [
|
||||
"src/rabbit_shovel_prometheus_app.erl",
|
||||
"src/rabbit_shovel_prometheus_collector.erl",
|
||||
"src/rabbit_shovel_prometheus_sup.erl",
|
||||
],
|
||||
)
|
||||
filegroup(
|
||||
name = "private_hdrs",
|
||||
|
@ -57,7 +65,11 @@ def all_test_beam_files(name = "all_test_beam_files"):
|
|||
erlang_bytecode(
|
||||
name = "test_other_beam",
|
||||
testonly = True,
|
||||
srcs = ["src/rabbitmq_shovel_prometheus.erl"],
|
||||
srcs = [
|
||||
"src/rabbit_shovel_prometheus_app.erl",
|
||||
"src/rabbit_shovel_prometheus_collector.erl",
|
||||
"src/rabbit_shovel_prometheus_sup.erl",
|
||||
],
|
||||
hdrs = [":public_and_private_hdrs"],
|
||||
app_name = "rabbitmq_shovel_prometheus",
|
||||
dest = "test",
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
%% This Source Code Form is subject to the terms of the Mozilla Public
|
||||
%% License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
%%
|
||||
%% Copyright (c) 2007-2024 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
|
||||
%%
|
||||
-module(rabbit_shovel_prometheus_app).
|
||||
|
||||
-behavior(application).
|
||||
|
||||
-export([start/0, stop/0, start/2, stop/1]).
|
||||
|
||||
start(normal, []) ->
|
||||
{ok, _} = application:ensure_all_started(prometheus),
|
||||
_ = rabbit_shovel_prometheus_collector:start(),
|
||||
rabbit_shovel_prometheus_sup:start_link().
|
||||
|
||||
stop(_State) ->
|
||||
_ = rabbit_shovel_prometheus_collector:stop(),
|
||||
ok.
|
||||
|
||||
|
||||
start() ->
|
||||
_ = rabbit_shovel_prometheus_collector:start().
|
||||
|
||||
stop() -> ok.
|
||||
|
|
@ -2,31 +2,23 @@
|
|||
%% License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
%%
|
||||
%% Copyright (c) 2007-2023 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
|
||||
%% Copyright (c) 2007-2024 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
|
||||
%%
|
||||
-module(rabbitmq_shovel_prometheus).
|
||||
-module(rabbit_shovel_prometheus_collector).
|
||||
|
||||
-behaviour(prometheus_collector).
|
||||
|
||||
-export([start/0, stop/0]).
|
||||
-export([deregister_cleanup/1,
|
||||
collect_mf/2]).
|
||||
|
||||
-import(prometheus_model_helpers, [create_mf/4]).
|
||||
|
||||
-behaviour(prometheus_collector).
|
||||
|
||||
-rabbit_boot_step({?MODULE, [
|
||||
{description, "rabbitmq_shovel prometheus"},
|
||||
{mfa, {?MODULE, start, []}},
|
||||
{cleanup, {?MODULE, stop, []}}
|
||||
]}).
|
||||
|
||||
%% API exports
|
||||
-export([start/0, stop/0]).
|
||||
|
||||
%%====================================================================
|
||||
%% Collector API
|
||||
%%====================================================================
|
||||
|
||||
start() ->
|
||||
{ok, _} = application:ensure_all_started(prometheus),
|
||||
prometheus_registry:register_collector(?MODULE).
|
||||
|
||||
stop() ->
|
||||
|
@ -42,9 +34,9 @@ collect_mf(_Registry, Callback) ->
|
|||
{SMap, maps:update_with(S, fun(C) -> C + 1 end, 1, DMap)}
|
||||
end, {#{}, #{}}, Status),
|
||||
|
||||
Metrics = [{rabbitmq_shovel_dynamic, gauge, "Current number of dynamic shovels",
|
||||
Metrics = [{rabbitmq_shovel_dynamic, gauge, "Number of dynamic shovels",
|
||||
[{[{status, S}], C} || {S, C} <- maps:to_list(DynamicStatusGroups)]},
|
||||
{rabbitmq_shovel_static, gauge, "Current number of static shovels",
|
||||
{rabbitmq_shovel_static, gauge, "Number of static shovels",
|
||||
[{[{status, S}], C} || {S, C} <- maps:to_list(StaticStatusGroups)]}
|
||||
],
|
||||
_ = [add_metric_family(Metric, Callback) || Metric <- Metrics],
|
|
@ -0,0 +1,20 @@
|
|||
%% This Source Code Form is subject to the terms of the Mozilla Public
|
||||
%% License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
%%
|
||||
%% Copyright (c) 2007-2024 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
|
||||
%%
|
||||
-module(rabbit_shovel_prometheus_sup).
|
||||
|
||||
-behaviour(supervisor).
|
||||
|
||||
-export([start_link/0]).
|
||||
-export([init/1]).
|
||||
|
||||
start_link() ->
|
||||
supervisor:start_link(?MODULE, []).
|
||||
|
||||
init(_Args) ->
|
||||
SupFlags = #{strategy => one_for_one, intensity => 1, period => 5},
|
||||
ChildSpecs = [],
|
||||
{ok, {SupFlags, ChildSpecs}}.
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
-define(DYN_RUNNING_METRIC(Gauge),
|
||||
#'MetricFamily'{name = <<"rabbitmq_shovel_dynamic">>,
|
||||
help = "Current number of dynamic shovels",type = 'GAUGE',
|
||||
help = "Number of dynamic shovels",type = 'GAUGE',
|
||||
metric = [#'Metric'{label = [#'LabelPair'{name = <<"status">>,
|
||||
value = <<"running">>}],
|
||||
gauge = #'Gauge'{value = Gauge},
|
||||
|
@ -25,7 +25,7 @@
|
|||
|
||||
-define(STAT_RUNNING_METRIC(Gauge),
|
||||
#'MetricFamily'{name = <<"rabbitmq_shovel_static">>,
|
||||
help = "Current number of static shovels",type = 'GAUGE',
|
||||
help = "Number of static shovels",type = 'GAUGE',
|
||||
metric = [#'Metric'{label = [#'LabelPair'{name = <<"status">>,
|
||||
value = <<"running">>}],
|
||||
gauge = #'Gauge'{value = Gauge},
|
||||
|
@ -33,11 +33,11 @@
|
|||
histogram = undefined,timestamp_ms = undefined}]}).
|
||||
|
||||
-define(EMPTY_DYN_METRIC, #'MetricFamily'{name = <<"rabbitmq_shovel_dynamic">>,
|
||||
help = "Current number of dynamic shovels",type = 'GAUGE',
|
||||
help = "Number of dynamic shovels",type = 'GAUGE',
|
||||
metric = []}).
|
||||
|
||||
-define(EMPTY_STAT_METRIC, #'MetricFamily'{name = <<"rabbitmq_shovel_static">>,
|
||||
help = "Current number of static shovels",type = 'GAUGE',
|
||||
help = "Number of static shovels",type = 'GAUGE',
|
||||
metric = []}).
|
||||
|
||||
|
||||
|
@ -136,7 +136,7 @@ mix(Config) ->
|
|||
get_metrics(Config) ->
|
||||
rabbit_ct_broker_helpers:rpc(Config, 0,
|
||||
?MODULE, collect_mf,
|
||||
[default, rabbitmq_shovel_prometheus]).
|
||||
[default, rabbit_shovel_prometheus_collector]).
|
||||
|
||||
create_static_shovel(Config, Name) ->
|
||||
Hostname = ?config(rmq_hostname, Config),
|
||||
|
|
|
@ -894,7 +894,9 @@ rabbitmq_federation:
|
|||
rabbitmq_federation_management:
|
||||
- rabbit_federation_mgmt
|
||||
rabbitmq_federation_prometheus:
|
||||
- rabbitmq_federation_prometheus
|
||||
- rabbit_federation_prometheus_app
|
||||
- rabbit_federation_prometheus_collector
|
||||
- rabbit_federation_prometheus_sup
|
||||
rabbitmq_jms_topic_exchange:
|
||||
- rabbit_db_jms_exchange
|
||||
- rabbit_db_jms_exchange_m2k_converter
|
||||
|
@ -1129,7 +1131,9 @@ rabbitmq_shovel_management:
|
|||
- rabbit_shovel_mgmt
|
||||
- rabbit_shovel_mgmt_util
|
||||
rabbitmq_shovel_prometheus:
|
||||
- rabbitmq_shovel_prometheus
|
||||
- rabbit_shovel_prometheus_app
|
||||
- rabbit_shovel_prometheus_collector
|
||||
- rabbit_shovel_prometheus_sup
|
||||
rabbitmq_stomp:
|
||||
- Elixir.RabbitMQ.CLI.Ctl.Commands.ListStompConnectionsCommand
|
||||
- rabbit_stomp
|
||||
|
|
|
@ -55,6 +55,7 @@ ALL_PLUGINS = [
|
|||
"//deps/rabbitmq_event_exchange:erlang_app",
|
||||
"//deps/rabbitmq_federation:erlang_app",
|
||||
"//deps/rabbitmq_federation_management:erlang_app",
|
||||
"//deps/rabbitmq_federation_prometheus:erlang_app",
|
||||
"//deps/rabbitmq_jms_topic_exchange:erlang_app",
|
||||
"//deps/rabbitmq_management:erlang_app",
|
||||
"//deps/rabbitmq_mqtt:erlang_app",
|
||||
|
@ -68,6 +69,7 @@ ALL_PLUGINS = [
|
|||
"//deps/rabbitmq_sharding:erlang_app",
|
||||
"//deps/rabbitmq_shovel:erlang_app",
|
||||
"//deps/rabbitmq_shovel_management:erlang_app",
|
||||
"//deps/rabbitmq_shovel_prometheus:erlang_app",
|
||||
"//deps/rabbitmq_stomp:erlang_app",
|
||||
"//deps/rabbitmq_stream:erlang_app",
|
||||
"//deps/rabbitmq_stream_management:erlang_app",
|
||||
|
|
Loading…
Reference in New Issue