-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for the Strimzi Metrics Reporter to brokers and controllers
This patch adds support for the Strimzi Metrics Reporter to brokers and controllers as described by the following proposal: https://github.com/strimzi/proposals/blob/main/064-prometheus-metrics-reporter.md Signed-off-by: ocorriga <[email protected]>
- Loading branch information
ocorriga
committed
Jan 17, 2025
1 parent
58f31ba
commit a9b7788
Showing
39 changed files
with
1,082 additions
and
183 deletions.
There are no files selected for viewing
This file contains 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 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 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
46 changes: 46 additions & 0 deletions
46
api/src/main/java/io/strimzi/api/kafka/model/common/metrics/StrimziMetricsReporter.java
This file contains 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,46 @@ | ||
/* | ||
* Copyright Strimzi authors. | ||
* License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). | ||
*/ | ||
package io.strimzi.api.kafka.model.common.metrics; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonPropertyOrder; | ||
import io.strimzi.api.kafka.model.common.Constants; | ||
import io.strimzi.crdgenerator.annotations.Description; | ||
import io.sundr.builder.annotations.Buildable; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.ToString; | ||
|
||
/** | ||
* Strimzi Metrics Reporter. | ||
*/ | ||
@Buildable( | ||
editableEnabled = false, | ||
builderPackage = Constants.FABRIC8_KUBERNETES_API | ||
) | ||
@JsonPropertyOrder({"type", "values"}) | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@EqualsAndHashCode(callSuper = true) | ||
@ToString(callSuper = true) | ||
public class StrimziMetricsReporter extends MetricsConfig { | ||
public static final String TYPE_STRIMZI_METRICS_REPORTER = "strimziMetricsReporter"; | ||
|
||
private StrimziMetricsReporterValues values; | ||
|
||
@Description("Must be `" + TYPE_STRIMZI_METRICS_REPORTER + "`") | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@Override | ||
public String getType() { | ||
return TYPE_STRIMZI_METRICS_REPORTER; | ||
} | ||
|
||
@Description("Configuration values for the Strimzi Metrics Reporter.") | ||
public StrimziMetricsReporterValues getValues() { | ||
return values; | ||
} | ||
|
||
public void setValues(StrimziMetricsReporterValues values) { | ||
this.values = values; | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
...src/main/java/io/strimzi/api/kafka/model/common/metrics/StrimziMetricsReporterValues.java
This file contains 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,59 @@ | ||
/* | ||
* Copyright Strimzi authors. | ||
* License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). | ||
*/ | ||
package io.strimzi.api.kafka.model.common.metrics; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonPropertyOrder; | ||
import io.strimzi.api.kafka.model.common.Constants; | ||
import io.strimzi.api.kafka.model.common.UnknownPropertyPreserving; | ||
import io.strimzi.crdgenerator.annotations.Description; | ||
import io.sundr.builder.annotations.Buildable; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.ToString; | ||
|
||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* Strimzi Metrics Reporter configuration. | ||
*/ | ||
@Buildable( | ||
editableEnabled = false, | ||
builderPackage = Constants.FABRIC8_KUBERNETES_API | ||
) | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@JsonPropertyOrder({"allowList"}) | ||
@EqualsAndHashCode() | ||
@ToString | ||
public class StrimziMetricsReporterValues implements UnknownPropertyPreserving { | ||
private static final String DEFAULT_REGEX = ".*"; | ||
|
||
private List<String> allowList = List.of(DEFAULT_REGEX); | ||
private Map<String, Object> additionalProperties; | ||
|
||
@Description("A comma separated list of regex patterns to specify the metrics to collect. Default: `" + DEFAULT_REGEX + "`.") | ||
@JsonInclude(value = JsonInclude.Include.NON_NULL) | ||
public List<String> getAllowList() { | ||
return allowList; | ||
} | ||
|
||
public void setAllowList(List<String> allowList) { | ||
this.allowList = allowList; | ||
} | ||
|
||
@Override | ||
public Map<String, Object> getAdditionalProperties() { | ||
return this.additionalProperties != null ? this.additionalProperties : Map.of(); | ||
} | ||
|
||
@Override | ||
public void setAdditionalProperty(String name, Object value) { | ||
if (this.additionalProperties == null) { | ||
this.additionalProperties = new HashMap<>(2); | ||
} | ||
this.additionalProperties.put(name, value); | ||
} | ||
} |
This file contains 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 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 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.