forked from opendistro-for-elasticsearch/k-NN
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integration test update (opendistro-for-elasticsearch#61)
- Loading branch information
1 parent
9027509
commit 3fc88f3
Showing
11 changed files
with
615 additions
and
735 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/main/java/com/amazon/opendistroforelasticsearch/knn/plugin/stats/KNNStatsConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
package com.amazon.opendistroforelasticsearch.knn.plugin.stats; | ||
|
||
import com.amazon.opendistroforelasticsearch.knn.index.KNNIndexCache; | ||
import com.amazon.opendistroforelasticsearch.knn.plugin.stats.suppliers.KNNCacheSupplier; | ||
import com.amazon.opendistroforelasticsearch.knn.plugin.stats.suppliers.KNNCircuitBreakerSupplier; | ||
import com.amazon.opendistroforelasticsearch.knn.plugin.stats.suppliers.KNNInnerCacheStatsSupplier; | ||
import com.google.common.cache.CacheStats; | ||
import com.google.common.collect.ImmutableMap; | ||
|
||
import java.util.Map; | ||
|
||
public class KNNStatsConfig { | ||
public static Map<String, KNNStat<?>> KNN_STATS = ImmutableMap.<String, KNNStat<?>>builder() | ||
.put(StatNames.HIT_COUNT.getName(), new KNNStat<>(false, | ||
new KNNInnerCacheStatsSupplier(CacheStats::hitCount))) | ||
.put(StatNames.MISS_COUNT.getName(), new KNNStat<>(false, | ||
new KNNInnerCacheStatsSupplier(CacheStats::missCount))) | ||
.put(StatNames.LOAD_SUCCESS_COUNT.getName(), new KNNStat<>(false, | ||
new KNNInnerCacheStatsSupplier(CacheStats::loadSuccessCount))) | ||
.put(StatNames.LOAD_EXCEPTION_COUNT.getName(), new KNNStat<>(false, | ||
new KNNInnerCacheStatsSupplier(CacheStats::loadExceptionCount))) | ||
.put(StatNames.TOTAL_LOAD_TIME.getName(), new KNNStat<>(false, | ||
new KNNInnerCacheStatsSupplier(CacheStats::totalLoadTime))) | ||
.put(StatNames.EVICTION_COUNT.getName(), new KNNStat<>(false, | ||
new KNNInnerCacheStatsSupplier(CacheStats::evictionCount))) | ||
.put(StatNames.GRAPH_MEMORY_USAGE.getName(), new KNNStat<>(false, | ||
new KNNCacheSupplier<>(KNNIndexCache::getWeightInKilobytes))) | ||
.put(StatNames.CACHE_CAPACITY_REACHED.getName(), new KNNStat<>(false, | ||
new KNNCacheSupplier<>(KNNIndexCache::isCacheCapacityReached))) | ||
.put(StatNames.CIRCUIT_BREAKER_TRIGGERED.getName(), new KNNStat<>(true, | ||
new KNNCircuitBreakerSupplier())).build(); | ||
} |
Oops, something went wrong.