From e473615f534b64a923a17232325f4a14bd269a16 Mon Sep 17 00:00:00 2001 From: Aleksandar Stanchev Date: Tue, 3 Dec 2024 10:48:41 +0200 Subject: [PATCH 1/2] fix aggregation metrics config unnecessary force of tags Signed-off-by: Aleksandar Stanchev --- .../DefaultCustomAggregationMetricConfig.java | 13 ++++++++++--- .../OperatorAggregateMetricsProviderActor.java | 6 +++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/thingsearch/service/src/main/java/org/eclipse/ditto/thingsearch/service/common/config/DefaultCustomAggregationMetricConfig.java b/thingsearch/service/src/main/java/org/eclipse/ditto/thingsearch/service/common/config/DefaultCustomAggregationMetricConfig.java index 34cdd459c4..2ff0cb8bb9 100644 --- a/thingsearch/service/src/main/java/org/eclipse/ditto/thingsearch/service/common/config/DefaultCustomAggregationMetricConfig.java +++ b/thingsearch/service/src/main/java/org/eclipse/ditto/thingsearch/service/common/config/DefaultCustomAggregationMetricConfig.java @@ -161,9 +161,16 @@ private void validateConfig() { }); final Set requiredGroupByPlaceholders = getDeclaredGroupByPlaceholdersExpressions(getTags()); - if (!requiredGroupByPlaceholders.equals(getGroupBy().keySet())) { - throw new IllegalArgumentException("Custom search metric Gauge for metric <" - + metricName + "> must have the same groupBy fields as the configured placeholder expressions in tags. Required: " + requiredGroupByPlaceholders + " Configured: " + getGroupBy().keySet()); + List missing = new ArrayList<>(); + requiredGroupByPlaceholders.forEach(placeholder -> { + if (!getGroupBy().containsKey(placeholder)) { + missing.add(placeholder); + } + }); + if (!missing.isEmpty()){ + throw new IllegalArgumentException("Custom search metric Gauge for metric <" + metricName + + "> must contain in the groupBy fields all of the fields used by placeholder expressions in tags. Missing: " + + missing + " Configured: " + getGroupBy().keySet()); } } diff --git a/thingsearch/service/src/main/java/org/eclipse/ditto/thingsearch/service/starter/actors/OperatorAggregateMetricsProviderActor.java b/thingsearch/service/src/main/java/org/eclipse/ditto/thingsearch/service/starter/actors/OperatorAggregateMetricsProviderActor.java index f44ce2ff31..4bdc636f80 100644 --- a/thingsearch/service/src/main/java/org/eclipse/ditto/thingsearch/service/starter/actors/OperatorAggregateMetricsProviderActor.java +++ b/thingsearch/service/src/main/java/org/eclipse/ditto/thingsearch/service/starter/actors/OperatorAggregateMetricsProviderActor.java @@ -75,7 +75,7 @@ public final class OperatorAggregateMetricsProviderActor extends AbstractActorWi private static final String METRIC_NAME = "metric-name"; private final DittoDiagnosticLoggingAdapter log = DittoLoggerFactory.getDiagnosticLoggingAdapter(this); - private final ActorRef thingsAggregatorActorSingletonProxy; + private final ActorRef aggregateThingsMetricsActorSingletonProxy; private final Map customSearchMetricConfigMap; private final Map metricsGauges; private final Gauge customSearchMetricsGauge; @@ -83,7 +83,7 @@ public final class OperatorAggregateMetricsProviderActor extends AbstractActorWi @SuppressWarnings("unused") private OperatorAggregateMetricsProviderActor(final SearchConfig searchConfig) { - this.thingsAggregatorActorSingletonProxy = initializeAggregationThingsMetricsActor(searchConfig); + this.aggregateThingsMetricsActorSingletonProxy = initializeAggregationThingsMetricsActor(searchConfig); this.customSearchMetricConfigMap = searchConfig.getOperatorMetricsConfig().getCustomAggregationMetricConfigs(); this.metricsGauges = new HashMap<>(); this.inlinePlaceholderResolvers = new LinkedHashMap<>(); @@ -150,7 +150,7 @@ private void handleGatheringMetrics(final GatherMetricsCommand gatherMetricsComm final AggregateThingsMetrics aggregateThingsMetrics = AggregateThingsMetrics.of(metricName, config.getGroupBy(), namedFilters, Set.of(config.getNamespaces().toArray(new String[0])), dittoHeaders); - thingsAggregatorActorSingletonProxy.tell(aggregateThingsMetrics, getSelf()); + aggregateThingsMetricsActorSingletonProxy.tell(aggregateThingsMetrics, getSelf()); } From 4f63fb03fe33f4aec195266b0af0417f95d614c2 Mon Sep 17 00:00:00 2001 From: Aleksandar Stanchev Date: Tue, 3 Dec 2024 11:53:24 +0200 Subject: [PATCH 2/2] bump Helm chart to 3.6.4 Signed-off-by: Aleksandar Stanchev --- deployment/helm/ditto/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/helm/ditto/Chart.yaml b/deployment/helm/ditto/Chart.yaml index 80459e0d7d..484240e7b5 100644 --- a/deployment/helm/ditto/Chart.yaml +++ b/deployment/helm/ditto/Chart.yaml @@ -16,7 +16,7 @@ description: | A digital twin is a virtual, cloud based, representation of his real world counterpart (real world “Things”, e.g. devices like sensors, smart heating, connected cars, smart grids, EV charging stations etc). type: application -version: 3.6.3 # chart version is effectively set by release-job +version: 3.6.4 # chart version is effectively set by release-job appVersion: 3.6.3 keywords: - iot-chart