Skip to content

Commit 847334c

Browse files
committed
OAK-11750: Added a flag to disable collection of inference stats
1 parent c42fa2d commit 847334c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/ElasticIndexProviderService.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public class ElasticIndexProviderService {
7575
protected static final String PROP_ELASTIC_API_KEY_SECRET = "elasticsearch.apiKeySecret";
7676
protected static final String PROP_LOCAL_TEXT_EXTRACTION_DIR = "localTextExtractionDir";
7777
private static final boolean DEFAULT_IS_INFERENCE_ENABLED = false;
78+
private static final String ENV_VAR_OAK_INFERENCE_STATISTICS_DISABLED = "OAK_INFERENCE_STATISTICS_DISABLED";
7879

7980
@ObjectClassDefinition(name = "ElasticIndexProviderService", description = "Apache Jackrabbit Oak ElasticIndexProvider")
8081
public @interface Config {
@@ -190,7 +191,12 @@ private void activate(BundleContext bundleContext, Config config) {
190191
} else {
191192
this.isInferenceEnabled = config.isInferenceEnabled();
192193
}
193-
InferenceConfig.reInitialize(nodeStore, statisticsProvider, config.inferenceConfigPath(), isInferenceEnabled);
194+
195+
if (Boolean.parseBoolean(System.getenv(ENV_VAR_OAK_INFERENCE_STATISTICS_DISABLED))) {
196+
InferenceConfig.reInitialize(nodeStore, config.inferenceConfigPath(), isInferenceEnabled);
197+
} else {
198+
InferenceConfig.reInitialize(nodeStore, statisticsProvider, config.inferenceConfigPath(), isInferenceEnabled);
199+
}
194200

195201
//initializeTextExtractionDir(bundleContext, config);
196202
//initializeExtractedTextCache(config, statisticsProvider);

0 commit comments

Comments
 (0)