Skip to content

Commit

Permalink
Revert "81 supplier plugin health and store usage" (opensearch-projec…
Browse files Browse the repository at this point in the history
  • Loading branch information
sstults authored Dec 12, 2024
1 parent e58e20d commit c6c8595
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 501 deletions.
20 changes: 2 additions & 18 deletions src/main/java/com/o19s/es/ltr/LtrQueryParserPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
import org.opensearch.ltr.stats.LTRStats;
import org.opensearch.ltr.stats.StatName;
import org.opensearch.ltr.stats.suppliers.CacheStatsOnNodeSupplier;
import org.opensearch.ltr.stats.suppliers.PluginHealthStatusSupplier;
import org.opensearch.ltr.stats.suppliers.StoreStatsSupplier;
import org.opensearch.ltr.stats.suppliers.CounterSupplier;
import com.o19s.es.explore.ExplorerQueryBuilder;
import com.o19s.es.ltr.action.AddFeaturesToSetAction;
Expand Down Expand Up @@ -127,7 +125,7 @@ public class LtrQueryParserPlugin extends Plugin implements SearchPlugin, Script
public static final String LTR_LEGACY_BASE_URI = "/_opendistro/_ltr";
private final LtrRankerParserFactory parserFactory;
private final Caches caches;
private final LTRStats ltrStats;
private LTRStats ltrStats;

public LtrQueryParserPlugin(Settings settings) {
caches = new Caches(settings);
Expand Down Expand Up @@ -283,23 +281,9 @@ public Collection<Object> createComponents(Client client,
final JvmService jvmService = new JvmService(environment.settings());
final LTRCircuitBreakerService ltrCircuitBreakerService = new LTRCircuitBreakerService(jvmService).init();

addStats(client, clusterService, ltrCircuitBreakerService);
return asList(caches, parserFactory, ltrCircuitBreakerService, ltrStats);
}

private void addStats(
final Client client,
final ClusterService clusterService,
final LTRCircuitBreakerService ltrCircuitBreakerService
) {
final StoreStatsSupplier storeStatsSupplier = StoreStatsSupplier.create(client, clusterService);
ltrStats.addStats(StatName.LTR_STORES_STATS.getName(), new LTRStat<>(true, storeStatsSupplier));

final PluginHealthStatusSupplier pluginHealthStatusSupplier = PluginHealthStatusSupplier.create(
client, clusterService, ltrCircuitBreakerService);
ltrStats.addStats(StatName.LTR_PLUGIN_STATUS.getName(), new LTRStat<>(true, pluginHealthStatusSupplier));
}

private LTRStats getInitialStats() {
Map<String, LTRStat<?>> stats = new HashMap<>();
stats.put(StatName.LTR_CACHE_STATS.getName(),
Expand All @@ -313,7 +297,7 @@ private LTRStats getInitialStats() {

protected FeatureStoreLoader getFeatureStoreLoader() {
return (storeName, clientSupplier) ->
new CachedFeatureStore(new IndexFeatureStore(storeName, clientSupplier, parserFactory), caches);
new CachedFeatureStore(new IndexFeatureStore(storeName, clientSupplier, parserFactory), caches);
}

// A simplified version of some token filters needed by the feature stores.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@

/**
* Supplier for an overall plugin health status.
* @deprecated This class is outdated since 3.0.0-3.0.0 and will be removed in the future.
* Please use the new stats framework in the {@link org.opensearch.ltr.stats} package.
*/
@Deprecated(since = "3.0.0-3.0.0", forRemoval = true)
public class PluginHealthStatusSupplier implements Supplier<String> {
private static final String STATUS_GREEN = "green";
private static final String STATUS_YELLOW = "yellow";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@
* A supplier which provides information on all feature stores. It provides basic
* information such as the index health and count of feature sets, features and
* models in the store.
* @deprecated This class is outdated since 3.0.0-3.0.0 and will be removed in the future.
* Please use the new stats framework in the {@link org.opensearch.ltr.stats} package.
*/
@Deprecated(since = "3.0.0-3.0.0", forRemoval = true)
public class StoreStatsSupplier implements Supplier<Map<String, Map<String, Object>>> {
private static final Logger LOG = LogManager.getLogger(StoreStatsSupplier.class);
private static final String AGG_FIELD = "type";
Expand Down

This file was deleted.

This file was deleted.

115 changes: 0 additions & 115 deletions src/main/java/org/opensearch/ltr/stats/suppliers/utils/StoreUtils.java

This file was deleted.

This file was deleted.

Loading

0 comments on commit c6c8595

Please sign in to comment.