Skip to content
Closed
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
32 changes: 16 additions & 16 deletions src/main/java/com/github/dockerjava/api/model/BlkioStatsConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,90 +17,90 @@ class BlkioStatsConfig implements Serializable {
private static final long serialVersionUID = 1L;

@JsonProperty("io_service_bytes_recursive")
private List<Long> ioServiceBytesRecursive;
private List<IoRecursiveConfig> ioServiceBytesRecursive;

@JsonProperty("io_serviced_recursive")
private List<Long> ioServicedRecursive;
private List<IoRecursiveConfig> ioServicedRecursive;

@JsonProperty("io_queue_recursive")
private List<Long> ioQueueRecursive;
private List<IoRecursiveConfig> ioQueueRecursive;

@JsonProperty("io_service_time_recursive")
private List<Long> ioServiceTimeRecursive;
private List<IoRecursiveConfig> ioServiceTimeRecursive;

@JsonProperty("io_wait_time_recursive")
private List<Long> ioWaitTimeRecursive;
private List<IoRecursiveConfig> ioWaitTimeRecursive;

@JsonProperty("io_merged_recursive")
private List<Long> ioMergedRecursive;
private List<IoRecursiveConfig> ioMergedRecursive;

@JsonProperty("io_time_recursive")
private List<Long> ioTimeRecursive;
private List<IoRecursiveConfig> ioTimeRecursive;

@JsonProperty("sectors_recursive")
private List<Long> sectorsRecursive;
private List<IoRecursiveConfig> sectorsRecursive;

/**
* @see #ioServiceBytesRecursive
*/
@CheckForNull
public List<Long> getIoServiceBytesRecursive() {
public List<IoRecursiveConfig> getIoServiceBytesRecursive() {
return ioServiceBytesRecursive;
}

/**
* @see #ioServicedRecursive
*/
@CheckForNull
public List<Long> getIoServicedRecursive() {
public List<IoRecursiveConfig> getIoServicedRecursive() {
return ioServicedRecursive;
}

/**
* @see #ioQueueRecursive
*/
@CheckForNull
public List<Long> getIoQueueRecursive() {
public List<IoRecursiveConfig> getIoQueueRecursive() {
return ioQueueRecursive;
}

/**
* @see #ioServiceTimeRecursive
*/
@CheckForNull
public List<Long> getIoServiceTimeRecursive() {
public List<IoRecursiveConfig> getIoServiceTimeRecursive() {
return ioServiceTimeRecursive;
}

/**
* @see #ioWaitTimeRecursive
*/
@CheckForNull
public List<Long> getIoWaitTimeRecursive() {
public List<IoRecursiveConfig> getIoWaitTimeRecursive() {
return ioWaitTimeRecursive;
}

/**
* @see #ioMergedRecursive
*/
@CheckForNull
public List<Long> getIoMergedRecursive() {
public List<IoRecursiveConfig> getIoMergedRecursive() {
return ioMergedRecursive;
}

/**
* @see #ioTimeRecursive
*/
@CheckForNull
public List<Long> getIoTimeRecursive() {
public List<IoRecursiveConfig> getIoTimeRecursive() {
return ioTimeRecursive;
}

/**
* @see #sectorsRecursive
*/
@CheckForNull
public List<Long> getSectorsRecursive() {
public List<IoRecursiveConfig> getSectorsRecursive() {
return sectorsRecursive;
}
}
104 changes: 104 additions & 0 deletions src/main/java/com/github/dockerjava/api/model/IoRecursiveConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
package com.github.dockerjava.api.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import javax.annotation.CheckForNull;
import java.io.Serializable;

@JsonIgnoreProperties(ignoreUnknown = true)
public class IoRecursiveConfig implements Serializable {
private static final long serialVersionUID = 1L;

@JsonProperty("major")
private Long major;

@JsonProperty("minor")
private Long minor;

@JsonProperty("op")
private String op;

@JsonProperty("value")
private Long value;

/**
* @see #major
*/
@CheckForNull
public Long getMajor() {
return major;
}

/**
* @see #minor
*/
@CheckForNull
public Long getMinor() {
return minor;
}

/**
* @see #op
*/
public String getOp() {
return op;
}

/**
* @see #value
*/
public Long getValue() {
return value;
}

/**
* @see #major
*/
public IoRecursiveConfig withMajor(Long major) {
this.major = major;
return this;
}

/**
* @see #minor
*/
public IoRecursiveConfig withMinor(Long minor) {
this.minor = minor;
return this;
}

/**
* @see #op
*/
public IoRecursiveConfig withOp(String op) {
this.op = op;
return this;
}

/**
* @see #value
*/
public IoRecursiveConfig withValue(Long value) {
this.value = value;
return this;
}

@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
}

@Override
public boolean equals(Object o) {
return EqualsBuilder.reflectionEquals(this, o);
}

@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,29 @@
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
4 changes: 2 additions & 2 deletions src/main/java/com/github/dockerjava/api/model/Statistics.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class Statistics implements Serializable {
*/
@Deprecated
@JsonProperty("network")
private Map<String, StatisticNetWorksConfig> network;
private StatisticNetWorksConfig network;

@JsonProperty("memory_stats")
private MemoryStatsConfig memoryStats;
Expand Down Expand Up @@ -74,7 +74,7 @@ public Map<String, StatisticNetWorksConfig> getNetworks() {
* @deprecated as of Docker Remote API 1.21, replaced by {@link #getNetworks()}
*/
@Deprecated
public Map<String, StatisticNetWorksConfig> getNetwork() {
public StatisticNetWorksConfig getNetwork() {
return network;
}

Expand Down
17 changes: 15 additions & 2 deletions src/test/java/com/github/dockerjava/api/model/StatisticsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,23 @@ 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(), is(empty()));
assertThat(blkioStats.getIoServicedRecursive(), is(empty()));
assertThat(blkioStats.getIoServiceBytesRecursive(), equalTo(Arrays.asList(
new IoRecursiveConfig().withMajor(259L).withMinor(0L).withOp("Read").withValue(823296L),
new IoRecursiveConfig().withMajor(259L).withMinor(0L).withOp("Write").withValue(122880L),
new IoRecursiveConfig().withMajor(259L).withMinor(0L).withOp("Sync").withValue(835584L),
new IoRecursiveConfig().withMajor(259L).withMinor(0L).withOp("Async").withValue(110592L),
new IoRecursiveConfig().withMajor(259L).withMinor(0L).withOp("Total").withValue(946176L)
)));
assertThat(blkioStats.getIoServicedRecursive(), equalTo(Arrays.asList(
new IoRecursiveConfig().withMajor(259L).withMinor(0L).withOp("Read").withValue(145L),
new IoRecursiveConfig().withMajor(259L).withMinor(0L).withOp("Write").withValue(4L),
new IoRecursiveConfig().withMajor(259L).withMinor(0L).withOp("Sync").withValue(148L),
new IoRecursiveConfig().withMajor(259L).withMinor(0L).withOp("Async").withValue(1L),
new IoRecursiveConfig().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 @@ -6,10 +6,68 @@
},
"blkio_stats":{
"io_service_bytes_recursive":[

{
"major":259,
"minor":0,
"op":"Read",
"value":823296
},
{
"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":[

{
"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":259,
"minor":0,
"op":"Async",
"value":1
},
{
"major":259,
"minor":0,
"op":"Total",
"value":149
}
],
"io_queue_recursive":[

Expand Down Expand Up @@ -113,7 +171,8 @@
"unevictable":0,
"writeback":0
},
"limit":2095874048
"limit":2095874048,
"failcnt":0
},
"name":"/gallant_hamilton",
"id":"b581d78b03e41d81c9fe941f03f5d35e23733ff96370456b58d2906e002b0deb",
Expand Down