Skip to content

Commit

Permalink
Merge pull request #11942 from rabbitmq/mergify/bp/v4.0.x/pr-11940
Browse files Browse the repository at this point in the history
Extract Prometheus extensions for Shovel and Federation into their own plugins (backport #11940)
  • Loading branch information
michaelklishin authored Aug 8, 2024
2 parents 7ae3207 + 208aa1c commit 729b31f
Show file tree
Hide file tree
Showing 37 changed files with 1,682 additions and 125 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/templates/test-mixed-versions.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@ on:
push:
branches:
- main
- v3.12.x
- v3.11.x
- v3.10.x
- v3.9.x
- v3.8.x
- v4.0.x
- v3.13.x
- bump-otp-*
- bump-elixir-*
- bump-rbe-*
Expand Down
45 changes: 40 additions & 5 deletions .github/workflows/test-mixed-versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ on:
push:
branches:
- main
- v3.12.x
- v3.11.x
- v3.10.x
- v3.9.x
- v3.8.x
- v4.0.x
- v3.13.x
- bump-otp-*
- bump-elixir-*
- bump-rbe-*
Expand Down Expand Up @@ -617,6 +614,24 @@ jobs:
repo_cache_key: ${{ needs.check-workflow.outputs.repo_cache_key }}
plugin: rabbitmq_federation_management
secrets: inherit
test-rabbitmq_federation_prometheus-mixed:
needs:
- check-workflow
- test-rabbit-0-mixed
- test-rabbit-1-mixed
- test-rabbit-2-mixed
- test-rabbit-3-mixed
- test-rabbit-4-mixed
- test-rabbit-5-mixed
- test-rabbit-6-mixed
- test-rabbit-7-mixed
- test-rabbit-8-mixed
- test-rabbit-9-mixed
uses: ./.github/workflows/test-plugin-mixed.yaml
with:
repo_cache_key: ${{ needs.check-workflow.outputs.repo_cache_key }}
plugin: rabbitmq_federation_prometheus
secrets: inherit
test-rabbitmq_jms_topic_exchange-mixed:
needs:
- check-workflow
Expand Down Expand Up @@ -905,6 +920,24 @@ jobs:
repo_cache_key: ${{ needs.check-workflow.outputs.repo_cache_key }}
plugin: rabbitmq_shovel_management
secrets: inherit
test-rabbitmq_shovel_prometheus-mixed:
needs:
- check-workflow
- test-rabbit-0-mixed
- test-rabbit-1-mixed
- test-rabbit-2-mixed
- test-rabbit-3-mixed
- test-rabbit-4-mixed
- test-rabbit-5-mixed
- test-rabbit-6-mixed
- test-rabbit-7-mixed
- test-rabbit-8-mixed
- test-rabbit-9-mixed
uses: ./.github/workflows/test-plugin-mixed.yaml
with:
repo_cache_key: ${{ needs.check-workflow.outputs.repo_cache_key }}
plugin: rabbitmq_shovel_prometheus
secrets: inherit
test-rabbitmq_stomp-mixed:
needs:
- check-workflow
Expand Down Expand Up @@ -1126,6 +1159,7 @@ jobs:
- test-rabbitmq_event_exchange-mixed
- test-rabbitmq_federation-mixed
- test-rabbitmq_federation_management-mixed
- test-rabbitmq_federation_prometheus-mixed
- test-rabbitmq_jms_topic_exchange-mixed
- test-rabbitmq_management-mixed
- test-rabbitmq_management_agent-mixed
Expand All @@ -1142,6 +1176,7 @@ jobs:
- test-rabbitmq_sharding-mixed
- test-rabbitmq_shovel-mixed
- test-rabbitmq_shovel_management-mixed
- test-rabbitmq_shovel_prometheus-mixed
- test-rabbitmq_stomp-mixed
- test-rabbitmq_stream-mixed
- test-rabbitmq_stream_management-mixed
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,24 @@ jobs:
repo_cache_key: ${{ needs.check-workflow.outputs.repo_cache_key }}
plugin: rabbitmq_federation_management
secrets: inherit
test-rabbitmq_federation_prometheus:
needs:
- check-workflow
- test-rabbit-0
- test-rabbit-1
- test-rabbit-2
- test-rabbit-3
- test-rabbit-4
- test-rabbit-5
- test-rabbit-6
- test-rabbit-7
- test-rabbit-8
- test-rabbit-9
uses: ./.github/workflows/test-plugin.yaml
with:
repo_cache_key: ${{ needs.check-workflow.outputs.repo_cache_key }}
plugin: rabbitmq_federation_prometheus
secrets: inherit
test-rabbitmq_jms_topic_exchange:
needs:
- check-workflow
Expand Down Expand Up @@ -842,6 +860,24 @@ jobs:
repo_cache_key: ${{ needs.check-workflow.outputs.repo_cache_key }}
plugin: rabbitmq_shovel_management
secrets: inherit
test-rabbitmq_shovel_prometheus:
needs:
- check-workflow
- test-rabbit-0
- test-rabbit-1
- test-rabbit-2
- test-rabbit-3
- test-rabbit-4
- test-rabbit-5
- test-rabbit-6
- test-rabbit-7
- test-rabbit-8
- test-rabbit-9
uses: ./.github/workflows/test-plugin.yaml
with:
repo_cache_key: ${{ needs.check-workflow.outputs.repo_cache_key }}
plugin: rabbitmq_shovel_prometheus
secrets: inherit
test-rabbitmq_stomp:
needs:
- check-workflow
Expand Down Expand Up @@ -1063,6 +1099,7 @@ jobs:
- test-rabbitmq_event_exchange
- test-rabbitmq_federation
- test-rabbitmq_federation_management
- test-rabbitmq_federation_prometheus
- test-rabbitmq_jms_topic_exchange
- test-rabbitmq_management
- test-rabbitmq_management_agent
Expand All @@ -1079,6 +1116,7 @@ jobs:
- test-rabbitmq_sharding
- test-rabbitmq_shovel
- test-rabbitmq_shovel_management
- test-rabbitmq_shovel_prometheus
- test-rabbitmq_stomp
- test-rabbitmq_stream
- test-rabbitmq_stream_management
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ elvis
!/deps/rabbitmq_event_exchange/
!/deps/rabbitmq_federation/
!/deps/rabbitmq_federation_management/
!/deps/rabbitmq_federation_prometheus/
!/deps/rabbitmq_jms_topic_exchange/
!/deps/rabbitmq_management/
!/deps/rabbitmq_management_agent/
Expand All @@ -64,6 +65,7 @@ elvis
!/deps/rabbitmq_sharding/
!/deps/rabbitmq_shovel/
!/deps/rabbitmq_shovel_management/
!/deps/rabbitmq_shovel_prometheus/
!/deps/rabbitmq_stomp/
!/deps/rabbitmq_stream/
!/deps/rabbitmq_stream_common/
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,7 @@ TIER1_PLUGINS := \
rabbitmq_event_exchange \
rabbitmq_federation \
rabbitmq_federation_management \
rabbitmq_federation_prometheus \
rabbitmq_jms_topic_exchange \
rabbitmq_management \
rabbitmq_management_agent \
Expand All @@ -610,6 +611,7 @@ TIER1_PLUGINS := \
rabbitmq_sharding \
rabbitmq_shovel \
rabbitmq_shovel_management \
rabbitmq_shovel_prometheus \
rabbitmq_stomp \
rabbitmq_stream \
rabbitmq_stream_management \
Expand Down
117 changes: 117 additions & 0 deletions deps/rabbitmq_federation_prometheus/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
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",
"rabbitmq_app",
"rabbitmq_integration_suite",
)
load(
":app.bzl",
"all_beam_files",
"all_srcs",
"all_test_beam_files",
"test_suite_beam_files",
)

APP_NAME = "rabbitmq_federation_prometheus"

APP_DESCRIPTION = "Prometheus extension for the Federation plugin"

APP_ENV = """[
]"""

all_srcs(name = "all_srcs")

all_beam_files(name = "all_beam_files")

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 = APP_DESCRIPTION,
app_env = APP_ENV,
app_extra_keys = BROKER_VERSION_REQUIREMENTS_ANY,
app_module = "rabbit_federation_prometheus_app",
app_name = APP_NAME,
beam_files = [":beam_files"],
extra_apps = [
"crypto",
],
license_files = [":license_files"],
priv = [":priv"],
deps = [
"//deps/rabbit:erlang_app",
"//deps/rabbitmq_federation:erlang_app",
"//deps/rabbitmq_prometheus:erlang_app",
],
)

xref(
name = "xref",
target = ":erlang_app",
)

plt(
name = "deps_plt",
for_target = ":erlang_app",
ignore_warnings = True,
libs = ["@rules_elixir//elixir"], # keep
plt = "//:base_plt",
)

dialyze(
name = "dialyze",
dialyzer_opts = RABBITMQ_DIALYZER_OPTS,
plt = ":deps_plt",
target = ":erlang_app",
)

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",
size = "small",
additional_beam = [
],
)

assert_suites()

alias(
name = "rabbitmq_federation_prometheus",
actual = ":erlang_app",
visibility = ["//visibility:public"],
)
1 change: 1 addition & 0 deletions deps/rabbitmq_federation_prometheus/CODE_OF_CONDUCT.md
1 change: 1 addition & 0 deletions deps/rabbitmq_federation_prometheus/CONTRIBUTING.md
1 change: 1 addition & 0 deletions deps/rabbitmq_federation_prometheus/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This package is licensed under the MPL 2.0. For the MPL 2.0, please see LICENSE-MPL-RabbitMQ.
Loading

0 comments on commit 729b31f

Please sign in to comment.