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 proposal for integrating Bridge with Metrics Reporter #143

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

Conversation

fvaleri
Copy link
Contributor

@fvaleri fvaleri commented Dec 19, 2024

Add proposal for integrating Bridge with Metrics Reporter.

@fvaleri fvaleri requested review from mimaison, OwenCorrigan76 and a team December 19, 2024 15:41
090-integrate-bridge-with-metrics-reporter.md Show resolved Hide resolved
090-integrate-bridge-with-metrics-reporter.md Outdated Show resolved Hide resolved
090-integrate-bridge-with-metrics-reporter.md Outdated Show resolved Hide resolved
090-integrate-bridge-with-metrics-reporter.md Outdated Show resolved Hide resolved
090-integrate-bridge-with-metrics-reporter.md Outdated Show resolved Hide resolved
090-integrate-bridge-with-metrics-reporter.md Outdated Show resolved Hide resolved
090-integrate-bridge-with-metrics-reporter.md Outdated Show resolved Hide resolved
Signed-off-by: Federico Valeri <[email protected]>
@fvaleri
Copy link
Contributor Author

fvaleri commented Dec 20, 2024

@ppatierno thanks for the review. I reworked the proposal to always present the Bridge changes first, and addressed the other comments.

@fvaleri fvaleri force-pushed the bridge-metrics branch 5 times, most recently from 7507129 to e9bb397 Compare December 20, 2024 17:01
Signed-off-by: Federico Valeri <[email protected]>
@fvaleri fvaleri requested a review from a team January 3, 2025 09:37
Signed-off-by: Federico Valeri <[email protected]>
090-integrate-bridge-with-metrics-reporter.md Outdated Show resolved Hide resolved
090-integrate-bridge-with-metrics-reporter.md Outdated Show resolved Hide resolved
090-integrate-bridge-with-metrics-reporter.md Outdated Show resolved Hide resolved
090-integrate-bridge-with-metrics-reporter.md Outdated Show resolved Hide resolved
090-integrate-bridge-with-metrics-reporter.md Show resolved Hide resolved
Signed-off-by: Federico Valeri <[email protected]>
Signed-off-by: Federico Valeri <[email protected]>
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.

The overall approach makes sense.
I left a few suggestions, including a couple of questions where I wasn't clear on parts of the proposal.

090-integrate-bridge-with-metrics-reporter.md Outdated Show resolved Hide resolved
090-integrate-bridge-with-metrics-reporter.md Outdated Show resolved Hide resolved
090-integrate-bridge-with-metrics-reporter.md Outdated Show resolved Hide resolved
090-integrate-bridge-with-metrics-reporter.md Outdated Show resolved Hide resolved
090-integrate-bridge-with-metrics-reporter.md Outdated Show resolved Hide resolved
090-integrate-bridge-with-metrics-reporter.md Outdated Show resolved Hide resolved
090-integrate-bridge-with-metrics-reporter.md Outdated Show resolved Hide resolved
090-integrate-bridge-with-metrics-reporter.md Outdated Show resolved Hide resolved
090-integrate-bridge-with-metrics-reporter.md Outdated Show resolved Hide resolved
090-integrate-bridge-with-metrics-reporter.md Outdated Show resolved Hide resolved
Signed-off-by: Federico Valeri <[email protected]>
@fvaleri
Copy link
Contributor Author

fvaleri commented Jan 15, 2025

@ppatierno and @PaulRMellor your comments should be addressed, but let me know if you have any other concern. It would also be good to get some more feedback from other maintainers. Thanks.

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.

Updates look good 👍

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.

090-integrate-bridge-with-metrics-reporter.md Outdated Show resolved Hide resolved
Comment on lines 61 to 67
```sh
# uncomment the following lines to enable Strimzi Reporter metrics, check the documentation for more details
bridge.metrics=strimziMetricsReporter #1
kafka.metric.reporters=io.strimzi.kafka.metrics.KafkaPrometheusMetricsReporter #2
kafka.prometheus.metrics.reporter.listener.enable=false #3
kafka.prometheus.metrics.reporter.allowlist=.* #4
```
Copy link
Member

Choose a reason for hiding this comment

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

Why does the user need to set the bridge.metrics when they need to also configure the rest of the details? I get the allow list. But why are the reporter and the listener not done automatically?

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 this part of the properties file is an example when the bridge is used on bare metal/vm. In such a case, it's the user to provide the entire configuration (their own application.properties file). The bridge itself doesn't never change the config file on startup to add "something" to it.
One thing we could imagine is that the bridge doesn't update the file but add these value at runtime (in memory) when configuring the internal Kafka clients. My only doubt is that it won't be reflected in what the user configured so the user doesn't know about that.

Copy link
Contributor Author

@fvaleri fvaleri Jan 17, 2025

Choose a reason for hiding this comment

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

We can use the same logic that we have in the Operator, with locked down Reporter configuration and a new bridge.metrics.reporter.allowlist property.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe I missed some of the arguments you are trying to make and maybe my comment was not clear, sorry. It of course does not matter when the operator configures it. But when I configure it myself, why do I need to set both

bridge.metrics=strimziMetricsReporter #1
kafka.metric.reporters=io.strimzi.kafka.metrics.KafkaPrometheusMetricsReporter #2

They seem to do the same - enable the Strimzi metrics reporter, or? So what is the difference between them?

Copy link
Contributor Author

@fvaleri fvaleri Jan 20, 2025

Choose a reason for hiding this comment

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

The bridge.metrics property is the analogous of the metricsConfig.type field we have in the CO schemas. Maybe the property name is confusing, but it was inspired by the already existing bridge.tracing. It will be used to initialize the Bridge's MetricsRporter with the right CollectorRegistry.

The kafka.metric.reporters property is the Kafka metric.reporters configuration with the kafka. prefix that must be used to pass shared Kafka configurations (they are applied to all internal clients).

Copy link
Member

Choose a reason for hiding this comment

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

But why do we need the user to configure both? You say it is analogous of the metricsConfig.type field -> but there you configure only the metricsConfig.type field.

Copy link
Contributor Author

@fvaleri fvaleri Jan 20, 2025

Choose a reason for hiding this comment

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

I see what you mean. I think we can improve the design using default values for kafka.metric.reporters and kafka.prometheus.metrics.reporter.listener.enable to be used as fallback when not set. This is similar to what I describe for bridge.metrics.exporter.config.path. The example application.properties would be:

# uncomment the following line to enable JMX Prometehus Exporter, check the documentation for more details
#bridge.metrics=jmxPrometheusExporter
# optionally, you can also set a custom configuration file
#bridge.metrics.exporter.config.path=/path/to/my-exporter-config.yaml

# uncomment the following line to enable Strimzi Metrics Reporter, check the documentation for more details
#bridge.metrics=strimziMetricsReporter
# optionally, you can filter the exposed metrics using a list of regexes
#kafka.prometheus.metrics.reporter.allowlist=.*

090-integrate-bridge-with-metrics-reporter.md Outdated Show resolved Hide resolved
Comment on lines 94 to 97
values:
allowList:
- "kafka_log.*"
- "kafka_network.*"
Copy link
Member

Choose a reason for hiding this comment

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

This should probably have some defaults to match what we / our sample dashabords need.

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, the default is .*. Example updated.

Copy link
Member

Choose a reason for hiding this comment

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

That is not really what I meant. And it relates to the PR from @OwenCorrigan76 as well. I think we should choose one of the ways here:

  1. Make the allowList required
  2. Have a good default for them for each component. (And I guess .* is not the right default) This would be hardcoded in the code base and change as we for example update our dashabords.

Having a flat default .* everywhere is IMHO a bad option, because historically our experience is that users want to limit the metrics exporter:

  • For performance reasons in Kafka (this might improve with our own reporter, but I expect it would still be an issue at some amount of metrics)
  • For performance reasons in Prometheus (the metrics can be dropped by Prometheus after scraping, but that is inefficient and harder to configure)

Copy link
Contributor Author

@fvaleri fvaleri Jan 20, 2025

Choose a reason for hiding this comment

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

I think having good defaults is better. I will look into that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bridge defaults added. We will address the other components in the related PRs.

090-integrate-bridge-with-metrics-reporter.md Outdated Show resolved Hide resolved
090-integrate-bridge-with-metrics-reporter.md Outdated Show resolved Hide resolved
090-integrate-bridge-with-metrics-reporter.md Outdated Show resolved Hide resolved
Signed-off-by: Federico Valeri <[email protected]>
Signed-off-by: Federico Valeri <[email protected]>
Signed-off-by: Federico Valeri <[email protected]>
Signed-off-by: Federico Valeri <[email protected]>
Signed-off-by: Federico Valeri <[email protected]>
@fvaleri
Copy link
Contributor Author

fvaleri commented Jan 21, 2025

@scholzj I think I addressed all your comments, let me know what you think. Thanks.

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.

Two nits. But LGTM otherwise. Thanks.


#### Migration

When `enableMetrics` will be removed, *Exporter* users will have to create a secret with its configuration, and reference the secret as shown in the following example:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
When `enableMetrics` will be removed, *Exporter* users will have to create a secret with its configuration, and reference the secret as shown in the following example:
When `enableMetrics` will be removed, *Exporter* users will have to create a config map with its configuration, and reference it as shown in the following example:

key: my-metrics-config.yml
```

A full example that include the *Exporter* configuration secret will be provided.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
A full example that include the *Exporter* configuration secret will be provided.
A full example that include the *Exporter* configuration config map will be provided.

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.

6 participants