Skip to content

Commit

Permalink
Merge pull request #2073 from bosch-io/bugfix/aggregation-metrics-tags
Browse files Browse the repository at this point in the history
fix aggregation metrics config unnecessary force of tags
  • Loading branch information
alstanchev authored Dec 4, 2024
2 parents 014d36d + 4f63fb0 commit 560c737
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion deployment/helm/ditto/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,16 @@ private void validateConfig() {
});

final Set<String> 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<String> 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());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ 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<String, CustomAggregationMetricConfig> customSearchMetricConfigMap;
private final Map<GageIdentifier, TimestampedGauge> metricsGauges;
private final Gauge customSearchMetricsGauge;
private final Map<FilterIdentifier, PlaceholderResolver<Map<String, String>>> inlinePlaceholderResolvers;

@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<>();
Expand Down Expand Up @@ -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());
}


Expand Down

0 comments on commit 560c737

Please sign in to comment.