Skip to content

Commit

Permalink
Update blkio stats for newer versions of docker
Browse files Browse the repository at this point in the history
Fixes lebauce#50

Newer versions of docker include a discard metric for blkio stats
  • Loading branch information
sjpalf committed Mar 14, 2022
1 parent cd0257a commit e9583ff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion dockerplugin.db
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
blkio read:COUNTER:0:U, write:COUNTER:0:U, sync:COUNTER:0:U, async:COUNTER:0:U, total:COUNTER:0:U
blkio read:COUNTER:0:U, write:COUNTER:0:U, sync:COUNTER:0:U, async:COUNTER:0:U, discard:COUNTER:0:U, total:COUNTER:0:U
blkio.old read:COUNTER:0:U, write:COUNTER:0:U, sync:COUNTER:0:U, async:COUNTER:0:U, total:COUNTER:0:U
blkio.single value:COUNTER:0:U
cpu.percpu.usage value:COUNTER:0:U
cpu.usage total:COUNTER:0:U, kernelmode:COUNTER:0:U, usermode:COUNTER:0:U, system:COUNTER:0:U
Expand Down
5 changes: 4 additions & 1 deletion dockerplugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,12 @@ def read(cls, container, stats, t):
device_stats[k].append(value['value'])

for type_instance, values in device_stats.items():
if len(values) == 5:
if len(values) == 6:
cls.emit(container, 'blkio', values,
type_instance=type_instance, t=t)
elif len(values) == 5:
cls.emit(container, 'blkio.old', values,
type_instance=type_instance, t=t)
elif len(values) == 1:
# For some reason, some fields contains only one value and
# the 'op' field is empty. Need to investigate this
Expand Down

0 comments on commit e9583ff

Please sign in to comment.