Skip to content

Network stats is null #382

@cosu

Description

@cosu

I'm using the StatsCmd to pull stats from a running docker container. All stats are present except for the network statistics. I'm testing against docker version 1.9 (machine/boot2docker) running with docker-java 2.1.2

2015-11-24 11:24:43,808 DEBUG r.c.v.c.e.docker.DockerExecutor [] []- Received stats #2: com.github.dockerjava.api.model.Statistics@2c1e3fba[read=2015-11-24T10:24:43.802284194Z
,networkStats=<null>,memoryStats={usage=14782464, max_usage=14782464, stats={active_anon=0, active_file=14635008, cache=14696448, hierarchical_memory_limit=9223372036854771712, hierarchical_memsw_limit=9223372036854771712, inactive_anon=53248, inactive_file=57344, mapped_file=45056, pgfault=1713, pgmajfault=1, pgpgin=5048, pgpgout=1447, rss=53248, rss_huge=0, swap=0, total_active_anon=0, total_active_file=14635008, total_cache=14696448, total_inactive_anon=53248, total_inactive_file=57344, total_mapped_file=45056, total_pgfault=1713, total_pgmajfault=1, total_pgpgin=5048, total_pgpgout=1447, total_rss=53248, total_rss_huge=0, total_swap=0, total_unevictable=0, total_writeback=0, unevictable=0, writeback=0}, failcnt=0, limit=1044160512},blkioStats={io_service_bytes_recursive=[{major=8, minor=0, op=Read, value=49152}, {major=8, minor=0, op=Write, value=0}, {major=8, minor=0, op=Sync, value=0}, {major=8, minor=0, op=Async, value=49152}, {major=8, minor=0, op=Total, value=49152}], io_serviced_recursive=[{major=8, minor=0, op=Read, value=2}, {major=8, minor=0, op=Write, value=0}, {major=8, minor=0, op=Sync, value=0}, {major=8, minor=0, op=Async, value=2}, {major=8, minor=0, op=Total, value=2}], io_queue_recursive=[], io_service_time_recursive=[], io_wait_time_recursive=[], io_merged_recursive=[], io_time_recursive=[], sectors_recursive=[]},cpuStats={cpu_usage={total_usage=353197358, percpu_usage=[353197358, 0, 0, 0], usage_in_kernelmode=180000000, usage_in_usermode=20000000}, system_cpu_usage=54367350000000, throttling_data={periods=0, throttled_periods=0, throttled_time=0}}]

the code which produces this is pretty much the one in the tests:

        dockerClient.statsCmd().withContainerId(id).exec(statsCallback);

[..]

 private class StatsCallback extends ResultCallbackTemplate<StatsCallback, Statistics> {


        List<Statistics> statisticsList = new LinkedList<>();

        @Override
        public void onNext(Statistics stats) {
            LOG.debug("Received stats #{}: {}", statisticsList.size(), stats);
            LOG.debug("network {}", stats.getNetworkStats());
            statisticsList.add(stats);
        }

        public List<Statistics> getStatisticsList() {
            return statisticsList;
        }
    }

Debug output


2015-11-24 11:35:32,799 DEBUG c.g.d.jaxrs.DockerCmdExecFactoryImpl [] []- 2 * Client response received on thread pool-2-thread-1
2 < 200
2 < Content-Length: -1
2 < Content-Type: application/json; charset=utf-8
2 < Date: Tue, 24 Nov 2015 10:35:32 GMT
2 < Server: Docker/1.9.0 (linux)
2 < Transfer-Encoding: chunked
{"read":"2015-11-24T10:35:32.802091898Z","precpu_stats":{"cpu_usage":{"total_usage":0,"percpu_usage":null,"usage_in_kernelmode":0,"usage_in_usermode":0},"system_cpu_usage":0,"throttling_data":{"periods":0,"throttled_periods":0,"throttled_time":0}},"cpu_stats":{"cpu_usage":{"total_usage":29378848,"percpu_usage":[29378848,0,0,0],"usage_in_kernelmode":0,"usage_in_usermode":20000000},"system_cpu_usage":56960550000000,"throttling_data":{"periods":0,"throttled_periods":0,"throttled_time":0}},"memory_stats":{"usage":122880,"max_usage":6160384,"stats":{"active_anon":49152,"active_file":16384,"cache":53248,"hierarchical_memory_limit":9223372036854771712,"hierarchical_memsw_limit":9223372036854771712,"inactive_anon":0,"inactive_file":0,"mapped_file":0,"pgfault":1764,"pgmajfault":0,"pgpgin":1499,"pgpgout":1474,"rss":49152,"rss_huge":0,"swap":0,"total_active_anon":49152,"total_active_file":16384,"total_cache":53248,"total_inactive_anon":0,"total_inactive_file":0,"total_mapped_file":0,"total_pgfault":1764,"total_pgmajfault":0,"total_pgpgin":1499,"total_pgpgout":1474,"total_rss":49152,"total_rss_huge":0,"total_swap":0,"total_unevictable":0,"total_writeback":0,"unevictable":0,"writeback":0},"failcnt":0,"limit":1044160512},"blkio_stats":{"io_service_bytes_recursive":[],"io_serviced_recursive":[],"io_queue_recursive":[],"io_service_time_recursive":[],"io_wait_time_recursive":[],"io_merged_recursive":[],"io_time_recursive":[],"sectors_recursive":[]},"networks":{"eth0":{"rx_bytes":51729,"rx_packets":41,"rx_errors":0,"rx_dropped":0,"tx_bytes":2205,"tx_packets":36,"tx_errors":0,"tx_dropped":0}}}

LE:

it seems that the json field name is networks (plural) while Statistics.java expects network ( singular)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions