fix(inputs.docker): Add restart count (#13646)

This commit is contained in:
Joshua Powers 2023-07-24 01:25:31 -06:00 committed by GitHub
parent cb354a9d9a
commit 54b1009a9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 29 deletions

View File

@ -518,6 +518,7 @@ func (d *Docker) gatherContainerInspect(
"oomkilled": info.State.OOMKilled,
"pid": info.State.Pid,
"exitcode": info.State.ExitCode,
"restart_count": info.RestartCount,
"container_id": container.ID,
}

View File

@ -755,6 +755,7 @@ func TestContainerStatus(t *testing.T) {
map[string]interface{}{
"oomkilled": false,
"pid": 1234,
"restart_count": 0,
"exitcode": 0,
"container_id": "e2173b9478a6ae55e237d4d74f8bbb753f0817192b5081334dc78476296b7dfb",
"started_at": time.Date(2018, 6, 14, 5, 48, 53, 266176036, time.UTC).UnixNano(),
@ -792,6 +793,7 @@ func TestContainerStatus(t *testing.T) {
"oomkilled": false,
"pid": 1234,
"exitcode": 0,
"restart_count": 0,
"container_id": "e2173b9478a6ae55e237d4d74f8bbb753f0817192b5081334dc78476296b7dfb",
"started_at": time.Date(2018, 6, 14, 5, 48, 53, 266176036, time.UTC).UnixNano(),
"finished_at": time.Date(2018, 6, 14, 5, 53, 53, 266176036, time.UTC).UnixNano(),
@ -830,6 +832,7 @@ func TestContainerStatus(t *testing.T) {
"oomkilled": false,
"pid": 1234,
"exitcode": 0,
"restart_count": 0,
"container_id": "e2173b9478a6ae55e237d4d74f8bbb753f0817192b5081334dc78476296b7dfb",
"finished_at": time.Date(2018, 6, 14, 5, 53, 53, 266176036, time.UTC).UnixNano(),
},
@ -866,6 +869,7 @@ func TestContainerStatus(t *testing.T) {
"oomkilled": false,
"pid": 1234,
"exitcode": 0,
"restart_count": 0,
"container_id": "e2173b9478a6ae55e237d4d74f8bbb753f0817192b5081334dc78476296b7dfb",
"started_at": time.Date(2019, 1, 1, 0, 0, 2, 0, time.UTC).UnixNano(),
"finished_at": time.Date(2019, 1, 1, 0, 0, 1, 0, time.UTC).UnixNano(),