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

Add support for Strimzi Metrics Reporter #954

Merged
merged 3 commits into from
Feb 20, 2025

Conversation

fvaleri
Copy link
Contributor

@fvaleri fvaleri commented Dec 17, 2024

This patch adds support for metrics types configuration, integrating the Strimzi Metrics Reporter, and custom Prometheus JMX Exporter configuration. The custom configuration feature is needed for Cluster Operator integration, but it can also be leveraged by standalone users. See proposal 43 for more details.

@fvaleri fvaleri requested a review from ppatierno December 17, 2024 09:26
@fvaleri
Copy link
Contributor Author

fvaleri commented Dec 17, 2024

@OwenCorrigan76 @mimaison fyi

Copy link

@mimaison mimaison left a comment

Choose a reason for hiding this comment

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

I've not looked at the code yet. I left comments trying to understand how this will be used.

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.

I wonder if this should go through a dedicated proposal first. The original proposal - https://github.com/strimzi/proposals/blob/main/064-prometheus-metrics-reporter.md - sadly didn't cover the bridge in sufficient depth and there will be some backward compatibility impact here or in the operators repo that needs to be carefully considered. A proposal would be the right place to discuss it and decide on the best approach.

@fvaleri
Copy link
Contributor Author

fvaleri commented Dec 17, 2024

there will be some backward compatibility impact here or in the operators repo that needs to be carefully considered

I agree. @ppatierno wdyt?

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.

I left just some minor comments but I will review it again when the proposal is accepted (to avoid reviewing now something that will be changed later by the final proposal)

@fvaleri fvaleri force-pushed the bridge-metrics-rep branch from 8b9e345 to d0eedcd Compare January 2, 2025 08:04
@fvaleri fvaleri added this to the 0.32.0 milestone Jan 2, 2025
@fvaleri fvaleri force-pushed the bridge-metrics-rep branch from ddabfb1 to 5084403 Compare January 17, 2025 17:42
@fvaleri fvaleri changed the title Add support for the Strimzi Metrics Reporter Add support for for metrics types configuration Jan 24, 2025
@fvaleri fvaleri changed the title Add support for for metrics types configuration Add support for Strimzi Metrics Reporter Jan 24, 2025
@fvaleri fvaleri force-pushed the bridge-metrics-rep branch from 395ceda to 01d1b74 Compare January 24, 2025 17:29
@fvaleri
Copy link
Contributor Author

fvaleri commented Jan 27, 2025

@strimzi/maintainers proposal 92 has been accepted, and this PR is aligned, so open for review. Thanks.

/**
* @return the metric system to be used in the bridge
*/
public String getMetrics() {
Copy link
Member

Choose a reason for hiding this comment

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

+1

@fvaleri
Copy link
Contributor Author

fvaleri commented Feb 7, 2025

@ppatierno @scholzj your comments should be addressed, but there are a few open questions. For the new abstraction I used the MetricsCollector name, as MetricsReporter would create some confusion IMO. Let me know what you think.

@ppatierno
Copy link
Member

@fvaleri can you resolve the conflicts before I have another pass please?

@fvaleri
Copy link
Contributor Author

fvaleri commented Feb 13, 2025

Which kind of validation/spotpug error? We don't get any right now in the main. This refactoring seems to be useless from a pure code perspective.

[INFO] --- spotbugs:4.7.3.0:check (default-cli) @ kafka-bridge ---
[INFO] BugInstance size is 3
[INFO] Error size is 0
[INFO] Total bugs: 3
[ERROR] Low: Private method io.strimzi.kafka.bridge.http.HttpBridge.contentTypeToFormat(String) is never called [io.strimzi.kafka.bridge.http.HttpBridge] At HttpBridge.java:[lines 644-652] UPM_UNCALLED_PRIVATE_METHOD
[ERROR] High: Found reliance on default encoding in io.strimzi.kafka.bridge.http.converter.HttpTextMessageConverter.toKafkaRecord(String, Integer, byte[]): String.getBytes() [io.strimzi.kafka.bridge.http.converter.HttpTextMessageConverter, io.strimzi.kafka.bridge.http.converter.HttpTextMessageConverter] At HttpTextMessageConverter.java:[line 46]Another occurrence at HttpTextMessageConverter.java:[line 53] DM_DEFAULT_ENCODING
[ERROR] High: Found reliance on default encoding in io.strimzi.kafka.bridge.http.converter.HttpTextMessageConverter.toMessages(ConsumerRecords): new String(byte[]) [io.strimzi.kafka.bridge.http.converter.HttpTextMessageConverter, io.strimzi.kafka.bridge.http.converter.HttpTextMessageConverter] At HttpTextMessageConverter.java:[line 104]Another occurrence at HttpTextMessageConverter.java:[line 105] DM_DEFAULT_ENCODING

Again, why it's not happening today in the main?

I see these errors on the main branch too. Just tried with a fresh clone.

@ppatierno
Copy link
Member

ppatierno commented Feb 13, 2025

I see these errors on the main branch too. Just tried with a fresh clone.

Ok so I see another issue here. Our make all is not running the spotbugs target automatically and it should be fixed.
@fvaleri could you remove these changes from this PR, and opening a new one where you have those fixes and adding spotbugs as target during the make all process so that it also runs in the Azure and Travis CI pipeline please?
Then, after merging it, you can rebase this one. I am trying to have a separation of concerns here. Thanks!

@fvaleri
Copy link
Contributor Author

fvaleri commented Feb 13, 2025

Our make all is not running the spotbugs target automatically and it should be fixed.

The CO build does not run spotbugs as part of the all target, do we want the Bridge to be different? I can still open a dedicated PR for the spotbugs fixes, but maybe without the all target change. Just let me know.

Maybe it's the CI that should be modified to run make spotbugs? Let me check.

@ppatierno
Copy link
Member

The CO build does not run spotbugs as part of the all target, do we want the Bridge to be different? I can still open a dedicated PR for the spotbugs fixes, but maybe without the all target change. Just let me know.
Maybe it's the CI that should be modified to run make spotbugs? Let me check.

Tbh I am confused now. The CO runs spotbugs as part of the Azure pipeline you are right but AFAICS it's the same for the bridge if you look at here https://github.com/strimzi/strimzi-kafka-bridge/blob/main/.azure/templates/jobs/build_java.yaml#L27
Also, last Azure runs shows no error from spotbugs https://dev.azure.com/cncf/strimzi/_build/results?buildId=183109&view=logs&j=2de397de-21fc-5e8b-587d-4865bafb3e06&t=f78e572c-4a87-5c91-14d8-0dcc4e3d1286

@scholzj
Copy link
Member

scholzj commented Feb 16, 2025

@scholzj do you have anything to add here? so we can proceed with merging it?

You do not have the sufficient number of approvals, so you cannot proceed with merging it regardless of what I think.

@ppatierno
Copy link
Member

I think you totally mislead what I meant. I just meant if you have anything to add which means review, leaving comments and/or approving. Then we can proceed. I wasn't going to merge without another approval, I know the rules. But because you reviewed this PR already I was just asking if you had anything more.

@ppatierno
Copy link
Member

Adding that even if any other maintainer would have approved it, I was anyway going to ask you if you had anything to add despite I had all the rights to merge.

@fvaleri fvaleri requested a review from scholzj February 17, 2025 10:52
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. I left just one (hopefully last) nit. Thanks!

@fvaleri fvaleri force-pushed the bridge-metrics-rep branch 2 times, most recently from a6e0a77 to 5897639 Compare February 17, 2025 17:07
@scholzj scholzj requested review from PaulRMellor and removed request for scholzj February 19, 2025 00:12
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.

Few more nits and questions -> but nothing major anymore.

@ppatierno
Copy link
Member

@fvaleri other than resolving the remaining comments could you also rebase please? We have the fix for the Travis CI pipeline in main now. Thanks!

This patch adds support for metrics types configuration, integrating the Strimzi Metrics Reporter, and custom Prometheus JMX Exporter configuration.
The custom configuration feature is needed for Cluster Operator integration, but it can also be leveraged by standalone users.
See Proposal 43 for more details.

Signed-off-by: Federico Valeri <[email protected]>
@fvaleri fvaleri force-pushed the bridge-metrics-rep branch 2 times, most recently from f9eea03 to fcc70d4 Compare February 19, 2025 10:36
@fvaleri fvaleri requested a review from scholzj February 19, 2025 10:49
Signed-off-by: Federico Valeri <[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. LGTM.

Copy link
Contributor

@PaulRMellor PaulRMellor left a comment

Choose a reason for hiding this comment

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

Thanks Fede.
I left a few comments on the docs.

Comment on lines 9 to 11
Configure a deployment of the Kafka Bridge using configuration properties.
Configure Kafka and specify the HTTP connection details needed to be able to interact with Kafka.
It is possible to enable metrics in Prometheus format with Prometheus JMX Exporter or Strimzi Metrics Reporter.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Configure a deployment of the Kafka Bridge using configuration properties.
Configure Kafka and specify the HTTP connection details needed to be able to interact with Kafka.
It is possible to enable metrics in Prometheus format with Prometheus JMX Exporter or Strimzi Metrics Reporter.
Configure a deployment of the Kafka Bridge with Kafka-related properties and specify the HTTP connection details needed to be able to interact with Kafka.
Additionally, enable metrics in Prometheus format using either the Prometheus JMX Exporter or the Strimzi Metrics Reporter.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any difference/advantage to using one over the other that we should point out?

Copy link
Contributor Author

@fvaleri fvaleri Feb 20, 2025

Choose a reason for hiding this comment

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

There are, I'm adding links so users can find them easily and we don't need to update the doc.

@fvaleri
Copy link
Contributor Author

fvaleri commented Feb 20, 2025

@PaulRMellor thanks for the great suggestions. Let me know if there is still some doc improvement or issue.

Copy link
Contributor

@PaulRMellor PaulRMellor left a comment

Choose a reason for hiding this comment

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

Thanks for dressing the comments, Fede.
Just a few nits as I re-read.

Signed-off-by: Federico Valeri <[email protected]>
@ppatierno
Copy link
Member

@fvaleri thanks again for your work!

@ppatierno ppatierno merged commit 403bd27 into strimzi:main Feb 20, 2025
12 checks passed
@fvaleri fvaleri deleted the bridge-metrics-rep branch February 20, 2025 12:54
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.

5 participants