Branch: refs/heads/XWIKI-24710 Home: https://github.com/xwiki/xwiki-platform Commit: 58c4afdba5909b522f104784bbb45616a645f0e6 https://github.com/xwiki/xwiki-platform/commit/58c4afdba5909b522f104784bbb45... Author: Vincent Massol <[email protected]> Date: 2026-08-25 (Tue, 25 Aug 2026) Changed paths: M xwiki-platform-core/xwiki-platform-activeinstalls2/xwiki-platform-activeinstalls2-api/pom.xml M xwiki-platform-core/xwiki-platform-activeinstalls2/xwiki-platform-activeinstalls2-api/src/main/java/org/xwiki/activeinstalls2/ActiveInstallsConfiguration.java M xwiki-platform-core/xwiki-platform-activeinstalls2/xwiki-platform-activeinstalls2-api/src/main/java/org/xwiki/activeinstalls2/DataManager.java A xwiki-platform-core/xwiki-platform-activeinstalls2/xwiki-platform-activeinstalls2-api/src/main/java/org/xwiki/activeinstalls2/TooManyExtensionsException.java M xwiki-platform-core/xwiki-platform-activeinstalls2/xwiki-platform-activeinstalls2-api/src/main/java/org/xwiki/activeinstalls2/internal/DefaultActiveInstallsConfiguration.java M xwiki-platform-core/xwiki-platform-activeinstalls2/xwiki-platform-activeinstalls2-api/src/main/java/org/xwiki/activeinstalls2/internal/DefaultDataManager.java M xwiki-platform-core/xwiki-platform-activeinstalls2/xwiki-platform-activeinstalls2-api/src/main/java/org/xwiki/activeinstalls2/script/ActiveInstallsScriptService.java M xwiki-platform-core/xwiki-platform-activeinstalls2/xwiki-platform-activeinstalls2-api/src/test/it/org/xwiki/activeinstalls2/internal/PingSenderIT.java A xwiki-platform-core/xwiki-platform-activeinstalls2/xwiki-platform-activeinstalls2-api/src/test/java/org/xwiki/activeinstalls2/ActiveInstallsConfigurationTest.java A xwiki-platform-core/xwiki-platform-activeinstalls2/xwiki-platform-activeinstalls2-api/src/test/java/org/xwiki/activeinstalls2/DataManagerTest.java A xwiki-platform-core/xwiki-platform-activeinstalls2/xwiki-platform-activeinstalls2-api/src/test/java/org/xwiki/activeinstalls2/internal/DefaultActiveInstallsConfigurationTest.java A xwiki-platform-core/xwiki-platform-activeinstalls2/xwiki-platform-activeinstalls2-api/src/test/java/org/xwiki/activeinstalls2/script/ActiveInstallsScriptServiceTest.java M xwiki-platform-tools/xwiki-platform-tool-configuration-resources/src/main/resources/xwiki.properties.vm Log Message: ----------- XWIKI-24710: Add script APIs to count distinct active installs globally and per extension * Add DataManager#countDistinctInstalls(), counting the distinct instances matching a query with a cardinality aggregation on the instance id. Contrary to countInstalls(), which counts pings, this counts installs: an instance pings once a day but also on every restart. * Add DataManager#countDistinctInstallsByExtension(), returning the same count per extension id in a single query. It uses a reverse nested aggregation since the extensions are indexed as a nested type while the instance id is on the root document. Document that the counts are keyed by the id an extension is installed under and are not resolved through the features it provides. * Expose both through the activeinstalls2 script service. * Both methods are default methods throwing their declared checked exception, so that existing DataManager implementations keep working. * Set the cardinality precision threshold explicitly on both aggregations: the maximum Elasticsearch supports for the global count, and the lower default for the per-extension one, which pays that memory once per extension bucket. Document in both APIs the count above which the result is an approximation. * Return the per-extension counts in the order Elasticsearch returns them rather than in a hash order. * Add ActiveInstallsConfiguration#getMaxExtensionCountPerQuery(), configurable with the new activeinstalls2.maxExtensionCountPerQuery property, to bound how many extensions a single per-extension count can report. This makes both the point at which the query starts failing and the cost it can impose on the Elasticsearch cluster configurable. * Raise the new TooManyExtensionsException rather than a generic Exception when that bound is exceeded, so that a caller can tell that raising the configured maximum is what's needed without matching on a message. * Add unit tests for the DataManager and ActiveInstallsConfiguration default methods, for the script service and for the configuration, extend the integration test to verify the per-extension counts, their order and that counting more extensions than the configured maximum fails, and raise the module's instruction coverage ratios accordingly. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> To unsubscribe from these emails, change your notification settings at https://github.com/xwiki/xwiki-platform/settings/notifications