Skip to content

Commit

Permalink
Autoscaling capacity should be in bytes (elastic#66351)
Browse files Browse the repository at this point in the history
The autoscaling storage and memory capacities returned were
inadvertently returned as capacities with units. This imposes a burden
on the caller to be able to parse ES byte-size units. Fixed this to
just return the bytes as numbers.
  • Loading branch information
henningandersen committed Dec 15, 2020
1 parent f04a74b commit 053eedc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
- do:
autoscaling.get_autoscaling_capacity: {}

- match: { policies.my_autoscaling_policy.required_capacity.total.storage: 13370b }
- match: { policies.my_autoscaling_policy.required_capacity.total.memory: 73310b }
- match: { policies.my_autoscaling_policy.required_capacity.node.storage: 1337b }
- match: { policies.my_autoscaling_policy.required_capacity.node.memory: 7331b }
- match: { policies.my_autoscaling_policy.deciders.fixed.required_capacity.total.storage: 13370b }
- match: { policies.my_autoscaling_policy.deciders.fixed.required_capacity.total.memory: 73310b }
- match: { policies.my_autoscaling_policy.deciders.fixed.required_capacity.node.storage: 1337b }
- match: { policies.my_autoscaling_policy.deciders.fixed.required_capacity.node.memory: 7331b }
- match: { policies.my_autoscaling_policy.required_capacity.total.storage: 13370 }
- match: { policies.my_autoscaling_policy.required_capacity.total.memory: 73310 }
- match: { policies.my_autoscaling_policy.required_capacity.node.storage: 1337 }
- match: { policies.my_autoscaling_policy.required_capacity.node.memory: 7331 }
- match: { policies.my_autoscaling_policy.deciders.fixed.required_capacity.total.storage: 13370 }
- match: { policies.my_autoscaling_policy.deciders.fixed.required_capacity.total.memory: 73310 }
- match: { policies.my_autoscaling_policy.deciders.fixed.required_capacity.node.storage: 1337 }
- match: { policies.my_autoscaling_policy.deciders.fixed.required_capacity.node.memory: 7331 }
- match: { policies.my_autoscaling_policy.deciders.fixed.reason_summary: "fixed storage [1.3kb] memory [7.1kb] nodes [10]" }
- length: { policies.my_autoscaling_policy.current_nodes: 0 }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ public ByteSizeValue memory() {
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
if (storage != null) {
builder.field("storage", storage.getStringRep());
builder.field("storage", storage.getBytes());
}
if (memory != null) {
builder.field("memory", memory.getStringRep());
builder.field("memory", memory.getBytes());
}
builder.endObject();
return builder;
Expand Down

0 comments on commit 053eedc

Please sign in to comment.