forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Profiling] Use downsampled K/V indices
- Loading branch information
1 parent
d60e698
commit 7c2ba38
Showing
6 changed files
with
151 additions
and
35 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
39 changes: 39 additions & 0 deletions
39
x-pack/plugin/profiler/src/main/java/org/elasticsearch/xpack/profiler/DownsampledIndex.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,39 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.profiler; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Locale; | ||
|
||
public class DownsampledIndex { | ||
private static final int SAMPLING_FACTOR = 5; | ||
|
||
private static final int MIN_EXPONENT = 1; | ||
|
||
private static final int MAX_EXPONENT = 11; | ||
|
||
public static String indexName(String namePrefix, int exp) { | ||
return (exp > 0) ? String.format(Locale.ROOT, "%s-%dpow%02d", namePrefix, SAMPLING_FACTOR, exp) : namePrefix; | ||
} | ||
|
||
public static Collection<String> indexNames(String namePrefix) { | ||
return DownsampledIndex.indexNames(namePrefix, namePrefix); | ||
} | ||
|
||
public static Collection<String> indexNames(String fullIndexName, String namePrefix) { | ||
List<String> names = new ArrayList<>(); | ||
names.add(fullIndexName); | ||
for (int exp = MIN_EXPONENT; exp <= MAX_EXPONENT; exp++) { | ||
names.add(indexName(namePrefix, exp)); | ||
} | ||
return Collections.unmodifiableList(names); | ||
} | ||
} |
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
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