Skip to content

Commit 66232b6

Browse files
authored
Merge pull request docker-java#1109 from KostyaSha/pull/969/head
Pull/969/head
2 parents e1957d7 + d7ccfa6 commit 66232b6

File tree

3 files changed

+91
-28
lines changed

3 files changed

+91
-28
lines changed

src/main/java/com/github/dockerjava/api/model/MemoryStatsConfig.java

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,29 @@
1515
public class MemoryStatsConfig implements Serializable {
1616
private static final long serialVersionUID = 1L;
1717

18+
@JsonProperty("stats")
19+
private StatsConfig stats;
20+
1821
@JsonProperty("usage")
1922
private Long usage;
2023

2124
@JsonProperty("max_usage")
2225
private Long maxUsage;
2326

24-
@JsonProperty("stats")
25-
private StatsConfig stats;
27+
@JsonProperty("failcnt")
28+
private Long failcnt;
2629

2730
@JsonProperty("limit")
2831
private Long limit;
2932

33+
/**
34+
* @see #stats
35+
*/
36+
@CheckForNull
37+
public StatsConfig getStats() {
38+
return stats;
39+
}
40+
3041
/**
3142
* @see #usage
3243
*/
@@ -44,11 +55,10 @@ public Long getMaxUsage() {
4455
}
4556

4657
/**
47-
* @see #stats
58+
* @see #failcnt
4859
*/
49-
@CheckForNull
50-
public StatsConfig getStats() {
51-
return stats;
60+
public Long getFailcnt() {
61+
return failcnt;
5262
}
5363

5464
/**

src/test/java/com/github/dockerjava/api/model/StatisticsTest.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.fasterxml.jackson.databind.JavaType;
44
import com.fasterxml.jackson.databind.ObjectMapper;
55
import com.github.dockerjava.core.RemoteApiVersion;
6+
import org.hamcrest.Matchers;
67
import org.junit.Test;
78

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

8485
assertThat(memoryStats.getLimit(), is(2095874048L));
86+
assertThat(memoryStats.getFailcnt(), is(0L));
8587

8688
final BlkioStatsConfig blkioStats = statistics.getBlkioStats();
87-
assertThat(blkioStats.getIoServiceBytesRecursive().size(), is(2));
88-
assertThat(blkioStats.getIoServiceBytesRecursive().get(0).getValue(), is(26214L));
89-
assertThat(blkioStats.getIoServicedRecursive().size(), is(2));
89+
assertThat(blkioStats.getIoServiceBytesRecursive(), Matchers.<BlkioStatEntry>hasSize(5));
90+
assertThat(blkioStats.getIoServiceBytesRecursive(), equalTo(Arrays.asList(
91+
new BlkioStatEntry().withMajor(259L).withMinor(0L).withOp("Read").withValue(823296L),
92+
new BlkioStatEntry().withMajor(259L).withMinor(0L).withOp("Write").withValue(122880L),
93+
new BlkioStatEntry().withMajor(259L).withMinor(0L).withOp("Sync").withValue(835584L),
94+
new BlkioStatEntry().withMajor(259L).withMinor(0L).withOp("Async").withValue(110592L),
95+
new BlkioStatEntry().withMajor(259L).withMinor(0L).withOp("Total").withValue(946176L)
96+
)));
97+
98+
assertThat(blkioStats.getIoServicedRecursive(), Matchers.<BlkioStatEntry>hasSize(5));
99+
assertThat(blkioStats.getIoServicedRecursive(), equalTo(Arrays.asList(
100+
new BlkioStatEntry().withMajor(259L).withMinor(0L).withOp("Read").withValue(145L),
101+
new BlkioStatEntry().withMajor(259L).withMinor(0L).withOp("Write").withValue(4L),
102+
new BlkioStatEntry().withMajor(259L).withMinor(0L).withOp("Sync").withValue(148L),
103+
new BlkioStatEntry().withMajor(259L).withMinor(0L).withOp("Async").withValue(1L),
104+
new BlkioStatEntry().withMajor(259L).withMinor(0L).withOp("Total").withValue(149L)
105+
)));
90106
assertThat(blkioStats.getIoQueueRecursive(), is(empty()));
91107
assertThat(blkioStats.getIoServiceTimeRecursive(), is(empty()));
92108
assertThat(blkioStats.getIoWaitTimeRecursive(), is(empty()));

src/test/resources/samples/1.27/containers/container/stats/stats1.json

Lines changed: 56 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,68 @@
55
"current":2
66
},
77
"blkio_stats":{
8-
"io_service_bytes_recursive": [
8+
"io_service_bytes_recursive":[
99
{
10-
"major": 8,
11-
"minor": "0",
12-
"op": "Read",
13-
"value": 26214
10+
"major":259,
11+
"minor":0,
12+
"op":"Read",
13+
"value":823296
1414
},
1515
{
16-
"major": 8,
17-
"minor": "0",
18-
"op": "Write",
19-
"value": 26214
16+
"major":259,
17+
"minor":0,
18+
"op":"Write",
19+
"value":122880
20+
},
21+
{
22+
"major":259,
23+
"minor":0,
24+
"op":"Sync",
25+
"value":835584
26+
},
27+
{
28+
"major":259,
29+
"minor":0,
30+
"op":"Async",
31+
"value":110592
32+
},
33+
{
34+
"major":259,
35+
"minor":0,
36+
"op":"Total",
37+
"value":946176
2038
}
2139
],
22-
"io_serviced_recursive": [
40+
"io_serviced_recursive":[
41+
{
42+
"major":259,
43+
"minor":0,
44+
"op":"Read",
45+
"value":145
46+
},
47+
{
48+
"major":259,
49+
"minor":0,
50+
"op":"Write",
51+
"value":4
52+
},
53+
{
54+
"major":259,
55+
"minor":0,
56+
"op":"Sync",
57+
"value":148
58+
},
2359
{
24-
"major": 8,
25-
"minor": 0,
26-
"op": "Read",
27-
"value": 41771
60+
"major":259,
61+
"minor":0,
62+
"op":"Async",
63+
"value":1
2864
},
2965
{
30-
"major": 8,
31-
"minor": 0,
32-
"op": "Write",
33-
"value": 72796
66+
"major":259,
67+
"minor":0,
68+
"op":"Total",
69+
"value":149
3470
}
3571
],
3672
"io_queue_recursive":[
@@ -135,7 +171,8 @@
135171
"unevictable":0,
136172
"writeback":0
137173
},
138-
"limit":2095874048
174+
"limit":2095874048,
175+
"failcnt":0
139176
},
140177
"name":"/gallant_hamilton",
141178
"id":"b581d78b03e41d81c9fe941f03f5d35e23733ff96370456b58d2906e002b0deb",

0 commit comments

Comments
 (0)