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

Proposal for splitting metrics-reporter into modules #147

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mimaison
Copy link
Contributor

This proposes splitting the metrics-reporter project into client and server modules so it's easier to evolve in the future.

Copy link
Contributor

@fvaleri fvaleri left a comment

Choose a reason for hiding this comment

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

Thanks @mimaison. I don't see a huge impact on the ongoing efforts, assuming this proposal is approved and we will have a release soon after. Can you clarify this in the proposal?


I propose splitting the project into 2 Java modules:

1. `client-metrics-reporter`: This module will only depend on kafka-clients and the Prometheus libraries. It will be used by Apache Kafka clients (Producer, Admin, Consumer, Connect and Streams) by setting the `metric.reporters` configuration to `io.strimzi.kafka.metrics.ClientMetricsReporter`. All the existing metrics-reporter configurations will stay the same. The differences are:
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not KafkaClientMetricsReporter, KafkaServerMetricsReporter and YammerServerMetricsReporter? It just reads better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Happy to change the names if people prefer your suggestions. The original names also included Prometheus, I decided to drop it to have shorter names, but some people may prefer keeping that.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can add prometheus to the package name? That would keep E.g. io.strimzi.kafka.metrics.prometheus.ClientMetricsReporter. (I suspect we might need other technologies as well one (maybe not so distant) day :-/)

Copy link
Contributor

Choose a reason for hiding this comment

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

we might need other technologies as well

In that case, I would expect a config parameter to configure the output format with a default value set to Prometheus for backwards compatibility.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we are to add extra reporters in the future, I expect users would pick the format by using different classes. For example if you use io.strimzi.kafka.metrics.prometheus.ClientMetricsReporter the export format is Prometheus. So I wouldn't add a new configuration to the reporter itself.

Copy link
Member

Choose a reason for hiding this comment

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

You should probably clarify what exactly are you talking about.

Copy link
Member

Choose a reason for hiding this comment

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

I assume that @mimaison metns that instead of having io.strimzi.metrics-reporter-0.1.0.jar as today, we would have io.strimzi.prometheus.metrics-reporter-0.2.0.jar instead. In the future, a different implementation would have a separate artifact with a different name (replacing "prometheus" with something else). This way if you want to use just the prometheus one you can get only the specific dependency and not bringing with you stuff which is unrelated but belongs to a different implementation.

Copy link
Member

Choose a reason for hiding this comment

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

I would not expect different modules for different implementations. So I would avoid this.

Copy link
Member

Choose a reason for hiding this comment

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

In any case if you decide to include Prometheus in the module name, it should absolutely not be in the group ID but only in the artifact ID.

Copy link
Member

Choose a reason for hiding this comment

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

I guess that nobody knows how many dependencies would be useful or useless in different implementations. Also in what point in the future should we add another implementation? Having the name in the artifacts and modules now would look like there is another JAR containing different implementation (even if there is just Prometheus one).

I'm fine with adding prometheus package. For changing the names of the module and artifact - it could be changed in the future when another implementations will be added and the split will be needed, right?

093-split-metrics-reporter-into-modules.md Show resolved Hide resolved
093-split-metrics-reporter-into-modules.md Outdated Show resolved Hide resolved
093-split-metrics-reporter-into-modules.md Outdated Show resolved Hide resolved

I propose splitting the project into 2 Java modules:

1. `client-metrics-reporter`: This module will only depend on kafka-clients and the Prometheus libraries. It will be used by Apache Kafka clients (Producer, Admin, Consumer, Connect and Streams) by setting the `metric.reporters` configuration to `io.strimzi.kafka.metrics.ClientMetricsReporter`. All the existing metrics-reporter configurations will stay the same. The differences are:
Copy link
Member

Choose a reason for hiding this comment

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

Can you please clarify how this will work for Connect / MM2? They use a lot of clients. But they also have their own metrics (connectors and tasks and their state, etc.). So it seems like the client reporter is not enough to provide these, or?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The Connect runtime and Streams are considered clients. To collect their metrics you would still follow the instructions from https://github.com/strimzi/metrics-reporter?tab=readme-ov-file#kafka-connect-and-kafka-streams but use io.strimzi.kafka.metrics.ClientMetricsReporter as the class name.

Copy link
Member

Choose a reason for hiding this comment

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

So essentially, when used in Connect, the client reporter will automatically handle the additional Connect metrics as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, like io.strimzi.kafka.metrics.KafkaPrometheusMetricsReporter does at the moment.

Co-authored-by: Jakub Scholz <[email protected]>
Signed-off-by: Mickael Maison <[email protected]>

I propose splitting the project into 2 Java modules:

1. `client-metrics-reporter`: This module will only depend on kafka-clients and the Prometheus libraries. It will be used by Apache Kafka clients (Producer, Admin, Consumer, Connect and Streams) by setting the `metric.reporters` configuration to `io.strimzi.kafka.metrics.ClientMetricsReporter`. All the existing metrics-reporter configurations will stay the same. The differences are:
Copy link
Member

@ppatierno ppatierno Jan 28, 2025

Choose a reason for hiding this comment

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

AFAIK, there is Prometheus Agent which is able to use the push-based model so writing metrics remotely as well.
Regarding the naming I am fine with ClientMetricsReporter but maybe within a prometheus package as suggested. It would be clearly Kafka even because the FQDM has kafka in the package as well.

093-split-metrics-reporter-into-modules.md Show resolved Hide resolved
Copy link
Member

@tombentley tombentley left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @mimaison

Signed-off-by: Mickael Maison <[email protected]>
Copy link
Member

@scholzj scholzj left a comment

Choose a reason for hiding this comment

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

Thanks @mimaison. +1 binding.

Copy link
Member

@ppatierno ppatierno left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks Mickael!
When this proposal is approved and merged we should try to have the implementation and the release done before a new operator and bridge release so that we don't need to make breaking changes as described in your compatibility section imho.

@mimaison
Copy link
Contributor Author

I have most of the code ready, so I should be able to open a PR next week.

Copy link
Contributor

@fvaleri fvaleri left a comment

Choose a reason for hiding this comment

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

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants