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

fix aggregation metrics config unnecessary force of tags #2073

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading