Commit Graph

207 Commits

Author SHA1 Message Date
Rin Kuryloski 854d01d9a5 Restore the original -include_lib statements from before #6466
since this broke erlang_ls

requires rules_erlang 3.9.13
2023-04-20 12:40:45 +02:00
Rin Kuryloski 8de8f59d47 Use gazelle generated bazel files
Bazel build files are now maintained primarily with `bazel run
gazelle`. This will analyze and merge changes into the build files as
necessitated by certain code changes (e.g. the introduction of new
modules).

In some cases there hints to gazelle in the build files, such as `#
gazelle:erlang...` or `# keep` comments. xref checks on plugins that
depend on the cli are a good example.
2023-04-17 18:13:18 +02:00
Rin Kuryloski 8a7eee6a86 Ignore warnings when building plt files for dependencies
As we don't generally care if a dependency has warnings, only the
target
2023-04-17 10:09:24 +02:00
David Ansari 575f4e78bc Remove compatibility for feature flag stream_queue
Remove compatibility code for feature flag `stream_queue`
because this feature flag is required in 3.12.

See #7219
2023-02-13 15:31:40 +00:00
Alexey Lebedeff c7da0da8b8 Cleanup dialyzer calls
- Use the same base .plt everywhere, so there is no need to list
standard apps everywhere
- Fix typespecs: some typos and the use of not-exported types
2023-02-06 17:05:30 +01:00
David Ansari 56e97a9142 Fix MQTT in management plugin
1. Allow to inspect an (web) MQTT connection.
2. Show MQTT client ID on connection page as part of client_properties.
3. Handle force_event_refresh (when management_plugin gets enabled
   after (web) MQTT connections got created).
4. Reduce code duplication between protocol readers.
5. Display '?' instead of 'NaN' in UI for absent queue metrics.
6. Allow an (web) MQTT connection to be closed via management_plugin.

For 6. this commit takes the same approach as already done for the stream
plugin:
The stream plugin registers neither with {type, network} nor {type,
direct}.
We cannot use gen_server:call/3 anymore to close the connection
because the web MQTT connection cannot handle gen_server calls (only
casts).
Strictly speaking, this commit requires a feature flag to allow to force
closing stream connections from the management plugin during a rolling
update. However, given that this is rather an edge case, and there is a
workaround (connect to the node directly hosting the stream connection),
this commit will not introduce a new feature flag.
2023-01-24 17:30:10 +00:00
Rin Kuryloski 5ef8923462 Avoid the need to pass package name to rabbitmq_integration_suite 2023-01-18 15:25:27 +01:00
Rin Kuryloski a317b30807 Use improved assert_suites2 macro from rules_erlang 3.9.0 2023-01-18 15:07:06 +01:00
Alexey Lebedeff 2c4e4fb691 Fix all dialyzer warnings in rabbitmq_stream
There are some elixir-related messages about undefined functions, but
they don't produce warnings (yet).
2023-01-16 17:11:24 +01:00
Michael Klishin ec4f1dba7d
(c) year bump: 2022 => 2023 2023-01-01 23:17:36 -05:00
Arnaud Cogoluègnes fa528115b1
Bump dependencies in stream Java test 2022-08-10 09:56:58 +02:00
Philip Kuryloski 15a79466b1 Use the new xref2 macro from rules_erlang
That adopts the modern erlang.mk xref behaviour
2022-06-09 23:18:28 +02:00
Philip Kuryloski 327f075d57 Make rabbitmq-server work with rules_erlang 3
Also rework elixir dependency handling, so we no longer rely on mix to
fetch the rabbitmq_cli deps

Also:

- Specify ra version with a commit rather than a branch
- Fixup compilation options for erlang 23
- Add missing ra reference in MODULE.bazel
- Add missing flag in oci.yaml
- Reduce bazel rbe jobs to try to save memory
- Use bazel built erlang for erlang git master tests
- Use the same cache for all the workflows but windows
- Avoid using `mix local.hex --force` in elixir rules
  - Fetching seems blocked in CI, and this should reduce hex api usage in
    all builds, which is always nice
- Remove xref and dialyze tags since rules_erlang 3 includes them in
  the defaults
2022-06-08 14:04:53 +02:00
Loïc Hoguin dc70cbf281
Update Erlang.mk and switch to new xref code 2022-05-31 13:51:12 +02:00
Karl Nilsson 5ede74b448 Move all rebar.config files into the root directory
Some tools such as nvim + erlang_ls sometimes change the cwd if
they encounter a rebar.config. Here we move all rebar.config files
into the root of the project to avoid this and also have a single
point for formatting configuration.
2022-05-18 09:37:38 +01:00
Arnaud Cogoluègnes 827fe6f008
Add active and activity_status in stream consumer UI list
The UI handles the case where the 2 fields are not present.
This can happen in a mixed-version cluster, where a node
of a previous version returns records without the fields.
The UI uses default values (active = true, activity status = up),
which is valid as the consumers of the node are "standalone"
consumers (not part of a group).

References #3753
2022-05-09 10:52:34 +02:00
Arnaud Cogoluègnes b1d0277048
Check active and activity_status metrics field
References #3753
2022-05-09 10:52:33 +02:00
Michael Klishin 7c47d0925a
Revert "Correct a double quote introduced in #4603"
This reverts commit 6a44e0e2ef.

That wiped a lot of files unintentionally
2022-04-20 16:05:56 +04:00
Michael Klishin 6a44e0e2ef
Correct a double quote introduced in #4603 2022-04-20 16:01:29 +04:00
Luke Bakken dba25f6462
Replace files with symlinks
This prevents duplicated and out-of-date instructions.
2022-04-15 06:04:29 -07:00
Arnaud Cogoluègnes a9cc401e3c
Bump Java test suites dependencies for stream plugins 2022-04-01 16:42:32 +02:00
Michael Klishin c38a3d697d
Bump (c) year 2022-03-21 01:21:56 +04:00
Philip Kuryloski 226e00fcd2 Tighten up dialyzer usage
now that rules_erlang no longer cascades up dialyzer warnings from deps
2022-02-24 11:18:41 +01:00
Philip Kuryloski d8201726ae Ignore dialyzer warnings for most apps 2022-02-21 09:19:56 +01:00
Arnaud Cogoluègnes 70c95c69b4
Use feature flag public API in stream mgmt utils 2022-02-02 18:20:32 +01:00
Arnaud Cogoluègnes f8657e02ef
Format stream management source files 2022-02-02 11:30:06 +01:00
Arnaud Cogoluègnes 2af24048b9
Use atoms instead of method references
Using atoms do not fail when code is executed across
nodes of different versions.

Fixes #4082
2022-02-02 11:29:22 +01:00
Philip Kuryloski efcd881658 Use rules_erlang v2
bazel-erlang has been renamed rules_erlang. v2 is a substantial
refactor that brings Windows support. While this alone isn't enough to
run all rabbitmq-server suites on windows, one can at least now start
the broker (bazel run broker) and run the tests that do not start a
background broker process
2022-01-18 13:43:46 +01:00
Arnaud Cogoluègnes 96c9270fb3
Bump dependencies in streams Java tests 2022-01-17 16:13:29 +01:00
Arnaud Cogoluègnes 8f40e534ed
Bump Java test dependencies in stream test suites 2021-12-10 09:18:22 +01:00
Arnaud Cogoluègnes ba5cfb1bae
Use version range for stream client Maven dependency
In test suite. Note a snapshot for 1.0-SNAPSHOT has been
pushed by mistake a while ago, so this one must be
excluded. It's unlikely it will be erased, as the snapshots
for the first stable version should be 1.0.0-SNAPSHOT.
2021-11-03 14:05:23 +01:00
Arnaud Cogoluègnes b71f1fd7e1
Bump Java dependencies in stream management test suite 2021-11-03 14:00:24 +01:00
Michael Klishin 78e18afd57
Wording 2021-10-14 18:24:52 +03:00
Gabriele Santomaggio f2df98aef9 change message 2021-10-13 12:01:21 +02:00
Gabriele Santomaggio 2eb625531d Disable the stream_plugin and stream management if the feature flag
is not enabled.
fixes https://github.com/rabbitmq/rabbitmq-server/issues/3557
2021-10-13 11:59:11 +02:00
Michael Klishin 72c2e152ef
Merge pull request #3499 from rabbitmq/cla-url
Update CLA URL
2021-10-01 00:16:03 +03:00
Arnaud Cogoluègnes e8d0d380a2
Bump dependencies in stream Java tests 2021-09-28 14:02:10 +02:00
Michal Kuratczyk 1a2126676d Update CLA URL 2021-09-23 14:29:36 +02:00
Gabriele Santomaggio 346adc86af Add counters on detail pages
closes https://github.com/rabbitmq/rabbitmq-server/issues/3416
2021-09-14 17:18:49 +02:00
Arnaud Cogoluègnes b0ec9ff64c
Adapt stream publisher list view to connection/queue context
References #3389
2021-09-13 16:31:06 +02:00
Arnaud Cogoluègnes 39a51772c6
Add extension into dispatcher block code
This is necessary to make sure the extension addition is actually
done in case of refresh of the queue page.

References #3389
2021-09-13 15:17:49 +02:00
Arnaud Cogoluègnes b5700751cf
Add HTTP endpoint for stream publishers
References #3389
2021-09-10 15:14:09 +02:00
Arnaud Cogoluègnes 0038573f89
Display stream publishers in queue management page
If the queue is a stream. WIP, currently all the stream publishers
are listed, a new publishers per stream endpoint is required.

References #3389
2021-09-09 17:41:38 +02:00
Arnaud Cogoluègnes 8dc024089c
Bump dependencies in Java stream tests 2021-08-31 08:32:53 +02:00
Michael Klishin 8c1183b0fd
Ditto in rabbitmq_stream_management 2021-08-10 12:16:54 +03:00
Philip Kuryloski 8f9de08de7 Also assert no missing suites for all other deps 2021-07-12 18:05:55 +02:00
Philip Kuryloski 3eac3cf8a8 Remove unused load statements from bazel files 2021-07-12 12:10:26 +02:00
Philip Kuryloski 5c7f579ccd rabbitmq_stream_management bazel fix 2021-06-29 13:26:39 +02:00
Philip Kuryloski 818818cdd6 Mark rabbitmq_stream_management suite not mixed version compatible
Since streams are 3.9 only we would not expect them to be used until
the cluster has been fully upgraded
2021-06-28 09:35:35 +02:00
Philip Kuryloski 30f9a95b9f Add dialyze for remaning tier-1 plugins 2021-06-01 10:19:10 +02:00
Arnaud Cogoluègnes e471d802c8
Render TLS info for stream connections in management UI 2021-05-27 11:15:30 +02:00
Arnaud Cogoluègnes 2ab5cb22ca
Expose TLS info for stream connections (CLI, REST API) 2021-05-27 10:43:33 +02:00
Philip Kuryloski a6f70b8dda Add xref for remaining tier-1 plugins 2021-05-25 11:39:03 +02:00
Gerhard Lazu f8b4e1e298
Add consumer offset_lag to rabbitmq-stream CLI command & Management
This is an important metric to keep track of and be aware (maybe even
alert on) when consumers fall behind consuming stream messages. While
they should be able to catch up, if they fall behind too much and the
stream gets truncated, they may miss on messages.

This is something that we want to expose via Prometheus metrics as well,
but we've started closer to the core, CLI & Management.

This should be merged as soon as it passes CI, we shouldn't wait on the
Prometheus changes - they can come later.

Pair: @kjnilsson

Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2021-05-21 13:02:48 +01:00
Arnaud Cogoluègnes c42930acb0
Set stream plugin default port to 5552 2021-05-19 15:38:52 +02:00
Arnaud Cogoluègnes 7145a1a2ad
Trigger event on stream consumer cancellation
To make metrics are cleaned up.
2021-05-18 17:42:33 +02:00
Arnaud Cogoluègnes 77b99a2efd
Add stream subscription properties to metrics 2021-05-18 16:54:41 +02:00
Arnaud Cogoluègnes e5101c2bfd
Bump JUnit in stream-related Java test suite 2021-05-17 09:32:30 +02:00
Philip Kuryloski e6df6615e1 Futher bazel file refactoring and deduplication 2021-05-11 16:15:33 +02:00
Philip Kuryloski bd97a28fb9 Add rabbitmq_stream_management to bazel 2021-05-06 13:00:08 +02:00
Philip Kuryloski a63f169fcb Remove duplicate rabbitmq-components.mk and erlang.mk files
Also adjust the references in rabbitmq-components.mk to account for
post monorepo locations
2021-03-22 15:40:19 +01:00
kjnilsson 52f745dcde Update rabbitmq-components.mk
use v1.x branch of ra
2021-03-18 15:14:40 +00:00
Loïc Hoguin d5e3bdd623
Add ADDITIONAL_PLUGINS variable
This allows including additional applications or third party
plugins when creating a release, running the broker locally,
or just building from the top-level Makefile.

To include Looking Glass in a release, for example:

$ make package-generic-unix ADDITIONAL_PLUGINS="looking_glass"

A Docker image can then be built using this release and will
contain Looking Glass:

$ make docker-image

Beware macOS users! Applications such as Looking Glass include
NIFs. NIFs must be compiled in the right environment. If you
are building a Docker image then make sure to build the NIF
on Linux! In the two steps above, this corresponds to Step 1.

To run the broker with Looking Glass available:

$ make run-broker ADDITIONAL_PLUGINS="looking_glass"

This commit also moves Looking Glass dependency information
into rabbitmq-components.mk so it is available at all times.
2021-03-12 12:29:28 +01:00
Jean-Sébastien Pédron cdcf602749
Switch from Lager to the new Erlang Logger API for logging
The configuration remains the same for the end-user. The only exception
is the log root directory: it is now set through the `log_root`
application env. variable in `rabbit`. People using the Cuttlefish-based
configuration file are not affected by this exception.

The main change is how the logging facility is configured. It now
happens in `rabbit_prelaunch_logging`. The `rabbit_lager` module is
removed.

The supported outputs remain the same: the console, text files, the
`amq.rabbitmq.log` exchange and syslog.

The message text format slightly changed: the timestamp is more precise
(now to the microsecond) and the level can be abbreviated to always be
4-character long to align all messages and improve readability. Here is
an example:

    2021-03-03 10:22:30.377392+01:00 [dbug] <0.229.0> == Prelaunch DONE ==
    2021-03-03 10:22:30.377860+01:00 [info] <0.229.0>
    2021-03-03 10:22:30.377860+01:00 [info] <0.229.0>  Starting RabbitMQ 3.8.10+115.g071f3fb on Erlang 23.2.5
    2021-03-03 10:22:30.377860+01:00 [info] <0.229.0>  Licensed under the MPL 2.0. Website: https://rabbitmq.com

The example above also shows that multiline messages are supported and
each line is prepended with the same prefix (the timestamp, the level
and the Erlang process PID).

JSON is also supported as a message format and now for any outputs.
Indeed, it is possible to use it with e.g. syslog or the exchange. Here
is an example of a JSON-formatted message sent to syslog:

    Mar  3 11:23:06 localhost rabbitmq-server[27908] <0.229.0> - {"time":"2021-03-03T11:23:06.998466+01:00","level":"notice","msg":"Logging: configured log handlers are now ACTIVE","meta":{"domain":"rabbitmq.prelaunch","file":"src/rabbit_prelaunch_logging.erl","gl":"<0.228.0>","line":311,"mfa":["rabbit_prelaunch_logging","configure_logger",1],"pid":"<0.229.0>"}}

For quick testing, the values accepted by the `$RABBITMQ_LOGS`
environment variables were extended:
  * `-` still means stdout
  * `-stderr` means stderr
  * `syslog:` means syslog on localhost
  * `exchange:` means logging to `amq.rabbitmq.log`

`$RABBITMQ_LOG` was also extended. It now accepts a `+json` modifier (in
addition to the existing `+color` one). With that modifier, messages are
formatted as JSON intead of plain text.

The `rabbitmqctl rotate_logs` command is deprecated. The reason is
Logger does not expose a function to force log rotation. However, it
will detect when a file was rotated by an external tool.

From a developer point of view, the old `rabbit_log*` API remains
supported, though it is now deprecated. It is implemented as regular
modules: there is no `parse_transform` involved anymore.

In the code, it is recommended to use the new Logger macros. For
instance, `?LOG_INFO(Format, Args)`. If possible, messages should be
augmented with some metadata. For instance (note the map after the
message):

    ?LOG_NOTICE("Logging: switching to configured handler(s); following "
                "messages may not be visible in this log output",
                #{domain => ?RMQLOG_DOMAIN_PRELAUNCH}),

Domains in Erlang Logger parlance are the way to categorize messages.
Some predefined domains, matching previous categories, are currently
defined in `rabbit_common/include/logging.hrl` or headers in the
relevant plugins for plugin-specific categories.

At this point, very few messages have been converted from the old
`rabbit_log*` API to the new macros. It can be done gradually when
working on a particular module or logging.

The Erlang builtin console/file handler, `logger_std_h`, has been forked
because it lacks date-based file rotation. The configuration of
date-based rotation is identical to Lager. Once the dust has settled for
this feature, the goal is to submit it upstream for inclusion in Erlang.
The forked module is calld `rabbit_logger_std_h` and is based
`logger_std_h` in Erlang 23.0.
2021-03-11 15:17:36 +01:00
dcorbacho 61f7b2a723 Update to ranch 2.0 2021-03-08 23:11:05 +01:00
Michael Klishin b6c4831e75
Bump Lager to 3.9.1 2021-03-04 04:36:39 +03:00
Loïc Hoguin 66ac1bf5e9
Bump observer_cli to 1.6.1
More responsive when the system is overloaded with file calls.
2021-03-01 21:55:27 +03:00
Michael Klishin 8fe3df9343
Upgrade Lager to 3.9.0 for OTP 24 compatibility
`lager_util:expand_path/1` use changes are
due to erlang-lager/lager#540
2021-02-26 00:52:15 +03:00
Arnaud Cogoluègnes b39f4a6d1d
Set stream plugin default port to 5551
Instead of 5555, which is already registered.
2021-02-25 18:16:32 +01:00
Jean-Sébastien Pédron ba6059b1eb
rabbitmq_stream_management: Ignore more dirs created by `gmake dist` 2021-02-25 10:51:25 +01:00
Michael Klishin f73e851f9c
Bump observer_cli to 1.6.0 2021-02-24 12:53:55 +03:00
Michael Klishin a5098b28a7
Bump Lager to 3.8.2 for OTP 24 compatibility 2021-02-24 12:53:30 +03:00
Arnaud Cogoluègnes d63756ed67
Set correct offset metrics on stream consumer creation 2021-02-09 11:36:20 +01:00
Arnaud Cogoluègnes b921ac11a8
Merge pull request #2712 from rabbitmq/rabbitmq-stream-prometheus
Add stream prometheus plugin
2021-01-27 16:46:37 +01:00
Arnaud Cogoluègnes 268bc7257c
Merge pull request #2729 from rabbitmq/rabbitmq-stream-consumers-in-queue-details
Report stream consumers as regular consumers in management
2021-01-27 16:06:59 +01:00
Michael Klishin 52479099ec
Bump (c) year 2021-01-22 09:00:14 +03:00
Arnaud Cogoluègnes b88ad3d265
Adapt consumer link in queue details page
Depending on whether the "owner" of the consumer is a channel (for AMQP
consumers) or a connection (for stream consumers) and whether the stream
management plugin is enabled or not. The link will lead to the channel
page, the connection page, or the stream connection page.
2021-01-20 17:01:31 +01:00
Arnaud Cogoluègnes 78b723d7c3
Report stream consumers as regular consumers in management
This helps to see that a queue is consumed from.

WIP
2021-01-20 15:36:16 +01:00
Arnaud Cogoluègnes b5315c0166
Merge branch 'master' into rabbitmq-stream-prometheus 2021-01-18 11:26:06 +01:00
Arnaud Cogoluègnes 52aa2963f5
Bump test dependencies in stream plugins 2021-01-14 17:58:38 +01:00
Arnaud Cogoluègnes bf72683eb2
Add stream prometheus plugin 2021-01-11 16:49:56 +01:00
Arnaud Cogoluègnes 5f0df3bdb0
Format stream and stream management plugins code 2021-01-06 15:47:27 +01:00
Arnaud Cogoluègnes 07b9e68ff5
Add logs to some stream tests 2021-01-06 14:38:02 +01:00
Arnaud Cogoluègnes 7ce567962f
Add offset & consumed column to stream consumer in management 2020-12-15 16:17:55 +01:00
Arnaud Cogoluègnes c0bb7ec4a7
Add offset & consumed metrics to stream consumer 2020-12-15 15:37:26 +01:00
Arnaud Cogoluègnes 7bbbe3bb12
Add proper title to stream connections page 2020-12-09 09:29:47 +01:00
Arnaud Cogoluègnes fc816f857d
Make sure to return 404 in stream management plugin 2020-12-07 18:04:25 +01:00
Arnaud Cogoluègnes 9e1279434e
Add publishers in stream connection details page 2020-12-07 17:52:03 +01:00
Arnaud Cogoluègnes 22195f7934
Add stream connection publishers REST endpoint 2020-12-07 17:31:48 +01:00
Arnaud Cogoluègnes 8823bfa01a
Add consumers in stream connection details page 2020-12-07 16:50:26 +01:00
Arnaud Cogoluègnes 3f1d010ecd
Add stream connection consumers REST endpoint 2020-12-07 15:56:23 +01:00
Arnaud Cogoluègnes 2b45d8635b
Add publisher reference to stream endpoint 2020-12-07 10:17:01 +01:00
Arnaud Cogoluègnes 1faeaad499
Add publisher REST endpoint to stream consumer management 2020-12-04 17:22:14 +01:00
Arnaud Cogoluègnes c0779e6fa4
Filter records based on user in stream consumer endpoint 2020-12-02 11:37:56 +01:00
Arnaud Cogoluègnes 48b04e05a4
Add connection details to stream consumer endpoint 2020-12-02 10:52:13 +01:00
Arnaud Cogoluègnes 5f84e58cdd
Test stream consumers endpoint 2020-12-02 09:56:31 +01:00
Arnaud Cogoluègnes 41160210ab
Start stream consumer REST endpoint 2020-12-01 18:23:22 +01:00
Arnaud Cogoluègnes 98b339b38f
Get rid of unchecked warnings in Java test 2020-11-23 17:15:49 +01:00
Arnaud Cogoluègnes ad266d62fe
Remove system.out call 2020-11-23 16:58:44 +01:00
Arnaud Cogoluègnes ed12ae0bbf
Add permission tests for stream management 2020-11-23 16:32:14 +01:00
Arnaud Cogoluègnes 0d2bb8edb0
Remove unnecessary files 2020-11-23 11:29:13 +01:00
Arnaud Cogoluègnes 584811582b
Add first tests for stream management
They are using Java to have a proper stream client.
2020-11-23 11:23:29 +01:00
Arnaud Cogoluègnes a2f34a1bc9
Add connection endpoint to stream management 2020-11-20 16:24:02 +01:00
Arnaud Cogoluègnes 2b90c61d4d
Add connections/:vhost endpoint to stream management 2020-11-20 14:38:14 +01:00
Arnaud Cogoluègnes c8249a304f
Filter stream connections where metrics are disabled
This implied defining the protocol field in tracked connection to be
able to filter out non-stream connections.
2020-11-20 09:29:55 +01:00
Arnaud Cogoluègnes e516aab737
Display only stream connections in plugin 2020-11-19 17:02:35 +01:00
Arnaud Cogoluègnes 23d7e8114c
Introduce stream management plugin 2020-11-19 14:48:25 +01:00