Add configs for Statistics API (#957) · Sandeep-source/docker-java@e110a4b · GitHub
Skip to content

Commit e110a4b

Browse files
yuting-liuKostyaSha
authored andcommitted
Add configs for Statistics API (docker-java#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

11 files changed

Lines changed: 1152 additions & 12 deletions

File tree

Lines changed: 106 additions & 0 deletions
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

0 commit comments

Comments
 (0)