Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,29 @@
public class MemoryStatsConfig implements Serializable {
private static final long serialVersionUID = 1L;

@JsonProperty("stats")
private StatsConfig stats;

@JsonProperty("usage")
private Long usage;

@JsonProperty("max_usage")
private Long maxUsage;

@JsonProperty("stats")
private StatsConfig stats;
@JsonProperty("failcnt")
private Long failcnt;

@JsonProperty("limit")
private Long limit;

/**
* @see #stats
*/
@CheckForNull
public StatsConfig getStats() {
return stats;
}

/**
* @see #usage
*/
Expand All @@ -44,11 +55,10 @@ public Long getMaxUsage() {
}

/**
* @see #stats
* @see #failcnt
*/
@CheckForNull
public StatsConfig getStats() {
return stats;
public Long getFailcnt() {
return failcnt;
}

/**
Expand Down
22 changes: 19 additions & 3 deletions src/test/java/com/github/dockerjava/api/model/StatisticsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.dockerjava.core.RemoteApiVersion;
import org.hamcrest.Matchers;
import org.junit.Test;

import java.io.IOException;
Expand Down Expand Up @@ -82,11 +83,26 @@ public void serderJson1() throws IOException {
assertThat(stats.getWriteback(), is(0L));

assertThat(memoryStats.getLimit(), is(2095874048L));
assertThat(memoryStats.getFailcnt(), is(0L));

final BlkioStatsConfig blkioStats = statistics.getBlkioStats();
assertThat(blkioStats.getIoServiceBytesRecursive().size(), is(2));
assertThat(blkioStats.getIoServiceBytesRecursive().get(0).getValue(), is(26214L));
assertThat(blkioStats.getIoServicedRecursive().size(), is(2));
assertThat(blkioStats.getIoServiceBytesRecursive(), Matchers.<BlkioStatEntry>hasSize(5));
assertThat(blkioStats.getIoServiceBytesRecursive(), equalTo(Arrays.asList(
new BlkioStatEntry().withMajor(259L).withMinor(0L).withOp("Read").withValue(823296L),
new BlkioStatEntry().withMajor(259L).withMinor(0L).withOp("Write").withValue(122880L),
new BlkioStatEntry().withMajor(259L).withMinor(0L).withOp("Sync").withValue(835584L),
new BlkioStatEntry().withMajor(259L).withMinor(0L).withOp("Async").withValue(110592L),
new BlkioStatEntry().withMajor(259L).withMinor(0L).withOp("Total").withValue(946176L)
)));

assertThat(blkioStats.getIoServicedRecursive(), Matchers.<BlkioStatEntry>hasSize(5));
assertThat(blkioStats.getIoServicedRecursive(), equalTo(Arrays.asList(
new BlkioStatEntry().withMajor(259L).withMinor(0L).withOp("Read").withValue(145L),
new BlkioStatEntry().withMajor(259L).withMinor(0L).withOp("Write").withValue(4L),
new BlkioStatEntry().withMajor(259L).withMinor(0L).withOp("Sync").withValue(148L),
new BlkioStatEntry().withMajor(259L).withMinor(0L).withOp("Async").withValue(1L),
new BlkioStatEntry().withMajor(259L).withMinor(0L).withOp("Total").withValue(149L)
)));
assertThat(blkioStats.getIoQueueRecursive(), is(empty()));
assertThat(blkioStats.getIoServiceTimeRecursive(), is(empty()));
assertThat(blkioStats.getIoWaitTimeRecursive(), is(empty()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,68 @@
"current":2
},
"blkio_stats":{
"io_service_bytes_recursive": [
"io_service_bytes_recursive":[
{
"major": 8,
"minor": "0",
"op": "Read",
"value": 26214
"major":259,
"minor":0,
"op":"Read",
"value":823296
},
{
"major": 8,
"minor": "0",
"op": "Write",
"value": 26214
"major":259,
"minor":0,
"op":"Write",
"value":122880
},
{
"major":259,
"minor":0,
"op":"Sync",
"value":835584
},
{
"major":259,
"minor":0,
"op":"Async",
"value":110592
},
{
"major":259,
"minor":0,
"op":"Total",
"value":946176
}
],
"io_serviced_recursive": [
"io_serviced_recursive":[
{
"major":259,
"minor":0,
"op":"Read",
"value":145
},
{
"major":259,
"minor":0,
"op":"Write",
"value":4
},
{
"major":259,
"minor":0,
"op":"Sync",
"value":148
},
{
"major": 8,
"minor": 0,
"op": "Read",
"value": 41771
"major":259,
"minor":0,
"op":"Async",
"value":1
},
{
"major": 8,
"minor": 0,
"op": "Write",
"value": 72796
"major":259,
"minor":0,
"op":"Total",
"value":149
}
],
"io_queue_recursive":[
Expand Down Expand Up @@ -135,7 +171,8 @@
"unevictable":0,
"writeback":0
},
"limit":2095874048
"limit":2095874048,
"failcnt":0
},
"name":"/gallant_hamilton",
"id":"b581d78b03e41d81c9fe941f03f5d35e23733ff96370456b58d2906e002b0deb",
Expand Down