Skip to content

Commit

Permalink
introduced data points limit
Browse files Browse the repository at this point in the history
  • Loading branch information
EinsamHauer committed Aug 19, 2015
1 parent 4206ecd commit 47d9a41
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions puppet/manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
$reader_port = '8080',
$reader_threads = '16',
$reader_request_timeout = '30',
$reader_max_points = '60000000',
$reader_rollups = ['60s:5356800s','900s:62208000s'],

$store_cluster = [$::ipaddress],
Expand Down
1 change: 1 addition & 0 deletions puppet/templates/disthene-reader.yaml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ reader:
port: <%= @reader_port %>
threads: <%= @reader_threads %>
requestTimeout: <%= @reader_request_timeout %>
maxPoints: <%= @reader_max_points %>
rollups:
<% @reader_rollups.each do |rollup| -%>
- <%= rollup %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class ReaderConfiguration {
private int port;
private int threads = 32;
private int requestTimeout = 30;
private int maxPoints = 60_000_000;
private List<Rollup> rollups = new ArrayList<>();

public String getBind() {
Expand Down Expand Up @@ -53,13 +54,22 @@ public void setRequestTimeout(int requestTimeout) {
this.requestTimeout = requestTimeout;
}

public int getMaxPoints() {
return maxPoints;
}

public void setMaxPoints(int maxPoints) {
this.maxPoints = maxPoints;
}

@Override
public String toString() {
return "ReaderConfiguration{" +
"bind='" + bind + '\'' +
", port=" + port +
", threads=" + threads +
", requestTimeout=" + requestTimeout +
", maxPoints=" + maxPoints +
", rollups=" + rollups +
'}';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ public List<TimeSeries> getMetricsAsList(String tenant, List<String> wildcards,
logger.debug("Expected number of data points in series is " + length);
logger.debug("Expected number of series is " + paths.size());

// Fail (return empty list) right away if we exceed maximum number of points
if (paths.size() * length > distheneReaderConfiguration.getReader().getMaxPoints()) {
logger.debug("Expected total number of data points exceeds the limit: " + paths.size() * length);
return Collections.emptyList();
}

// Now let's query C*
List<ListenableFuture<SinglePathResult>> futures = Lists.newArrayListWithExpectedSize(paths.size());
Expand Down

0 comments on commit 47d9a41

Please sign in to comment.