Skip to content

Commit e110a4b

Browse files
yuting-liuKostyaSha
authored andcommitted
Add configs for Statistics API (#957)
* Add statistics network config for Statistics API * Update the structure of network * Add statistics Test * Chagne to is * Add MemoryStatsConfig for memoryStats * Add BlkioStatsConfig for blkioStats * Add CpuStatsConfig and pids_stats
1 parent c775539 commit e110a4b

File tree

11 files changed

+1152
-12
lines changed

11 files changed

+1152
-12
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
package com.github.dockerjava.api.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4+
import com.fasterxml.jackson.annotation.JsonProperty;
5+
6+
import javax.annotation.CheckForNull;
7+
import java.io.Serializable;
8+
import java.util.List;
9+
10+
/**
11+
* Used in {@link Statistics}
12+
*
13+
* @author Yuting Liu
14+
*/
15+
@JsonIgnoreProperties(ignoreUnknown = true)
16+
class BlkioStatsConfig implements Serializable {
17+
private static final long serialVersionUID = 1L;
18+
19+
@JsonProperty("io_service_bytes_recursive")
20+
private List<Long> ioServiceBytesRecursive;
21+
22+
@JsonProperty("io_serviced_recursive")
23+
private List<Long> ioServicedRecursive;
24+
25+
@JsonProperty("io_queue_recursive")
26+
private List<Long> ioQueueRecursive;
27+
28+
@JsonProperty("io_service_time_recursive")
29+
private List<Long> ioServiceTimeRecursive;
30+
31+
@JsonProperty("io_wait_time_recursive")
32+
private List<Long> ioWaitTimeRecursive;
33+
34+
@JsonProperty("io_merged_recursive")
35+
private List<Long> ioMergedRecursive;
36+
37+
@JsonProperty("io_time_recursive")
38+
private List<Long> ioTimeRecursive;
39+
40+
@JsonProperty("sectors_recursive")
41+
private List<Long> sectorsRecursive;
42+
43+
/**
44+
* @see #ioServiceBytesRecursive
45+
*/
46+
@CheckForNull
47+
public List<Long> getIoServiceBytesRecursive() {
48+
return ioServiceBytesRecursive;
49+
}
50+
51+
/**
52+
* @see #ioServicedRecursive
53+
*/
54+
@CheckForNull
55+
public List<Long> getIoServicedRecursive() {
56+
return ioServicedRecursive;
57+
}
58+
59+
/**
60+
* @see #ioQueueRecursive
61+
*/
62+
@CheckForNull
63+
public List<Long> getIoQueueRecursive() {
64+
return ioQueueRecursive;
65+
}
66+
67+
/**
68+
* @see #ioServiceTimeRecursive
69+
*/
70+
@CheckForNull
71+
public List<Long> getIoServiceTimeRecursive() {
72+
return ioServiceTimeRecursive;
73+
}
74+
75+
/**
76+
* @see #ioWaitTimeRecursive
77+
*/
78+
@CheckForNull
79+
public List<Long> getIoWaitTimeRecursive() {
80+
return ioWaitTimeRecursive;
81+
}
82+
83+
/**
84+
* @see #ioMergedRecursive
85+
*/
86+
@CheckForNull
87+
public List<Long> getIoMergedRecursive() {
88+
return ioMergedRecursive;
89+
}
90+
91+
/**
92+
* @see #ioTimeRecursive
93+
*/
94+
@CheckForNull
95+
public List<Long> getIoTimeRecursive() {
96+
return ioTimeRecursive;
97+
}
98+
99+
/**
100+
* @see #sectorsRecursive
101+
*/
102+
@CheckForNull
103+
public List<Long> getSectorsRecursive() {
104+
return sectorsRecursive;
105+
}
106+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package com.github.dockerjava.api.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4+
import com.fasterxml.jackson.annotation.JsonProperty;
5+
6+
import javax.annotation.CheckForNull;
7+
import java.io.Serializable;
8+
9+
/**
10+
* Used in {@link Statistics}
11+
*
12+
* @author Yuting Liu
13+
*/
14+
@JsonIgnoreProperties(ignoreUnknown = true)
15+
class CpuStatsConfig implements Serializable {
16+
private static final long serialVersionUID = 1L;
17+
18+
@JsonProperty("cpu_usage")
19+
private CpuUsageConfig cpuUsage;
20+
21+
@JsonProperty("system_cpu_usage")
22+
private Long systemCpuUsage;
23+
24+
@JsonProperty("online_cpus")
25+
private Long onlineCpus;
26+
27+
@JsonProperty("throttling_data")
28+
private ThrottlingDataConfig throttlingData;
29+
30+
/**
31+
* @see #cpuUsage
32+
*/
33+
@CheckForNull
34+
public CpuUsageConfig getCpuUsage() {
35+
return cpuUsage;
36+
}
37+
38+
/**
39+
* @see #systemCpuUsage
40+
*/
41+
@CheckForNull
42+
public Long getSystemCpuUsage() {
43+
return systemCpuUsage;
44+
}
45+
46+
/**
47+
* @see #onlineCpus
48+
*/
49+
@CheckForNull
50+
public Long getOnlineCpus() {
51+
return onlineCpus;
52+
}
53+
54+
/**
55+
* @see #throttlingData
56+
*/
57+
@CheckForNull
58+
public ThrottlingDataConfig getThrottlingData() {
59+
return throttlingData;
60+
}
61+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package com.github.dockerjava.api.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4+
import com.fasterxml.jackson.annotation.JsonProperty;
5+
6+
import javax.annotation.CheckForNull;
7+
import java.io.Serializable;
8+
import java.util.List;
9+
10+
/**
11+
* Used in {@link Statistics}
12+
*
13+
* @author Yuting Liu
14+
*/
15+
@JsonIgnoreProperties(ignoreUnknown = true)
16+
class CpuUsageConfig implements Serializable {
17+
private static final long serialVersionUID = 1L;
18+
19+
@JsonProperty("total_usage")
20+
private Long totalUsage;
21+
22+
@JsonProperty("percpu_usage")
23+
private List<Long> percpuUsage;
24+
25+
@JsonProperty("usage_in_kernelmode")
26+
private Long usageInKernelmode;
27+
28+
@JsonProperty("usage_in_usermode")
29+
private Long usageInUsermode;
30+
31+
/**
32+
* @see #totalUsage
33+
*/
34+
@CheckForNull
35+
public Long getTotalUsage() {
36+
return totalUsage;
37+
}
38+
39+
/**
40+
* @see #percpuUsage
41+
*/
42+
@CheckForNull
43+
public List<Long> getPercpuUsage() {
44+
return percpuUsage;
45+
}
46+
47+
/**
48+
* @see #usageInKernelmode
49+
*/
50+
@CheckForNull
51+
public Long getUsageInKernelmode() {
52+
return usageInKernelmode;
53+
}
54+
55+
/**
56+
* @see #usageInUsermode
57+
*/
58+
@CheckForNull
59+
public Long getUsageInUsermode() {
60+
return usageInUsermode;
61+
}
62+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package com.github.dockerjava.api.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4+
import com.fasterxml.jackson.annotation.JsonProperty;
5+
6+
import javax.annotation.CheckForNull;
7+
import java.io.Serializable;
8+
9+
/**
10+
* Used in {@link Statistics}
11+
*
12+
* @author Yuting Liu
13+
*/
14+
@JsonIgnoreProperties(ignoreUnknown = true)
15+
class MemoryStatsConfig implements Serializable {
16+
private static final long serialVersionUID = 1L;
17+
18+
@JsonProperty("usage")
19+
private Long usage;
20+
21+
@JsonProperty("max_usage")
22+
private Long maxUsage;
23+
24+
@JsonProperty("stats")
25+
private StatsConfig stats;
26+
27+
@JsonProperty("limit")
28+
private Long limit;
29+
30+
/**
31+
* @see #usage
32+
*/
33+
@CheckForNull
34+
public Long getUsage() {
35+
return usage;
36+
}
37+
38+
/**
39+
* @see #maxUsage
40+
*/
41+
@CheckForNull
42+
public Long getMaxUsage() {
43+
return maxUsage;
44+
}
45+
46+
/**
47+
* @see #stats
48+
*/
49+
@CheckForNull
50+
public StatsConfig getStats() {
51+
return stats;
52+
}
53+
54+
/**
55+
* @see #limit
56+
*/
57+
@CheckForNull
58+
public Long getLimit() {
59+
return limit;
60+
}
61+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.github.dockerjava.api.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
5+
import javax.annotation.CheckForNull;
6+
import java.io.Serializable;
7+
8+
/**
9+
* Used in {@link Statistics}
10+
*
11+
* @author Yuting Liu
12+
*/
13+
class PidsStatsConfig implements Serializable {
14+
private static final long serialVersionUID = 1L;
15+
16+
@JsonProperty("current")
17+
private Long current;
18+
19+
/**
20+
* @see #current
21+
*/
22+
@CheckForNull
23+
public Long getCurrent() {
24+
return current;
25+
}
26+
}

0 commit comments

Comments
 (0)