Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented simple metrics reporter #3066

Merged

Conversation

mmaslankaprv
Copy link
Member

@mmaslankaprv mmaslankaprv commented Nov 24, 2021

Cover letter

Implemented simple metrics reporter.

Fixes: #2707

Release notes

@mmaslankaprv mmaslankaprv changed the title Simple metrics reporter Implemented simple metrics reporter Nov 24, 2021
@mmaslankaprv mmaslankaprv marked this pull request as draft November 24, 2021 11:19
@mmaslankaprv mmaslankaprv marked this pull request as ready for review November 24, 2021 18:47
@mmaslankaprv mmaslankaprv force-pushed the simple-metrics-reporter branch 2 times, most recently from 99ce58d to 79516d4 Compare November 25, 2021 10:16
Copy link
Member

@dotnwat dotnwat left a comment

Choose a reason for hiding this comment

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

looks awesome. a few minor comments

src/v/cluster/metrics_reporter.cc Show resolved Hide resolved
src/v/cluster/metrics_reporter.cc Outdated Show resolved Hide resolved
src/v/cluster/metrics_reporter.cc Show resolved Hide resolved
Comment on lines 83 to 84
static constexpr std::string_view host = "m.rp.vectorized.io";
static constexpr std::string_view path = "v2";
Copy link
Member

@dotnwat dotnwat Dec 1, 2021

Choose a reason for hiding this comment

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

if we use a configuration value for this then it will be straight forward to write a duck tape test. a web server can be spun up in a few lines of python: https://docs.python.org/3/library/http.server.html and we could wrap that in a duck tape background service. then arrange for the configuration to dial home to our wrapper web server.

Copy link
Member Author

Choose a reason for hiding this comment

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

i've made the url configurable, will add ducktape test in follow up PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added test for metrics reporter in ducktape

src/v/cluster/metrics_reporter.cc Outdated Show resolved Hide resolved
@dotnwat
Copy link
Member

dotnwat commented Dec 1, 2021

mmaslankaprv requested a review from dotnwat 10 hours ago is ambiguous since it looks like nothing new was pushed. are you saying you don't want to change anything?

@mmaslankaprv mmaslankaprv force-pushed the simple-metrics-reporter branch 2 times, most recently from 9a3336e to 7f4ea57 Compare December 2, 2021 10:18
src/v/cluster/metrics_reporter.cc Outdated Show resolved Hide resolved
Copy link
Contributor

@jcsp jcsp left a comment

Choose a reason for hiding this comment

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

Sorry I'm a bit late looking at this -- just a couple of comments (also I was going to make the same suggestion as Noah to add a webserver stub in ducktape to test this)

src/v/config/configuration.cc Outdated Show resolved Hide resolved
src/v/config/configuration.cc Show resolved Hide resolved
reader_cfg.type_filter = model::record_batch_type::raft_configuration;
auto reader = co_await _raft0->make_reader(reader_cfg);

auto batches = co_await model::consume_reader_to_memory(
Copy link
Contributor

Choose a reason for hiding this comment

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

Calling with no_timeout, is it abortable some other way if this is running during shutdown?

Copy link
Member Author

Choose a reason for hiding this comment

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

it is not, but this is going to be really fast since there are only two batches, and they are very small.

Copy link
Member

@dotnwat dotnwat left a comment

Choose a reason for hiding this comment

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

looks good. nothing major from me, but a couple test suggestions. I think John had a good point about configuration option naming, and he might also want to take a peek at the duck tape tests.

tests/rptest/services/http_server.py Outdated Show resolved Hide resolved
tests/rptest/services/http_server.py Outdated Show resolved Hide resolved
src/v/cluster/metrics_reporter.cc Outdated Show resolved Hide resolved
@mmaslankaprv mmaslankaprv force-pushed the simple-metrics-reporter branch 2 times, most recently from 68393d2 to 7c1aa8e Compare December 8, 2021 11:57
@jcsp
Copy link
Contributor

jcsp commented Dec 8, 2021

New tests LGTM apart from one stray line. Looks like this has a consistent failure in WaitForLocalConsumerTest though, I haven't spotted what part of the test changes might be triggering that :-/

When connecting to remote endpoint `rpc::transport::connect` caller
should take care of error logging. Adding warning log entry every time
connection failed may be very noisy in some scenarios f.e. retries.

Signed-off-by: Michal Maslanka <michal@vectorized.io>
Signed-off-by: Michal Maslanka <michal@vectorized.io>
Implemented simple service that will gather most important cluster
metrics and send them periodically to given URL address. The metrics are
sent only from the cluster controller and contain information about all
the nodes.

Signed-off-by: Michal Maslanka <michal@vectorized.io>
Signed-off-by: Michal Maslanka <michal@vectorized.io>
Signed-off-by: Michal Maslanka <michal@vectorized.io>
Signed-off-by: Michal Maslanka <michal@vectorized.io>
Added simple http server background service printing each received
request to stdout. Requests can be accessed and verified afterwards.

Signed-off-by: Michal Maslanka <michal@vectorized.io>
Signed-off-by: Michal Maslanka <michal@vectorized.io>
Added `-f` flag to `kaf` consumer background service. Without the flag
kaf exits immediately when there are no messages in topic

Signed-off-by: Michal Maslanka <michal@vectorized.io>
@mmaslankaprv mmaslankaprv added this to the v21.11.2 milestone Dec 8, 2021
@mmaslankaprv mmaslankaprv merged commit bd6335c into redpanda-data:dev Dec 8, 2021
@twmb
Copy link
Contributor

twmb commented Dec 13, 2021

Does this need docs updates?

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move usage stats reporting into redpanda
4 participants