Question about telegraf: docker-container-status / exitcode

Hello,

https://github.com/influxdata/telegraf/tree/master/plugins/inputs/docker includes docker-container-status/exitcode.

What I am wondering about is: My telegraf interval is 1m. When a container stops in the middle of the interval (at 30s) , how does telegraf get the exitcode?

I have tried to reproduce that:

docker run --name test ubuntu:20.04 bash -c 'cat /etc/os-release && false'
docker ps -a | grep test
96a319d0c35a        ubuntu:20.04           "bash -c 'cat /etc/o…"   9 minutes ago       Exited (1) 9 min
root@telegraf-master-hw9nh:/# telegraf -config /etc/telegraf/telegraf.conf --test --input-filter docker | grep 96a319d0c35a2020-09-03T10:42:20Z I! Starting Telegraf 1.14.4
root@telegraf-master-hw9nh:/# telegraf -config /etc/telegraf/telegraf.conf --test --input-filter docker | grep test
2020-09-03T10:42:25Z I! Starting Telegraf 1.14.4

Another check:

# docker ps -a | grep dump
fefe073ba93d        22d7ce4ba34f                                           "bash /usr/local/bin…"   14 minutes ago      Exited (0) 14 minutes ago                          k8s_rsync_backup-rsync-dumps-1599129540-8gks4_myproject-portal-production_013427b6-16cf-4585-b4c6-1ae098474cbc_0
6be8cb2ab3ed        22d7ce4ba34f                                           "bash -c 'mkdir -p /…"   14 minutes ago      Exited (0) 14 minutes ago                          k8s_init-ssh-keys_backup-rsync-dumps-1599129540-8gks4_myproject-portal-production_013427b6-16cf-4585-b4c6-1ae098474cbc_0
286ca5c57f1f        k8s.gcr.io/pause:3.1                                   "/pause"                 15 minutes ago      Exited (0) 14 minutes ago                          k8s_POD_backup-rsync-dumps-1599129540-8gks4_myproject-portal-production_013427b6-16cf-4585-b4c6-1ae098474cbc_0
18ffc970e7df        d68c7fdf7b1e                                           "bash /usr/local/bin…"   28 minutes ago      Exited (0) 28 minutes ago                          k8s_dump_dump-mysql-myproject-portal-1599128700-578vq_myproject-portal-production_3db0e27f-2caf-4a2d-8ad5-026f46072703_0
af3dbab1ec56        d68c7fdf7b1e                                           "bash /usr/local/bin…"   28 minutes ago      Exited (0) 28 minutes ago                          k8s_dump_dump-mysql-pdns-1599128700-9lt42_myproject-portal-production_2270e3fd-f264-409f-876d-7c6c2d9aa147_0
ed06ba343f18        k8s.gcr.io/pause:3.1                                   "/pause"                 28 minutes ago      Exited (0) 28 minutes ago                          k8s_POD_dump-mysql-myproject-portal-1599128700-578vq_myproject-portal-production_3db0e27f-2caf-4a2d-8ad5-026f46072703_0
e41ee2051fca        k8s.gcr.io/pause:3.1                                   "/pause"                 28 minutes ago      Exited (0) 28 minutes ago                          k8s_POD_dump-mysql-pdns-1599128700-9lt42_myproject-portal-production_2270e3fd-f264-409f-876d-7c6c2d9aa147_0
791c15c3703f        22d7ce4ba34f                                           "bash /usr/local/bin…"   About an hour ago   Exited (0) About an hour ago                       k8s_rsync_backup-rsync-dumps-1599125940-qcpgj_myproject-portal-production_0d2f4856-35a5-4a95-9aa9-a4eac93716a8_0
3fb49f8635b1        22d7ce4ba34f                                           "bash -c 'mkdir -p /…"   About an hour ago   Exited (0) About an hour ago                       k8s_init-ssh-keys_backup-rsync-dumps-1599125940-qcpgj_myproject-portal-production_0d2f4856-35a5-4a95-9aa9-a4eac93716a8_0
35f7fc28334d        k8s.gcr.io/pause:3.1                                   "/pause"                 About an hour ago   Exited (0) About an hour ago                       k8s_POD_backup-rsync-dumps-1599125940-qcpgj_myproject-portal-production_0d2f4856-35a5-4a95-9aa9-a4eac93716a8_0
f12726703307        d68c7fdf7b1e                                           "bash /usr/local/bin…"   About an hour ago   Exited (0) About an hour ago                       k8s_dump_dump-mysql-myproject-portal-1599125100-sqhlr_myproject-portal-production_87aaf055-da9b-4fcc-b2ce-2edb59df14bf_0
1c305402f2ea        d68c7fdf7b1e                                           "bash /usr/local/bin…"   About an hour ago   Exited (0) About an hour ago                       k8s_dump_dump-mysql-pdns-1599125100-52kk5_myproject-portal-production_9565a965-c086-439a-8b00-4bab5909637a_0
845f3b85a79f        k8s.gcr.io/pause:3.1                                   "/pause"                 About an hour ago   Exited (0) About an hour ago                       k8s_POD_dump-mysql-myproject-portal-1599125100-sqhlr_myproject-portal-production_87aaf055-da9b-4fcc-b2ce-2edb59df14bf_0
0838cde76e4c        k8s.gcr.io/pause:3.1                                   "/pause"                 About an hour ago   Exited (0) About an hour ago                       k8s_POD_dump-mysql-pdns-1599125100-52kk5_myproject-portal-production_9565a965-c086-439a-8b00-4bab5909637a_0
4cb26dfe372f        22d7ce4ba34f                                           "bash /usr/local/bin…"   2 hours ago         Exited (0) 2 hours ago                             k8s_rsync_backup-rsync-dumps-1599122340-26xkb_myproject-portal-production_0e7a422e-2004-473f-8454-52f393d4e691_0
7294c671a76f        22d7ce4ba34f                                           "bash -c 'mkdir -p /…"   2 hours ago         Exited (0) 2 hours ago                             k8s_init-ssh-keys_backup-rsync-dumps-1599122340-26xkb_myproject-portal-production_0e7a422e-2004-473f-8454-52f393d4e691_0
50787e313ba5        k8s.gcr.io/pause:3.1                                   "/pause"                 2 hours ago         Exited (0) 2 hours ago                             k8s_POD_backup-rsync-dumps-1599122340-26xkb_myproject-portal-production_0e7a422e-2004-473f-8454-52f393d4e691_0
0db0c3123d4e        d68c7fdf7b1e                                           "bash /usr/local/bin…"   2 hours ago         Exited (0) 2 hours ago                             k8s_dump_dump-mysql-myproject-portal-1599121500-rw7xh_myproject-portal-production_a3acc82d-7862-47d7-8452-871b71144104_0
2a41eefcd644        d68c7fdf7b1e                                           "bash /usr/local/bin…"   2 hours ago         Exited (0) 2 hours ago                             k8s_dump_dump-mysql-pdns-1599121500-htcng_myproject-portal-production_fa2fd2f9-0933-4571-91d2-8793f0acd034_0
2f82c9ef2598        k8s.gcr.io/pause:3.1                                   "/pause"                 2 hours ago         Exited (0) 2 hours ago                             k8s_POD_dump-mysql-myproject-portal-1599121500-rw7xh_myproject-portal-production_a3acc82d-7862-47d7-8452-871b71144104_0
496c75332ffe        k8s.gcr.io/pause:3.1                                   "/pause"                 2 hours ago         Exited (0) 2 hours ago                             k8s_POD_dump-mysql-pdns-1599121500-htcng_myproject-portal-production_fa2fd2f9-0933-4571-91d2-8793f0acd034_0

.

# telegraf -config /etc/telegraf/telegraf.conf --test --input-filter docker | grep dump
2020-09-03T10:56:05Z I! Starting Telegraf 1.14.5

.

[global_tags]
  environment = "production"
  engine = "zwei"
  role = "node"

# Configuration for telegraf agent
[agent]
  logfile  = "/var/log/telegraf/telegraf.log"
  interval  = "1m"
  round_interval = true
  debug = false
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = "0s"
  flush_interval = "10s"
  flush_jitter = "0s"
  precision = ""
  quiet = true
  hostname = ""
  omit_hostname = false

  [[inputs.docker]]
     endpoint = "unix:///var/run/docker.sock"
     timeout = "10s"
     total = true

# ---------- snip

Got it working with telegraf 1.15.3