12
12
import static org .opensearch .ml .common .settings .MLCommonsSettings .ML_COMMONS_CONTROLLER_ENABLED ;
13
13
import static org .opensearch .ml .common .settings .MLCommonsSettings .ML_COMMONS_LOCAL_MODEL_ENABLED ;
14
14
import static org .opensearch .ml .common .settings .MLCommonsSettings .ML_COMMONS_MCP_SERVER_ENABLED ;
15
+ import static org .opensearch .ml .common .settings .MLCommonsSettings .ML_COMMONS_METRIC_COLLECTION_ENABLED ;
15
16
import static org .opensearch .ml .common .settings .MLCommonsSettings .ML_COMMONS_MULTI_TENANCY_ENABLED ;
16
17
import static org .opensearch .ml .common .settings .MLCommonsSettings .ML_COMMONS_OFFLINE_BATCH_INFERENCE_ENABLED ;
17
18
import static org .opensearch .ml .common .settings .MLCommonsSettings .ML_COMMONS_OFFLINE_BATCH_INGESTION_ENABLED ;
19
+ import static org .opensearch .ml .common .settings .MLCommonsSettings .ML_COMMONS_RAG_PIPELINE_FEATURE_ENABLED ;
18
20
import static org .opensearch .ml .common .settings .MLCommonsSettings .ML_COMMONS_REMOTE_INFERENCE_ENABLED ;
21
+ import static org .opensearch .ml .common .settings .MLCommonsSettings .ML_COMMONS_STATIC_METRIC_COLLECTION_ENABLED ;
19
22
20
23
import java .util .ArrayList ;
21
24
import java .util .List ;
@@ -43,6 +46,11 @@ public class MLFeatureEnabledSetting {
43
46
44
47
private volatile Boolean isMcpServerEnabled ;
45
48
49
+ private volatile Boolean isRagSearchPipelineEnabled ;
50
+
51
+ private volatile Boolean isMetricCollectionEnabled ;
52
+ private volatile Boolean isStaticMetricCollectionEnabled ;
53
+
46
54
private final List <SettingsChangeListener > listeners = new ArrayList <>();
47
55
48
56
public MLFeatureEnabledSetting (ClusterService clusterService , Settings settings ) {
@@ -55,6 +63,9 @@ public MLFeatureEnabledSetting(ClusterService clusterService, Settings settings)
55
63
isBatchInferenceEnabled = ML_COMMONS_OFFLINE_BATCH_INFERENCE_ENABLED .get (settings );
56
64
isMultiTenancyEnabled = ML_COMMONS_MULTI_TENANCY_ENABLED .get (settings );
57
65
isMcpServerEnabled = ML_COMMONS_MCP_SERVER_ENABLED .get (settings );
66
+ isRagSearchPipelineEnabled = ML_COMMONS_RAG_PIPELINE_FEATURE_ENABLED .get (settings );
67
+ isMetricCollectionEnabled = ML_COMMONS_METRIC_COLLECTION_ENABLED .get (settings );
68
+ isStaticMetricCollectionEnabled = ML_COMMONS_STATIC_METRIC_COLLECTION_ENABLED .get (settings );
58
69
59
70
clusterService
60
71
.getClusterSettings ()
@@ -74,6 +85,15 @@ public MLFeatureEnabledSetting(ClusterService clusterService, Settings settings)
74
85
.getClusterSettings ()
75
86
.addSettingsUpdateConsumer (ML_COMMONS_OFFLINE_BATCH_INFERENCE_ENABLED , it -> isBatchInferenceEnabled = it );
76
87
clusterService .getClusterSettings ().addSettingsUpdateConsumer (ML_COMMONS_MCP_SERVER_ENABLED , it -> isMcpServerEnabled = it );
88
+ clusterService
89
+ .getClusterSettings ()
90
+ .addSettingsUpdateConsumer (MLCommonsSettings .ML_COMMONS_RAG_PIPELINE_FEATURE_ENABLED , it -> isRagSearchPipelineEnabled = it );
91
+ clusterService
92
+ .getClusterSettings ()
93
+ .addSettingsUpdateConsumer (ML_COMMONS_METRIC_COLLECTION_ENABLED , it -> isMetricCollectionEnabled = it );
94
+ clusterService
95
+ .getClusterSettings ()
96
+ .addSettingsUpdateConsumer (ML_COMMONS_STATIC_METRIC_COLLECTION_ENABLED , it -> isStaticMetricCollectionEnabled = it );
77
97
}
78
98
79
99
/**
@@ -148,6 +168,22 @@ public void addListener(SettingsChangeListener listener) {
148
168
listeners .add (listener );
149
169
}
150
170
171
+ /**
172
+ * Whether the rag search pipeline feature is enabled. If disabled, APIs in ml-commons will block rag search pipeline.
173
+ * @return whether the feature is enabled.
174
+ */
175
+ public boolean isRagSearchPipelineEnabled () {
176
+ return isRagSearchPipelineEnabled ;
177
+ }
178
+
179
+ public boolean isMetricCollectionEnabled () {
180
+ return isMetricCollectionEnabled ;
181
+ }
182
+
183
+ public boolean isStaticMetricCollectionEnabled () {
184
+ return isStaticMetricCollectionEnabled ;
185
+ }
186
+
151
187
@ VisibleForTesting
152
188
public void notifyMultiTenancyListeners (boolean isEnabled ) {
153
189
for (SettingsChangeListener listener : listeners ) {
0 commit comments