-
-
Notifications
You must be signed in to change notification settings - Fork 30
debezium/dbz#1897 Add support for exposing Pipelines metrics to Prometheus via OTel Collector #409
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
Open
mfvitale
wants to merge
6
commits into
debezium:main
Choose a base branch
from
mfvitale:dbz#1897
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d819834
debezium/dbz#1897 Add support for exposing Pipelines metrics to Prome…
mfvitale 845d5ce
debezium/dbz#1897 Add comment on configuration interface
mfvitale 58c617e
debezium/dbz#1897 Add new Platform screenshot
mfvitale 6d447d3
debezium/dbz#1897 Improve README.md
mfvitale 89e5ff3
debezium/dbz#1897 Add strategy for the metric builder
mfvitale 0c9f1a8
debezium/dbz#1897 Create Metrics object with a producer
mfvitale File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...m-platform-conductor/src/main/java/io/debezium/platform/config/MonitoringConfigGroup.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| /* | ||
| * Copyright Debezium Authors. | ||
| * | ||
| * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
| */ | ||
| package io.debezium.platform.config; | ||
|
|
||
| import java.util.Optional; | ||
|
|
||
| /** | ||
| * Configuration group for monitoring and observability features. | ||
| * <p> | ||
| * This interface defines the configuration structure for enabling and configuring | ||
| * monitoring capabilities in the Debezium Platform, including OpenTelemetry integration | ||
| * for metrics collection and export. | ||
| * </p> | ||
| * | ||
| * @author Debezium Authors | ||
| */ | ||
| public interface MonitoringConfigGroup { | ||
|
|
||
| /** | ||
| * Returns the OpenTelemetry configuration group. | ||
| * | ||
| * @return the OpenTelemetry configuration settings | ||
| */ | ||
| OtelConfigGroup otel(); | ||
|
|
||
| /** | ||
| * Configuration group for OpenTelemetry (OTel) integration. | ||
| * <p> | ||
| * Defines settings for enabling and configuring OpenTelemetry metrics collection | ||
| * and export. When enabled, the platform will expose metrics that can be sent to an | ||
| * OpenTelemetry Collector endpoint. | ||
| * </p> | ||
| */ | ||
| interface OtelConfigGroup { | ||
| /** | ||
| * Indicates whether OpenTelemetry metrics collection is enabled. | ||
| * | ||
| * @return {@code true} if OpenTelemetry is enabled, {@code false} otherwise | ||
| */ | ||
| boolean enabled(); | ||
|
|
||
| /** | ||
| * Returns the OpenTelemetry Collector endpoint URL. | ||
| * <p> | ||
| * This endpoint is used to export metrics to an OpenTelemetry Collector. | ||
| * </p> | ||
| * | ||
| * @return an {@link Optional} containing the endpoint URL if configured, or empty if not set | ||
| */ | ||
| Optional<String> endpoint(); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
.../src/main/java/io/debezium/platform/environment/operator/metrics/JmxExporterStrategy.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| /* | ||
| * Copyright Debezium Authors. | ||
| * | ||
| * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
| */ | ||
| package io.debezium.platform.environment.operator.metrics; | ||
|
|
||
| import jakarta.enterprise.context.ApplicationScoped; | ||
|
|
||
| import io.debezium.operator.api.model.runtime.metrics.JmxExporterBuilder; | ||
| import io.debezium.operator.api.model.runtime.metrics.MetricsBuilder; | ||
| import io.debezium.platform.config.PipelineConfigGroup; | ||
|
|
||
| /** | ||
| * Strategy for configuring JMX metrics exporter. | ||
| * JMX exporter is typically always enabled for monitoring Java applications. | ||
| */ | ||
| @ApplicationScoped | ||
| public class JmxExporterStrategy implements MetricsExporterStrategy { | ||
|
|
||
| @Override | ||
| public boolean isApplicable(PipelineConfigGroup config) { | ||
| // JMX is always enabled by default for backward compatibility | ||
| // Remove once the Monitor feature is completed e2e | ||
| return true; | ||
| } | ||
|
|
||
| @Override | ||
| public void apply(MetricsBuilder metricsBuilder, PipelineConfigGroup config) { | ||
| metricsBuilder.withJmxExporter( | ||
| new JmxExporterBuilder() | ||
| .withEnabled() | ||
| .build()); | ||
| } | ||
| } |
33 changes: 33 additions & 0 deletions
33
.../main/java/io/debezium/platform/environment/operator/metrics/MetricsExporterStrategy.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /* | ||
| * Copyright Debezium Authors. | ||
| * | ||
| * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
| */ | ||
| package io.debezium.platform.environment.operator.metrics; | ||
|
|
||
| import io.debezium.operator.api.model.runtime.metrics.MetricsBuilder; | ||
| import io.debezium.platform.config.PipelineConfigGroup; | ||
|
|
||
| /** | ||
| * Strategy interface for configuring different metrics exporters. | ||
| * Implementations of this interface encapsulate the logic for determining | ||
| * whether a specific metrics exporter should be enabled and how to configure it. | ||
| */ | ||
| public interface MetricsExporterStrategy { | ||
|
|
||
| /** | ||
| * Determines if this metrics exporter should be enabled based on the pipeline configuration. | ||
| * | ||
| * @param config the pipeline configuration | ||
| * @return true if this exporter should be applied, false otherwise | ||
| */ | ||
| boolean isApplicable(PipelineConfigGroup config); | ||
|
|
||
| /** | ||
| * Applies this exporter's configuration to the metrics builder. | ||
| * | ||
| * @param metricsBuilder the metrics builder to configure | ||
| * @param config the pipeline configuration containing exporter-specific settings | ||
| */ | ||
| void apply(MetricsBuilder metricsBuilder, PipelineConfigGroup config); | ||
| } |
39 changes: 39 additions & 0 deletions
39
...ctor/src/main/java/io/debezium/platform/environment/operator/metrics/MetricsProducer.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| /* | ||
| * Copyright Debezium Authors. | ||
| * | ||
| * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
| */ | ||
| package io.debezium.platform.environment.operator.metrics; | ||
|
|
||
| import jakarta.enterprise.context.ApplicationScoped; | ||
| import jakarta.enterprise.inject.Instance; | ||
| import jakarta.enterprise.inject.Produces; | ||
| import jakarta.inject.Inject; | ||
|
|
||
| import io.debezium.operator.api.model.runtime.metrics.Metrics; | ||
| import io.debezium.operator.api.model.runtime.metrics.MetricsBuilder; | ||
| import io.debezium.platform.config.PipelineConfigGroup; | ||
|
|
||
| @ApplicationScoped | ||
| public class MetricsProducer { | ||
|
|
||
| private final Instance<MetricsExporterStrategy> strategies; | ||
| private final PipelineConfigGroup config; | ||
|
|
||
| @Inject | ||
| public MetricsProducer(Instance<MetricsExporterStrategy> strategies, PipelineConfigGroup config) { | ||
| this.strategies = strategies; | ||
| this.config = config; | ||
| } | ||
|
|
||
| @Produces | ||
| Metrics metrics() { | ||
| var metricsBuilder = new MetricsBuilder(); | ||
|
|
||
| strategies.stream() | ||
| .filter(strategy -> strategy.isApplicable(config)) | ||
| .forEach(strategy -> strategy.apply(metricsBuilder, config)); | ||
|
|
||
| return metricsBuilder.build(); | ||
| } | ||
| } |
42 changes: 42 additions & 0 deletions
42
...java/io/debezium/platform/environment/operator/metrics/OpenTelemetryExporterStrategy.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| /* | ||
| * Copyright Debezium Authors. | ||
| * | ||
| * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
| */ | ||
| package io.debezium.platform.environment.operator.metrics; | ||
|
|
||
| import jakarta.enterprise.context.ApplicationScoped; | ||
|
|
||
| import io.debezium.operator.api.model.runtime.metrics.MetricsBuilder; | ||
| import io.debezium.operator.api.model.runtime.metrics.OpenTelemetryBuilder; | ||
| import io.debezium.operator.api.model.runtime.metrics.OtelCollectorBuilder; | ||
| import io.debezium.platform.config.PipelineConfigGroup; | ||
|
|
||
| /** | ||
| * Strategy for configuring OpenTelemetry metrics exporter. | ||
| * This exporter is enabled based on configuration and can optionally | ||
| * include a collector endpoint. | ||
| */ | ||
| @ApplicationScoped | ||
| public class OpenTelemetryExporterStrategy implements MetricsExporterStrategy { | ||
|
|
||
| @Override | ||
| public boolean isApplicable(PipelineConfigGroup config) { | ||
| return config.monitoring().otel().enabled(); | ||
| } | ||
|
|
||
| @Override | ||
| public void apply(MetricsBuilder metricsBuilder, PipelineConfigGroup config) { | ||
| var otelBuilder = new OpenTelemetryBuilder() | ||
| .withEnabled(); | ||
|
|
||
| config.monitoring().otel().endpoint() | ||
| .filter(e -> !e.isBlank()) | ||
| .ifPresent(endpoint -> otelBuilder.withCollector( | ||
| new OtelCollectorBuilder() | ||
| .withEndpoint(endpoint) | ||
| .build())); | ||
|
|
||
| metricsBuilder.withOpenTelemetry(otelBuilder.build()); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.