From 2b260a5815136db47d00c3bd7eb5317a30673db5 Mon Sep 17 00:00:00 2001 From: Michael Katsoulis Date: Thu, 9 Feb 2023 12:19:55 +0200 Subject: [PATCH] Fix container enricher with correct container ids for pods with multiple containers (#34516) * Fix container enricher with correct container ids for pods with multiple containers * Align kubernetes.container.id with ecs container.id (cherry picked from commit 4ac4973250d39884be409efb593e1ad416515336) # Conflicts: # metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.3.0.expected # metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.8.0.expected # metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.0.0.expected # metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.7.0.expected # metricbeat/module/kubernetes/state_container/_meta/testdata/ksm.v2.4.2.plain-expected.json # metricbeat/module/kubernetes/state_container/_meta/testdata/ksm.v2.5.0.plain-expected.json # metricbeat/module/kubernetes/state_container/_meta/testdata/ksm.v2.6.0.plain-expected.json # metricbeat/module/kubernetes/state_container/_meta/testdata/ksm.v2.7.0.plain-expected.json # metricbeat/module/kubernetes/state_container/state_container.go # metricbeat/module/kubernetes/util/kubernetes.go --- CHANGELOG.next.asciidoc | 16 + .../_meta/test/ksm.v1.3.0.expected | 562 ++++++++++++++ .../_meta/test/ksm.v1.8.0.expected | 549 +++++++++++++ .../_meta/test/ksm.v2.0.0.expected | 646 +++++++++++++++- .../_meta/test/ksm.v2.7.0.expected | 671 ++++++++++++++++ .../testdata/ksm.v2.4.2.plain-expected.json | 683 ++++++++++++++++ .../testdata/ksm.v2.5.0.plain-expected.json | 686 +++++++++++++++++ .../testdata/ksm.v2.6.0.plain-expected.json | 726 ++++++++++++++++++ .../testdata/ksm.v2.7.0.plain-expected.json | 686 +++++++++++++++++ .../state_container/state_container.go | 9 + .../module/kubernetes/util/kubernetes.go | 16 +- 11 files changed, 5247 insertions(+), 3 deletions(-) create mode 100644 metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.7.0.expected create mode 100644 metricbeat/module/kubernetes/state_container/_meta/testdata/ksm.v2.4.2.plain-expected.json create mode 100644 metricbeat/module/kubernetes/state_container/_meta/testdata/ksm.v2.5.0.plain-expected.json create mode 100644 metricbeat/module/kubernetes/state_container/_meta/testdata/ksm.v2.6.0.plain-expected.json create mode 100644 metricbeat/module/kubernetes/state_container/_meta/testdata/ksm.v2.7.0.plain-expected.json diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 18cd72ac165..58d244a81ca 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -53,6 +53,22 @@ https://github.com/elastic/beats/compare/v8.2.0\...main[Check the HEAD diff] *Metricbeat* - Fix kubernetes module's internal cache expiration issue. This avoid metrics like `kubernetes.container.cpu.usage.limit.pct` from not being populated. {pull}31785[31785] +- in module/windows/perfmon, changed collection method of the second counter value required to create a displayable value {pull}32305[32305] +- Fix and improve AWS metric period calculation to avoid zero-length intervals {pull}32724[32724] +- Add missing cluster metadata to k8s module metricsets {pull}32979[32979] {pull}33032[33032] +- Add GCP CloudSQL region filter {pull}32943[32943] +- Fix logstash cgroup mappings {pull}33131[33131] +- Remove unused `elasticsearch.node_stats.indices.bulk.avg_time.bytes` mapping {pull}33263[33263] +- Fix kafka dashboard field names {pull}33555[33555] +- Add tags to events based on parsed identifier. {pull}33472[33472] +- Support Oracle-specific connection strings in SQL module {issue}32089[32089] {pull}32293[32293] +- Remove deprecated metrics from controller manager, scheduler and proxy {pull}34161[34161] +- Fix metrics split through different events and metadata not matching for aws cloudwatch. {pull}34483[34483] +- Fix metadata enricher with correct container ids for pods with multiple containers in container metricset. Align `kubernetes.container.id` and `container.id` fields for state_container metricset. {pull}34516[34516] + + +*Osquerybeat* + *Packetbeat* diff --git a/metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.3.0.expected b/metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.3.0.expected index 9bfecbe3c39..d811fafd0a5 100644 --- a/metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.3.0.expected +++ b/metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.3.0.expected @@ -2,9 +2,15 @@ { "RootFields": { "container": { +<<<<<<< HEAD:metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.3.0.expected "id": "e9560bbace13ca19de4b3771023198e8568f6b5ed6af3a949f10a5b8137b5be9", "image": { "name": "gcr.io/google_containers/k8s-dns-dnsmasq-nanny-amd64:1.14.7" +======= + "id": "db273ae4a6486d1e52dda314a8d0ce84d9014ce5e0f9c94812119a73d579e2fc", + "image": { + "name": "docker.io/kindest/kindnetd:v20221004-44d545d1" +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)):metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.4.2.expected }, "runtime": "docker" } @@ -15,12 +21,20 @@ "name": "minikube" }, "pod": { +<<<<<<< HEAD:metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.3.0.expected "name": "kube-dns-6f4fd4bdf-wlmht" +======= + "name": "kindnet-4tnzw" +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)):metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.4.2.expected } }, "MetricSetFields": { "cpu": { + "limit": { + "cores": 0.1 + }, "request": { +<<<<<<< HEAD:metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.3.0.expected "cores": 0.15 } }, @@ -31,6 +45,21 @@ } }, "name": "dnsmasq", +======= + "cores": 0.1 + } + }, + "id": "db273ae4a6486d1e52dda314a8d0ce84d9014ce5e0f9c94812119a73d579e2fc", + "memory": { + "limit": { + "bytes": 52428800 + }, + "request": { + "bytes": 52428800 + } + }, + "name": "kindnet-cni", +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)):metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.4.2.expected "status": { "phase": "running", "ready": true, @@ -51,20 +80,369 @@ { "RootFields": { "container": { +<<<<<<< HEAD:metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.3.0.expected "id": "e9568dfef1dd249cabac4bf09e6bf4a239fe738ae20eba072b6516676fce4bf6", "image": { "name": "gcr.io/google_containers/kube-apiserver-amd64:v1.9.7" }, "runtime": "docker" +======= + "image": { + "name": "perl:5.34.0" + } +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)):metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.4.2.expected } }, "ModuleFields": { "namespace": "kube-system", "node": { +<<<<<<< HEAD:metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.3.0.expected "name": "minikube" }, "pod": { "name": "kube-apiserver-minikube" +======= + "name": "kind-control-plane" + }, + "pod": { + "name": "pi-m88dn" + } + }, + "MetricSetFields": { + "name": "pi", + "status": { + "phase": "waiting", + "ready": false, + "reason": "ContainerCreating", + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "f2aa38ca30cec5c42fae07ed5cda3046f9392c2a93624815542881ace6aa3ad2", + "image": { + "name": "registry.k8s.io/kube-scheduler:v1.25.3" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-scheduler-kind-control-plane" + } + }, + "MetricSetFields": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "f2aa38ca30cec5c42fae07ed5cda3046f9392c2a93624815542881ace6aa3ad2", + "name": "kube-scheduler", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "69a6e1720df542c8a662873e8ad0694c3d120259fa625bf527269c4d4f1bff34", + "image": { + "name": "docker.io/library/busybox:1.28" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "hello-cronjob-27899487-6vx8l" + } + }, + "MetricSetFields": { + "id": "69a6e1720df542c8a662873e8ad0694c3d120259fa625bf527269c4d4f1bff34", + "name": "hello-cronjob", + "status": { + "phase": "terminated", + "ready": false, + "reason": "Completed", + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "6f8e923de52f2af9aa23e91b97bf5f45dc6c631aa950c0a3782f847634bbe60b", + "image": { + "name": "registry.k8s.io/coredns/coredns:v1.9.3" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "coredns-565d847f94-dgwk8" + } + }, + "MetricSetFields": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "6f8e923de52f2af9aa23e91b97bf5f45dc6c631aa950c0a3782f847634bbe60b", + "memory": { + "limit": { + "bytes": 178257920 + }, + "request": { + "bytes": 73400320 + } + }, + "name": "coredns", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "003627b6d02209f47b06938519f61ca8d3baf740f2f04866bfeb9f7d4533e997", + "image": { + "name": "docker.io/kindest/local-path-provisioner:v0.0.22-kind.0" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "local-path-storage", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "local-path-provisioner-684f458cdd-wvdbd" + } + }, + "MetricSetFields": { + "id": "003627b6d02209f47b06938519f61ca8d3baf740f2f04866bfeb9f7d4533e997", + "name": "local-path-provisioner", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "26d7459f5f6e7dfce46638648c6bfec8771152583c743ae6a65adf6a3a3419a9", + "image": { + "name": "k8s.gcr.io/kube-state-metrics/kube-state-metrics:v2.4.2" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-state-metrics-77bcd445dd-tnbvx" + } + }, + "MetricSetFields": { + "id": "26d7459f5f6e7dfce46638648c6bfec8771152583c743ae6a65adf6a3a3419a9", + "name": "kube-state-metrics", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "9a7de41e53002ae76fe82103317edb4565ce383e3bf0395b796b4486ebc70d05", + "image": { + "name": "registry.k8s.io/kube-proxy:v1.25.3" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-proxy-flrd6" + } + }, + "MetricSetFields": { + "id": "9a7de41e53002ae76fe82103317edb4565ce383e3bf0395b796b4486ebc70d05", + "name": "kube-proxy", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "548badac9b0ece0c96e7222138e40aa7b9e47832cab06dc84f45a7591ec378cb", + "image": { + "name": "registry.k8s.io/kube-controller-manager:v1.25.3" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-controller-manager-kind-control-plane" + } + }, + "MetricSetFields": { + "cpu": { + "request": { + "cores": 0.2 + } + }, + "id": "548badac9b0ece0c96e7222138e40aa7b9e47832cab06dc84f45a7591ec378cb", + "name": "kube-controller-manager", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "01e704051af1b269270266aa05b6f330d16d88da286600c34744f7abb23618a8", + "image": { + "name": "registry.k8s.io/kube-apiserver:v1.25.3" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-apiserver-kind-control-plane" +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)):metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.4.2.expected } }, "MetricSetFields": { @@ -73,7 +451,11 @@ "cores": 0.25 } }, +<<<<<<< HEAD:metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.3.0.expected "id": "docker://e9568dfef1dd249cabac4bf09e6bf4a239fe738ae20eba072b6516676fce4bf6", +======= + "id": "01e704051af1b269270266aa05b6f330d16d88da286600c34744f7abb23618a8", +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)):metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.4.2.expected "name": "kube-apiserver", "status": { "phase": "running", @@ -95,16 +477,25 @@ { "RootFields": { "container": { +<<<<<<< HEAD:metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.3.0.expected "id": "76c260259ddfd0267b5acb4e514465215ef1ebfa93a4057d592828772e6b39f5", "image": { "name": "gcr.io/google_containers/kube-proxy-amd64:v1.9.7" }, "runtime": "docker" +======= + "id": "94e7f7b11c08aa225de5477d74f9780548626cb49e60f29b9a7a3fd1d5c27df8", + "image": { + "name": "docker.elastic.co/beats/metricbeat:8.6.0" + }, + "runtime": "containerd" +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)):metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.4.2.expected } }, "ModuleFields": { "namespace": "kube-system", "node": { +<<<<<<< HEAD:metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.3.0.expected "name": "minikube" }, "pod": { @@ -148,11 +539,18 @@ }, "pod": { "name": "kube-controller-manager-minikube" +======= + "name": "kind-control-plane" + }, + "pod": { + "name": "metricbeat-h24sg" +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)):metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.4.2.expected } }, "MetricSetFields": { "cpu": { "request": { +<<<<<<< HEAD:metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.3.0.expected "cores": 0.2 } }, @@ -348,6 +746,21 @@ "MetricSetFields": { "id": "docker://6e96fd8a687409b2314dcc01f209bb0c813c2fb08b8f75ad1695e120d41e1a2a", "name": "etcd", +======= + "cores": 0.1 + } + }, + "id": "94e7f7b11c08aa225de5477d74f9780548626cb49e60f29b9a7a3fd1d5c27df8", + "memory": { + "limit": { + "bytes": 209715200 + }, + "request": { + "bytes": 104857600 + } + }, + "name": "metricbeat", +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)):metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.4.2.expected "status": { "phase": "running", "ready": true, @@ -368,7 +781,140 @@ { "RootFields": { "container": { +<<<<<<< HEAD:metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.3.0.expected "id": "ab382dbe8f8265f88ee9fec7de142f778da4a5fd9fe0334e3bdb6fe851124c08", +======= + "id": "30514fd6f76760a37d429af91f1d84301b9d1bae00a4b6c2845f07ab8b86eb30", + "image": { + "name": "docker.io/library/busybox:1.28" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "hello-cronjob-27899489-sl9hn" + } + }, + "MetricSetFields": { + "id": "30514fd6f76760a37d429af91f1d84301b9d1bae00a4b6c2845f07ab8b86eb30", + "name": "hello-cronjob", + "status": { + "phase": "terminated", + "ready": false, + "reason": "Completed", + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "e2738582ad159bb495172b9571bed309f16f3a5977ca6fd9184e89700369d22b", + "image": { + "name": "registry.k8s.io/etcd:3.5.4-0" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "etcd-kind-control-plane" + } + }, + "MetricSetFields": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "e2738582ad159bb495172b9571bed309f16f3a5977ca6fd9184e89700369d22b", + "memory": { + "request": { + "bytes": 104857600 + } + }, + "name": "etcd", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "cbc3ddaeb5fda1bbd6063297b75340fc69063f9247d6cc3de20a92438b961e1f", + "image": { + "name": "docker.io/library/busybox:1.28" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "hello-cronjob-27899488-mctvl" + } + }, + "MetricSetFields": { + "id": "cbc3ddaeb5fda1bbd6063297b75340fc69063f9247d6cc3de20a92438b961e1f", + "name": "hello-cronjob", + "status": { + "phase": "terminated", + "ready": false, + "reason": "Completed", + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "849233d7c0fa232729cb223a66d8fb6287feadf4e4369201067397c92d413fe6", +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)):metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.4.2.expected "image": { "name": "k8s.gcr.io/kube-addon-manager:v8.6" }, @@ -390,6 +936,7 @@ "cores": 0.005 } }, +<<<<<<< HEAD:metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.3.0.expected "id": "docker://ab382dbe8f8265f88ee9fec7de142f778da4a5fd9fe0334e3bdb6fe851124c08", "memory": { "request": { @@ -452,6 +999,18 @@ } }, "name": "kube-state-metrics", +======= + "id": "849233d7c0fa232729cb223a66d8fb6287feadf4e4369201067397c92d413fe6", + "memory": { + "limit": { + "bytes": 178257920 + }, + "request": { + "bytes": 73400320 + } + }, + "name": "coredns", +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)):metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.4.2.expected "status": { "phase": "running", "ready": true, @@ -468,6 +1027,7 @@ "Took": 0, "Period": 0, "DisableTimeSeries": false +<<<<<<< HEAD:metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.3.0.expected }, { "RootFields": { @@ -597,5 +1157,7 @@ "Took": 0, "Period": 0, "DisableTimeSeries": false +======= +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)):metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.4.2.expected } ] \ No newline at end of file diff --git a/metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.8.0.expected b/metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.8.0.expected index 4277911c4b3..5a7c761a8eb 100644 --- a/metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.8.0.expected +++ b/metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.8.0.expected @@ -2,9 +2,15 @@ { "RootFields": { "container": { +<<<<<<< HEAD:metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.8.0.expected "id": "f13c53a3ed0f3626b33b3c588d6913257320f65714eff28f25ead8f7663dc93b", "image": { "name": "k8s.gcr.io/kube-addon-manager:v9.0.2" +======= + "id": "db273ae4a6486d1e52dda314a8d0ce84d9014ce5e0f9c94812119a73d579e2fc", + "image": { + "name": "docker.io/kindest/kindnetd:v20221004-44d545d1" +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)):metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.5.0.expected }, "runtime": "docker" } @@ -15,22 +21,44 @@ "name": "minikube" }, "pod": { +<<<<<<< HEAD:metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.8.0.expected "name": "kube-addon-manager-minikube" +======= + "name": "kindnet-4tnzw" +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)):metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.5.0.expected } }, "MetricSetFields": { "cpu": { +<<<<<<< HEAD:metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.8.0.expected "request": { "cores": 0.005 } }, "id": "docker://f13c53a3ed0f3626b33b3c588d6913257320f65714eff28f25ead8f7663dc93b", +======= + "limit": { + "cores": 0.1 + }, + "request": { + "cores": 0.1 + } + }, + "id": "db273ae4a6486d1e52dda314a8d0ce84d9014ce5e0f9c94812119a73d579e2fc", +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)):metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.5.0.expected "memory": { + "limit": { + "bytes": 52428800 + }, "request": { "bytes": 52428800 } }, +<<<<<<< HEAD:metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.8.0.expected "name": "kube-addon-manager", +======= + "name": "kindnet-cni", +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)):metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.5.0.expected "status": { "phase": "running", "ready": true, @@ -64,7 +92,91 @@ "name": "minikube" }, "pod": { +<<<<<<< HEAD:metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.8.0.expected "name": "kube-scheduler-minikube" +======= + "name": "hello-cronjob-27899497-ffm4g" + } + }, + "MetricSetFields": { + "id": "3ba2b0ddb34668d521831c06e4c0553e3f93458738356e97647837a13eda1063", + "name": "hello-cronjob", + "status": { + "phase": "terminated", + "ready": false, + "reason": "Completed", + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "b1ca049c0844dbb44840975d0fb8e0cfd90eeec664bfbc5e0e70d2e2ac47d839", + "image": { + "name": "docker.io/library/perl:5.34.0" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "pi-m88dn" + } + }, + "MetricSetFields": { + "id": "b1ca049c0844dbb44840975d0fb8e0cfd90eeec664bfbc5e0e70d2e2ac47d839", + "name": "pi", + "status": { + "phase": "terminated", + "ready": false, + "reason": "Completed", + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "f2aa38ca30cec5c42fae07ed5cda3046f9392c2a93624815542881ace6aa3ad2", + "image": { + "name": "registry.k8s.io/kube-scheduler:v1.25.3" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-scheduler-kind-control-plane" +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)):metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.5.0.expected } }, "MetricSetFields": { @@ -73,7 +185,11 @@ "cores": 0.1 } }, +<<<<<<< HEAD:metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.8.0.expected "id": "docker://0ea0cef8a79c7643474a736e5da14c254d9411d87167028fa07c96d09748c83a", +======= + "id": "f2aa38ca30cec5c42fae07ed5cda3046f9392c2a93624815542881ace6aa3ad2", +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)):metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.5.0.expected "name": "kube-scheduler", "status": { "phase": "running", @@ -95,6 +211,7 @@ { "RootFields": { "container": { +<<<<<<< HEAD:metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.8.0.expected "id": "c152296116c064db311061cf6c39cff2de8d66339c954505cb68816464cf4a03", "image": { "name": "k8s.gcr.io/kube-proxy:v1.16.2" @@ -484,6 +601,9 @@ "RootFields": { "container": { "id": "842fbd62a0ab71b9ed9139edce3db502e9d81e545b9646daa3cde09f9986ab06", +======= + "id": "6f8e923de52f2af9aa23e91b97bf5f45dc6c631aa950c0a3782f847634bbe60b", +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)):metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.5.0.expected "image": { "name": "k8s.gcr.io/etcd:3.3.15-0" }, @@ -500,8 +620,26 @@ } }, "MetricSetFields": { +<<<<<<< HEAD:metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.8.0.expected "id": "docker://842fbd62a0ab71b9ed9139edce3db502e9d81e545b9646daa3cde09f9986ab06", "name": "etcd", +======= + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "6f8e923de52f2af9aa23e91b97bf5f45dc6c631aa950c0a3782f847634bbe60b", + "memory": { + "limit": { + "bytes": 178257920 + }, + "request": { + "bytes": 73400320 + } + }, + "name": "coredns", +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)):metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.5.0.expected "status": { "phase": "running", "ready": true, @@ -522,7 +660,217 @@ { "RootFields": { "container": { +<<<<<<< HEAD:metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.8.0.expected "id": "a4cec783af3614b137f4b449eebf3ac61eaf0a8661cb2f4847741be5a24de0bf", +======= + "id": "f315b3d7ed76c1a93eb20f2adfdbd0783a235c8714fb26462eb9a555427d0246", + "image": { + "name": "docker.io/library/busybox:1.28" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "hello-cronjob-27899498-q8cl7" + } + }, + "MetricSetFields": { + "id": "f315b3d7ed76c1a93eb20f2adfdbd0783a235c8714fb26462eb9a555427d0246", + "name": "hello-cronjob", + "status": { + "phase": "terminated", + "ready": false, + "reason": "Completed", + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "003627b6d02209f47b06938519f61ca8d3baf740f2f04866bfeb9f7d4533e997", + "image": { + "name": "docker.io/kindest/local-path-provisioner:v0.0.22-kind.0" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "local-path-storage", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "local-path-provisioner-684f458cdd-wvdbd" + } + }, + "MetricSetFields": { + "id": "003627b6d02209f47b06938519f61ca8d3baf740f2f04866bfeb9f7d4533e997", + "name": "local-path-provisioner", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "9a7de41e53002ae76fe82103317edb4565ce383e3bf0395b796b4486ebc70d05", + "image": { + "name": "registry.k8s.io/kube-proxy:v1.25.3" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-proxy-flrd6" + } + }, + "MetricSetFields": { + "id": "9a7de41e53002ae76fe82103317edb4565ce383e3bf0395b796b4486ebc70d05", + "name": "kube-proxy", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "548badac9b0ece0c96e7222138e40aa7b9e47832cab06dc84f45a7591ec378cb", + "image": { + "name": "registry.k8s.io/kube-controller-manager:v1.25.3" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-controller-manager-kind-control-plane" + } + }, + "MetricSetFields": { + "cpu": { + "request": { + "cores": 0.2 + } + }, + "id": "548badac9b0ece0c96e7222138e40aa7b9e47832cab06dc84f45a7591ec378cb", + "name": "kube-controller-manager", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "01e704051af1b269270266aa05b6f330d16d88da286600c34744f7abb23618a8", + "image": { + "name": "registry.k8s.io/kube-apiserver:v1.25.3" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-apiserver-kind-control-plane" + } + }, + "MetricSetFields": { + "cpu": { + "request": { + "cores": 0.25 + } + }, + "id": "01e704051af1b269270266aa05b6f330d16d88da286600c34744f7abb23618a8", + "name": "kube-apiserver", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "94e7f7b11c08aa225de5477d74f9780548626cb49e60f29b9a7a3fd1d5c27df8", +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)):metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.5.0.expected "image": { "name": "k8s.gcr.io/nginx-slim:0.8" }, @@ -539,8 +887,208 @@ } }, "MetricSetFields": { +<<<<<<< HEAD:metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.8.0.expected "id": "docker://a4cec783af3614b137f4b449eebf3ac61eaf0a8661cb2f4847741be5a24de0bf", "name": "nginx", +======= + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "94e7f7b11c08aa225de5477d74f9780548626cb49e60f29b9a7a3fd1d5c27df8", + "memory": { + "limit": { + "bytes": 209715200 + }, + "request": { + "bytes": 104857600 + } + }, + "name": "metricbeat", +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)):metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.5.0.expected + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false +<<<<<<< HEAD:metricbeat/module/kubernetes/state_container/_meta/test/ksm.v1.8.0.expected +======= + }, + { + "RootFields": { + "container": { + "id": "4c58768671aab3b73013a030c4125c8f9d39d51772a3c75df19c84bc055094ed", + "image": { + "name": "k8s.gcr.io/kube-state-metrics/kube-state-metrics:v2.5.0" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-state-metrics-8595684f78-ppcnj" + } + }, + "MetricSetFields": { + "id": "4c58768671aab3b73013a030c4125c8f9d39d51772a3c75df19c84bc055094ed", + "name": "kube-state-metrics", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "e937b71f248fd8327b1261ba9d7f8c52be4377ae374c24ddc6911cb8ab918687", + "image": { + "name": "docker.io/library/busybox:1.28" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "hello-cronjob-27899499-k5d56" + } + }, + "MetricSetFields": { + "id": "e937b71f248fd8327b1261ba9d7f8c52be4377ae374c24ddc6911cb8ab918687", + "name": "hello-cronjob", + "status": { + "phase": "terminated", + "ready": false, + "reason": "Completed", + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "e2738582ad159bb495172b9571bed309f16f3a5977ca6fd9184e89700369d22b", + "image": { + "name": "registry.k8s.io/etcd:3.5.4-0" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "etcd-kind-control-plane" + } + }, + "MetricSetFields": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "e2738582ad159bb495172b9571bed309f16f3a5977ca6fd9184e89700369d22b", + "memory": { + "request": { + "bytes": 104857600 + } + }, + "name": "etcd", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "849233d7c0fa232729cb223a66d8fb6287feadf4e4369201067397c92d413fe6", + "image": { + "name": "registry.k8s.io/coredns/coredns:v1.9.3" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "coredns-565d847f94-q2mmv" + } + }, + "MetricSetFields": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "849233d7c0fa232729cb223a66d8fb6287feadf4e4369201067397c92d413fe6", + "memory": { + "limit": { + "bytes": 178257920 + }, + "request": { + "bytes": 73400320 + } + }, + "name": "coredns", "status": { "phase": "running", "ready": true, @@ -557,5 +1105,6 @@ "Took": 0, "Period": 0, "DisableTimeSeries": false +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)):metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.5.0.expected } ] \ No newline at end of file diff --git a/metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.0.0.expected b/metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.0.0.expected index f3d21d77a34..213b247e8ac 100644 --- a/metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.0.0.expected +++ b/metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.0.0.expected @@ -2,7 +2,66 @@ { "RootFields": { "container": { +<<<<<<< HEAD:metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.0.0.expected "id": "3101d1525d6133851881f4b7cd439033663daefeb4849e5322d1428f09620628", +======= + "id": "db273ae4a6486d1e52dda314a8d0ce84d9014ce5e0f9c94812119a73d579e2fc", + "image": { + "name": "docker.io/kindest/kindnetd:v20221004-44d545d1" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kindnet-4tnzw" + } + }, + "MetricSetFields": { + "cpu": { + "limit": { + "cores": 0.1 + }, + "request": { + "cores": 0.1 + } + }, + "id": "db273ae4a6486d1e52dda314a8d0ce84d9014ce5e0f9c94812119a73d579e2fc", + "memory": { + "limit": { + "bytes": 52428800 + }, + "request": { + "bytes": 52428800 + } + }, + "name": "kindnet-cni", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "b1ca049c0844dbb44840975d0fb8e0cfd90eeec664bfbc5e0e70d2e2ac47d839", +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)):metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.6.0.expected "image": { "name": "k8s.gcr.io/coredns:1.6.2" }, @@ -15,7 +74,563 @@ "name": "kind-control-plane" }, "pod": { - "name": "coredns-5644d7b6d9-zgdsx" +<<<<<<< HEAD:metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.0.0.expected + "name": "coredns-5644d7b6d9-zgdsx" +======= + "name": "pi-m88dn" + } + }, + "MetricSetFields": { + "id": "b1ca049c0844dbb44840975d0fb8e0cfd90eeec664bfbc5e0e70d2e2ac47d839", + "name": "pi", + "status": { + "phase": "terminated", + "ready": false, + "reason": "Completed", + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "f2aa38ca30cec5c42fae07ed5cda3046f9392c2a93624815542881ace6aa3ad2", + "image": { + "name": "registry.k8s.io/kube-scheduler:v1.25.3" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-scheduler-kind-control-plane" + } + }, + "MetricSetFields": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "f2aa38ca30cec5c42fae07ed5cda3046f9392c2a93624815542881ace6aa3ad2", + "name": "kube-scheduler", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "89392d8ac34feb009401e4d3b1e8f19293b952355f8c8a6b54a0e19ad74c5892", + "image": { + "name": "docker.io/library/busybox:1.28" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "hello-cronjob-27899500-skmng" + } + }, + "MetricSetFields": { + "id": "89392d8ac34feb009401e4d3b1e8f19293b952355f8c8a6b54a0e19ad74c5892", + "name": "hello-cronjob", + "status": { + "phase": "terminated", + "ready": false, + "reason": "Completed", + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "6f8e923de52f2af9aa23e91b97bf5f45dc6c631aa950c0a3782f847634bbe60b", + "image": { + "name": "registry.k8s.io/coredns/coredns:v1.9.3" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "coredns-565d847f94-dgwk8" + } + }, + "MetricSetFields": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "6f8e923de52f2af9aa23e91b97bf5f45dc6c631aa950c0a3782f847634bbe60b", + "memory": { + "limit": { + "bytes": 178257920 + }, + "request": { + "bytes": 73400320 + } + }, + "name": "coredns", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "f315b3d7ed76c1a93eb20f2adfdbd0783a235c8714fb26462eb9a555427d0246", + "image": { + "name": "docker.io/library/busybox:1.28" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "hello-cronjob-27899498-q8cl7" + } + }, + "MetricSetFields": { + "id": "f315b3d7ed76c1a93eb20f2adfdbd0783a235c8714fb26462eb9a555427d0246", + "name": "hello-cronjob", + "status": { + "phase": "terminated", + "ready": false, + "reason": "Completed", + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "003627b6d02209f47b06938519f61ca8d3baf740f2f04866bfeb9f7d4533e997", + "image": { + "name": "docker.io/kindest/local-path-provisioner:v0.0.22-kind.0" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "local-path-storage", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "local-path-provisioner-684f458cdd-wvdbd" + } + }, + "MetricSetFields": { + "id": "003627b6d02209f47b06938519f61ca8d3baf740f2f04866bfeb9f7d4533e997", + "name": "local-path-provisioner", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "cfcec5447b0a83749e71ac33db2b97db3271f576281f51daf50b3cd3220353af", + "image": { + "name": "registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.6.0" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-state-metrics-5897f6cf77-jq242" + } + }, + "MetricSetFields": { + "id": "cfcec5447b0a83749e71ac33db2b97db3271f576281f51daf50b3cd3220353af", + "name": "kube-state-metrics", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "9a7de41e53002ae76fe82103317edb4565ce383e3bf0395b796b4486ebc70d05", + "image": { + "name": "registry.k8s.io/kube-proxy:v1.25.3" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-proxy-flrd6" + } + }, + "MetricSetFields": { + "id": "9a7de41e53002ae76fe82103317edb4565ce383e3bf0395b796b4486ebc70d05", + "name": "kube-proxy", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "548badac9b0ece0c96e7222138e40aa7b9e47832cab06dc84f45a7591ec378cb", + "image": { + "name": "registry.k8s.io/kube-controller-manager:v1.25.3" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-controller-manager-kind-control-plane" + } + }, + "MetricSetFields": { + "cpu": { + "request": { + "cores": 0.2 + } + }, + "id": "548badac9b0ece0c96e7222138e40aa7b9e47832cab06dc84f45a7591ec378cb", + "name": "kube-controller-manager", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "01e704051af1b269270266aa05b6f330d16d88da286600c34744f7abb23618a8", + "image": { + "name": "registry.k8s.io/kube-apiserver:v1.25.3" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-apiserver-kind-control-plane" + } + }, + "MetricSetFields": { + "cpu": { + "request": { + "cores": 0.25 + } + }, + "id": "01e704051af1b269270266aa05b6f330d16d88da286600c34744f7abb23618a8", + "name": "kube-apiserver", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "d1149ce4c5c9fed787e0858c53f2e78c6f739dd48db2845f315287efd1c7f54e", + "image": { + "name": "docker.io/library/busybox:1.28" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "hello-cronjob-27899501-t2lnn" + } + }, + "MetricSetFields": { + "id": "d1149ce4c5c9fed787e0858c53f2e78c6f739dd48db2845f315287efd1c7f54e", + "name": "hello-cronjob", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "94e7f7b11c08aa225de5477d74f9780548626cb49e60f29b9a7a3fd1d5c27df8", + "image": { + "name": "docker.elastic.co/beats/metricbeat:8.6.0" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "metricbeat-h24sg" + } + }, + "MetricSetFields": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "94e7f7b11c08aa225de5477d74f9780548626cb49e60f29b9a7a3fd1d5c27df8", + "memory": { + "limit": { + "bytes": 209715200 + }, + "request": { + "bytes": 104857600 + } + }, + "name": "metricbeat", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "e937b71f248fd8327b1261ba9d7f8c52be4377ae374c24ddc6911cb8ab918687", + "image": { + "name": "docker.io/library/busybox:1.28" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "hello-cronjob-27899499-k5d56" + } + }, + "MetricSetFields": { + "id": "e937b71f248fd8327b1261ba9d7f8c52be4377ae374c24ddc6911cb8ab918687", + "name": "hello-cronjob", + "status": { + "phase": "terminated", + "ready": false, + "reason": "Completed", + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "e2738582ad159bb495172b9571bed309f16f3a5977ca6fd9184e89700369d22b", + "image": { + "name": "registry.k8s.io/etcd:3.5.4-0" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "etcd-kind-control-plane" +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)):metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.6.0.expected } }, "MetricSetFields": { @@ -24,7 +639,11 @@ "cores": 0.1 } }, +<<<<<<< HEAD:metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.0.0.expected "id": "containerd://3101d1525d6133851881f4b7cd439033663daefeb4849e5322d1428f09620628", +======= + "id": "e2738582ad159bb495172b9571bed309f16f3a5977ca6fd9184e89700369d22b", +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)):metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.6.0.expected "memory": { "limit": { "bytes": 178257920 @@ -55,6 +674,7 @@ { "RootFields": { "container": { +<<<<<<< HEAD:metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.0.0.expected "id": "ffdc200c097349d8ed96f5768387d276751497297730121e6335a31c2d3332a4", "image": { "name": "k8s.gcr.io/kube-apiserver:v1.16.15" @@ -180,6 +800,9 @@ "RootFields": { "container": { "id": "02b0705f60dc6131a6b5d4e9a48e2510463f89a0f77e7e1bafa6b5f45cc595e8", +======= + "id": "849233d7c0fa232729cb223a66d8fb6287feadf4e4369201067397c92d413fe6", +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)):metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.6.0.expected "image": { "name": "docker.io/odise/busybox-python:latest" }, @@ -196,8 +819,26 @@ } }, "MetricSetFields": { +<<<<<<< HEAD:metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.0.0.expected "id": "containerd://02b0705f60dc6131a6b5d4e9a48e2510463f89a0f77e7e1bafa6b5f45cc595e8", "name": "hello-python", +======= + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "849233d7c0fa232729cb223a66d8fb6287feadf4e4369201067397c92d413fe6", + "memory": { + "limit": { + "bytes": 178257920 + }, + "request": { + "bytes": 73400320 + } + }, + "name": "coredns", +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)):metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.6.0.expected "status": { "last_terminated_reason": "Unknown", "phase": "running", @@ -215,6 +856,7 @@ "Took": 0, "Period": 0, "DisableTimeSeries": false +<<<<<<< HEAD:metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.0.0.expected }, { "RootFields": { @@ -879,5 +1521,7 @@ "Took": 0, "Period": 0, "DisableTimeSeries": false +======= +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)):metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.6.0.expected } ] diff --git a/metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.7.0.expected b/metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.7.0.expected new file mode 100644 index 00000000000..3d099c65dac --- /dev/null +++ b/metricbeat/module/kubernetes/state_container/_meta/test/ksm.v2.7.0.expected @@ -0,0 +1,671 @@ +[ + { + "RootFields": { + "container": { + "id": "db273ae4a6486d1e52dda314a8d0ce84d9014ce5e0f9c94812119a73d579e2fc", + "image": { + "name": "docker.io/kindest/kindnetd:v20221004-44d545d1" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kindnet-4tnzw" + } + }, + "MetricSetFields": { + "cpu": { + "limit": { + "cores": 0.1 + }, + "request": { + "cores": 0.1 + } + }, + "id": "db273ae4a6486d1e52dda314a8d0ce84d9014ce5e0f9c94812119a73d579e2fc", + "memory": { + "limit": { + "bytes": 52428800 + }, + "request": { + "bytes": 52428800 + } + }, + "name": "kindnet-cni", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "b1ca049c0844dbb44840975d0fb8e0cfd90eeec664bfbc5e0e70d2e2ac47d839", + "image": { + "name": "docker.io/library/perl:5.34.0" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "pi-m88dn" + } + }, + "MetricSetFields": { + "id": "b1ca049c0844dbb44840975d0fb8e0cfd90eeec664bfbc5e0e70d2e2ac47d839", + "name": "pi", + "status": { + "phase": "terminated", + "ready": false, + "reason": "Completed", + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "f2aa38ca30cec5c42fae07ed5cda3046f9392c2a93624815542881ace6aa3ad2", + "image": { + "name": "registry.k8s.io/kube-scheduler:v1.25.3" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-scheduler-kind-control-plane" + } + }, + "MetricSetFields": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "f2aa38ca30cec5c42fae07ed5cda3046f9392c2a93624815542881ace6aa3ad2", + "name": "kube-scheduler", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "bbecc08bbf0158bdc85f4ed006cddbf40f51d7348ce5cbd95e86d367d20e8fbb", + "image": { + "name": "docker.elastic.co/beats/metricbeat:8.6.0" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "metricbeat-6xfvl" + } + }, + "MetricSetFields": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "bbecc08bbf0158bdc85f4ed006cddbf40f51d7348ce5cbd95e86d367d20e8fbb", + "memory": { + "limit": { + "bytes": 209715200 + }, + "request": { + "bytes": 104857600 + } + }, + "name": "metricbeat", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "18bddca29930370d9cfa083969de095894f7b77b5c63fd0712128ea7de6c64fd", + "image": { + "name": "docker.io/library/busybox:1.28" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "hello-cronjob-27900587-r7g6w" + } + }, + "MetricSetFields": { + "id": "18bddca29930370d9cfa083969de095894f7b77b5c63fd0712128ea7de6c64fd", + "name": "hello-cronjob", + "status": { + "phase": "terminated", + "ready": false, + "reason": "Completed", + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "77d181df6b24476654d367bdcadc543c65371de07cc71044fc8a0bafc20a2105", + "image": { + "name": "docker.io/library/busybox:1.28" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "hello-cronjob-27900586-psw5h" + } + }, + "MetricSetFields": { + "id": "77d181df6b24476654d367bdcadc543c65371de07cc71044fc8a0bafc20a2105", + "name": "hello-cronjob", + "status": { + "phase": "terminated", + "ready": false, + "reason": "Completed", + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "d58ac7bcd7b24a58132d3021f13301d2a0995e74f98596956e8f20e19029f2be", + "image": { + "name": "registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.7.0" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-state-metrics-548546fc89-qrkzb" + } + }, + "MetricSetFields": { + "id": "d58ac7bcd7b24a58132d3021f13301d2a0995e74f98596956e8f20e19029f2be", + "name": "kube-state-metrics", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "f8e2e2fe9a308d4e81707c0a2daa53424a862e8889601ac7307a54e6aae03612", + "image": { + "name": "docker.io/library/busybox:1.28" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "hello-cronjob-27900585-6zngl" + } + }, + "MetricSetFields": { + "id": "f8e2e2fe9a308d4e81707c0a2daa53424a862e8889601ac7307a54e6aae03612", + "name": "hello-cronjob", + "status": { + "phase": "terminated", + "ready": false, + "reason": "Completed", + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "6f8e923de52f2af9aa23e91b97bf5f45dc6c631aa950c0a3782f847634bbe60b", + "image": { + "name": "registry.k8s.io/coredns/coredns:v1.9.3" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "coredns-565d847f94-dgwk8" + } + }, + "MetricSetFields": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "6f8e923de52f2af9aa23e91b97bf5f45dc6c631aa950c0a3782f847634bbe60b", + "memory": { + "limit": { + "bytes": 178257920 + }, + "request": { + "bytes": 73400320 + } + }, + "name": "coredns", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "003627b6d02209f47b06938519f61ca8d3baf740f2f04866bfeb9f7d4533e997", + "image": { + "name": "docker.io/kindest/local-path-provisioner:v0.0.22-kind.0" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "local-path-storage", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "local-path-provisioner-684f458cdd-wvdbd" + } + }, + "MetricSetFields": { + "id": "003627b6d02209f47b06938519f61ca8d3baf740f2f04866bfeb9f7d4533e997", + "name": "local-path-provisioner", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "9a7de41e53002ae76fe82103317edb4565ce383e3bf0395b796b4486ebc70d05", + "image": { + "name": "registry.k8s.io/kube-proxy:v1.25.3" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-proxy-flrd6" + } + }, + "MetricSetFields": { + "id": "9a7de41e53002ae76fe82103317edb4565ce383e3bf0395b796b4486ebc70d05", + "name": "kube-proxy", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "548badac9b0ece0c96e7222138e40aa7b9e47832cab06dc84f45a7591ec378cb", + "image": { + "name": "registry.k8s.io/kube-controller-manager:v1.25.3" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-controller-manager-kind-control-plane" + } + }, + "MetricSetFields": { + "cpu": { + "request": { + "cores": 0.2 + } + }, + "id": "548badac9b0ece0c96e7222138e40aa7b9e47832cab06dc84f45a7591ec378cb", + "name": "kube-controller-manager", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "01e704051af1b269270266aa05b6f330d16d88da286600c34744f7abb23618a8", + "image": { + "name": "registry.k8s.io/kube-apiserver:v1.25.3" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-apiserver-kind-control-plane" + } + }, + "MetricSetFields": { + "cpu": { + "request": { + "cores": 0.25 + } + }, + "id": "01e704051af1b269270266aa05b6f330d16d88da286600c34744f7abb23618a8", + "name": "kube-apiserver", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "e2738582ad159bb495172b9571bed309f16f3a5977ca6fd9184e89700369d22b", + "image": { + "name": "registry.k8s.io/etcd:3.5.4-0" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "etcd-kind-control-plane" + } + }, + "MetricSetFields": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "e2738582ad159bb495172b9571bed309f16f3a5977ca6fd9184e89700369d22b", + "memory": { + "request": { + "bytes": 104857600 + } + }, + "name": "etcd", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + }, + { + "RootFields": { + "container": { + "id": "849233d7c0fa232729cb223a66d8fb6287feadf4e4369201067397c92d413fe6", + "image": { + "name": "registry.k8s.io/coredns/coredns:v1.9.3" + }, + "runtime": "containerd" + } + }, + "ModuleFields": { + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "coredns-565d847f94-q2mmv" + } + }, + "MetricSetFields": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "849233d7c0fa232729cb223a66d8fb6287feadf4e4369201067397c92d413fe6", + "memory": { + "limit": { + "bytes": 178257920 + }, + "request": { + "bytes": 73400320 + } + }, + "name": "coredns", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "Index": "", + "ID": "", + "Namespace": "kubernetes.container", + "Timestamp": "0001-01-01T00:00:00Z", + "Error": null, + "Host": "", + "Service": "", + "Took": 0, + "Period": 0, + "DisableTimeSeries": false + } +] \ No newline at end of file diff --git a/metricbeat/module/kubernetes/state_container/_meta/testdata/ksm.v2.4.2.plain-expected.json b/metricbeat/module/kubernetes/state_container/_meta/testdata/ksm.v2.4.2.plain-expected.json new file mode 100644 index 00000000000..b84bf945700 --- /dev/null +++ b/metricbeat/module/kubernetes/state_container/_meta/testdata/ksm.v2.4.2.plain-expected.json @@ -0,0 +1,683 @@ +[ + { + "container": { + "id": "db273ae4a6486d1e52dda314a8d0ce84d9014ce5e0f9c94812119a73d579e2fc", + "image": { + "name": "docker.io/kindest/kindnetd:v20221004-44d545d1" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "limit": { + "cores": 0.1 + }, + "request": { + "cores": 0.1 + } + }, + "id": "db273ae4a6486d1e52dda314a8d0ce84d9014ce5e0f9c94812119a73d579e2fc", + "memory": { + "limit": { + "bytes": 52428800 + }, + "request": { + "bytes": 52428800 + } + }, + "name": "kindnet-cni", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kindnet-4tnzw" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "e2738582ad159bb495172b9571bed309f16f3a5977ca6fd9184e89700369d22b", + "image": { + "name": "registry.k8s.io/etcd:3.5.4-0" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "e2738582ad159bb495172b9571bed309f16f3a5977ca6fd9184e89700369d22b", + "memory": { + "request": { + "bytes": 104857600 + } + }, + "name": "etcd", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "etcd-kind-control-plane" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "6f8e923de52f2af9aa23e91b97bf5f45dc6c631aa950c0a3782f847634bbe60b", + "image": { + "name": "registry.k8s.io/coredns/coredns:v1.9.3" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "6f8e923de52f2af9aa23e91b97bf5f45dc6c631aa950c0a3782f847634bbe60b", + "memory": { + "limit": { + "bytes": 178257920 + }, + "request": { + "bytes": 73400320 + } + }, + "name": "coredns", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "coredns-565d847f94-dgwk8" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "003627b6d02209f47b06938519f61ca8d3baf740f2f04866bfeb9f7d4533e997", + "image": { + "name": "docker.io/kindest/local-path-provisioner:v0.0.22-kind.0" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "id": "003627b6d02209f47b06938519f61ca8d3baf740f2f04866bfeb9f7d4533e997", + "name": "local-path-provisioner", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "local-path-storage", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "local-path-provisioner-684f458cdd-wvdbd" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "f2aa38ca30cec5c42fae07ed5cda3046f9392c2a93624815542881ace6aa3ad2", + "image": { + "name": "registry.k8s.io/kube-scheduler:v1.25.3" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "f2aa38ca30cec5c42fae07ed5cda3046f9392c2a93624815542881ace6aa3ad2", + "name": "kube-scheduler", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-scheduler-kind-control-plane" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "69a6e1720df542c8a662873e8ad0694c3d120259fa625bf527269c4d4f1bff34", + "image": { + "name": "docker.io/library/busybox:1.28" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "id": "69a6e1720df542c8a662873e8ad0694c3d120259fa625bf527269c4d4f1bff34", + "name": "hello-cronjob", + "status": { + "phase": "terminated", + "ready": false, + "reason": "Completed", + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "hello-cronjob-27899487-6vx8l" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "26d7459f5f6e7dfce46638648c6bfec8771152583c743ae6a65adf6a3a3419a9", + "image": { + "name": "k8s.gcr.io/kube-state-metrics/kube-state-metrics:v2.4.2" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "id": "26d7459f5f6e7dfce46638648c6bfec8771152583c743ae6a65adf6a3a3419a9", + "name": "kube-state-metrics", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-state-metrics-77bcd445dd-tnbvx" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "cbc3ddaeb5fda1bbd6063297b75340fc69063f9247d6cc3de20a92438b961e1f", + "image": { + "name": "docker.io/library/busybox:1.28" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "id": "cbc3ddaeb5fda1bbd6063297b75340fc69063f9247d6cc3de20a92438b961e1f", + "name": "hello-cronjob", + "status": { + "phase": "terminated", + "ready": false, + "reason": "Completed", + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "hello-cronjob-27899488-mctvl" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "01e704051af1b269270266aa05b6f330d16d88da286600c34744f7abb23618a8", + "image": { + "name": "registry.k8s.io/kube-apiserver:v1.25.3" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "request": { + "cores": 0.25 + } + }, + "id": "01e704051af1b269270266aa05b6f330d16d88da286600c34744f7abb23618a8", + "name": "kube-apiserver", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-apiserver-kind-control-plane" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "9a7de41e53002ae76fe82103317edb4565ce383e3bf0395b796b4486ebc70d05", + "image": { + "name": "registry.k8s.io/kube-proxy:v1.25.3" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "id": "9a7de41e53002ae76fe82103317edb4565ce383e3bf0395b796b4486ebc70d05", + "name": "kube-proxy", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-proxy-flrd6" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "94e7f7b11c08aa225de5477d74f9780548626cb49e60f29b9a7a3fd1d5c27df8", + "image": { + "name": "docker.elastic.co/beats/metricbeat:8.6.0" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "94e7f7b11c08aa225de5477d74f9780548626cb49e60f29b9a7a3fd1d5c27df8", + "memory": { + "limit": { + "bytes": 209715200 + }, + "request": { + "bytes": 104857600 + } + }, + "name": "metricbeat", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "metricbeat-h24sg" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "30514fd6f76760a37d429af91f1d84301b9d1bae00a4b6c2845f07ab8b86eb30", + "image": { + "name": "docker.io/library/busybox:1.28" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "id": "30514fd6f76760a37d429af91f1d84301b9d1bae00a4b6c2845f07ab8b86eb30", + "name": "hello-cronjob", + "status": { + "phase": "terminated", + "ready": false, + "reason": "Completed", + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "hello-cronjob-27899489-sl9hn" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "image": { + "name": "perl:5.34.0" + } + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "name": "pi", + "status": { + "phase": "waiting", + "ready": false, + "reason": "ContainerCreating", + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "pi-m88dn" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "849233d7c0fa232729cb223a66d8fb6287feadf4e4369201067397c92d413fe6", + "image": { + "name": "registry.k8s.io/coredns/coredns:v1.9.3" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "849233d7c0fa232729cb223a66d8fb6287feadf4e4369201067397c92d413fe6", + "memory": { + "limit": { + "bytes": 178257920 + }, + "request": { + "bytes": 73400320 + } + }, + "name": "coredns", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "coredns-565d847f94-q2mmv" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "548badac9b0ece0c96e7222138e40aa7b9e47832cab06dc84f45a7591ec378cb", + "image": { + "name": "registry.k8s.io/kube-controller-manager:v1.25.3" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "request": { + "cores": 0.2 + } + }, + "id": "548badac9b0ece0c96e7222138e40aa7b9e47832cab06dc84f45a7591ec378cb", + "name": "kube-controller-manager", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-controller-manager-kind-control-plane" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + } +] \ No newline at end of file diff --git a/metricbeat/module/kubernetes/state_container/_meta/testdata/ksm.v2.5.0.plain-expected.json b/metricbeat/module/kubernetes/state_container/_meta/testdata/ksm.v2.5.0.plain-expected.json new file mode 100644 index 00000000000..25a54f795dd --- /dev/null +++ b/metricbeat/module/kubernetes/state_container/_meta/testdata/ksm.v2.5.0.plain-expected.json @@ -0,0 +1,686 @@ +[ + { + "container": { + "id": "db273ae4a6486d1e52dda314a8d0ce84d9014ce5e0f9c94812119a73d579e2fc", + "image": { + "name": "docker.io/kindest/kindnetd:v20221004-44d545d1" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "limit": { + "cores": 0.1 + }, + "request": { + "cores": 0.1 + } + }, + "id": "db273ae4a6486d1e52dda314a8d0ce84d9014ce5e0f9c94812119a73d579e2fc", + "memory": { + "limit": { + "bytes": 52428800 + }, + "request": { + "bytes": 52428800 + } + }, + "name": "kindnet-cni", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kindnet-4tnzw" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "e2738582ad159bb495172b9571bed309f16f3a5977ca6fd9184e89700369d22b", + "image": { + "name": "registry.k8s.io/etcd:3.5.4-0" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "e2738582ad159bb495172b9571bed309f16f3a5977ca6fd9184e89700369d22b", + "memory": { + "request": { + "bytes": 104857600 + } + }, + "name": "etcd", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "etcd-kind-control-plane" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "6f8e923de52f2af9aa23e91b97bf5f45dc6c631aa950c0a3782f847634bbe60b", + "image": { + "name": "registry.k8s.io/coredns/coredns:v1.9.3" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "6f8e923de52f2af9aa23e91b97bf5f45dc6c631aa950c0a3782f847634bbe60b", + "memory": { + "limit": { + "bytes": 178257920 + }, + "request": { + "bytes": 73400320 + } + }, + "name": "coredns", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "coredns-565d847f94-dgwk8" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "003627b6d02209f47b06938519f61ca8d3baf740f2f04866bfeb9f7d4533e997", + "image": { + "name": "docker.io/kindest/local-path-provisioner:v0.0.22-kind.0" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "id": "003627b6d02209f47b06938519f61ca8d3baf740f2f04866bfeb9f7d4533e997", + "name": "local-path-provisioner", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "local-path-storage", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "local-path-provisioner-684f458cdd-wvdbd" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "f2aa38ca30cec5c42fae07ed5cda3046f9392c2a93624815542881ace6aa3ad2", + "image": { + "name": "registry.k8s.io/kube-scheduler:v1.25.3" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "f2aa38ca30cec5c42fae07ed5cda3046f9392c2a93624815542881ace6aa3ad2", + "name": "kube-scheduler", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-scheduler-kind-control-plane" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "01e704051af1b269270266aa05b6f330d16d88da286600c34744f7abb23618a8", + "image": { + "name": "registry.k8s.io/kube-apiserver:v1.25.3" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "request": { + "cores": 0.25 + } + }, + "id": "01e704051af1b269270266aa05b6f330d16d88da286600c34744f7abb23618a8", + "name": "kube-apiserver", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-apiserver-kind-control-plane" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "9a7de41e53002ae76fe82103317edb4565ce383e3bf0395b796b4486ebc70d05", + "image": { + "name": "registry.k8s.io/kube-proxy:v1.25.3" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "id": "9a7de41e53002ae76fe82103317edb4565ce383e3bf0395b796b4486ebc70d05", + "name": "kube-proxy", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-proxy-flrd6" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "94e7f7b11c08aa225de5477d74f9780548626cb49e60f29b9a7a3fd1d5c27df8", + "image": { + "name": "docker.elastic.co/beats/metricbeat:8.6.0" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "94e7f7b11c08aa225de5477d74f9780548626cb49e60f29b9a7a3fd1d5c27df8", + "memory": { + "limit": { + "bytes": 209715200 + }, + "request": { + "bytes": 104857600 + } + }, + "name": "metricbeat", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "metricbeat-h24sg" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "e937b71f248fd8327b1261ba9d7f8c52be4377ae374c24ddc6911cb8ab918687", + "image": { + "name": "docker.io/library/busybox:1.28" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "id": "e937b71f248fd8327b1261ba9d7f8c52be4377ae374c24ddc6911cb8ab918687", + "name": "hello-cronjob", + "status": { + "phase": "terminated", + "ready": false, + "reason": "Completed", + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "hello-cronjob-27899499-k5d56" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "3ba2b0ddb34668d521831c06e4c0553e3f93458738356e97647837a13eda1063", + "image": { + "name": "docker.io/library/busybox:1.28" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "id": "3ba2b0ddb34668d521831c06e4c0553e3f93458738356e97647837a13eda1063", + "name": "hello-cronjob", + "status": { + "phase": "terminated", + "ready": false, + "reason": "Completed", + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "hello-cronjob-27899497-ffm4g" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "4c58768671aab3b73013a030c4125c8f9d39d51772a3c75df19c84bc055094ed", + "image": { + "name": "k8s.gcr.io/kube-state-metrics/kube-state-metrics:v2.5.0" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "id": "4c58768671aab3b73013a030c4125c8f9d39d51772a3c75df19c84bc055094ed", + "name": "kube-state-metrics", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-state-metrics-8595684f78-ppcnj" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "f315b3d7ed76c1a93eb20f2adfdbd0783a235c8714fb26462eb9a555427d0246", + "image": { + "name": "docker.io/library/busybox:1.28" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "id": "f315b3d7ed76c1a93eb20f2adfdbd0783a235c8714fb26462eb9a555427d0246", + "name": "hello-cronjob", + "status": { + "phase": "terminated", + "ready": false, + "reason": "Completed", + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "hello-cronjob-27899498-q8cl7" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "849233d7c0fa232729cb223a66d8fb6287feadf4e4369201067397c92d413fe6", + "image": { + "name": "registry.k8s.io/coredns/coredns:v1.9.3" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "849233d7c0fa232729cb223a66d8fb6287feadf4e4369201067397c92d413fe6", + "memory": { + "limit": { + "bytes": 178257920 + }, + "request": { + "bytes": 73400320 + } + }, + "name": "coredns", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "coredns-565d847f94-q2mmv" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "b1ca049c0844dbb44840975d0fb8e0cfd90eeec664bfbc5e0e70d2e2ac47d839", + "image": { + "name": "docker.io/library/perl:5.34.0" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "id": "b1ca049c0844dbb44840975d0fb8e0cfd90eeec664bfbc5e0e70d2e2ac47d839", + "name": "pi", + "status": { + "phase": "terminated", + "ready": false, + "reason": "Completed", + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "pi-m88dn" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "548badac9b0ece0c96e7222138e40aa7b9e47832cab06dc84f45a7591ec378cb", + "image": { + "name": "registry.k8s.io/kube-controller-manager:v1.25.3" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "request": { + "cores": 0.2 + } + }, + "id": "548badac9b0ece0c96e7222138e40aa7b9e47832cab06dc84f45a7591ec378cb", + "name": "kube-controller-manager", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-controller-manager-kind-control-plane" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + } +] \ No newline at end of file diff --git a/metricbeat/module/kubernetes/state_container/_meta/testdata/ksm.v2.6.0.plain-expected.json b/metricbeat/module/kubernetes/state_container/_meta/testdata/ksm.v2.6.0.plain-expected.json new file mode 100644 index 00000000000..ec45e07bc98 --- /dev/null +++ b/metricbeat/module/kubernetes/state_container/_meta/testdata/ksm.v2.6.0.plain-expected.json @@ -0,0 +1,726 @@ +[ + { + "container": { + "id": "db273ae4a6486d1e52dda314a8d0ce84d9014ce5e0f9c94812119a73d579e2fc", + "image": { + "name": "docker.io/kindest/kindnetd:v20221004-44d545d1" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "limit": { + "cores": 0.1 + }, + "request": { + "cores": 0.1 + } + }, + "id": "db273ae4a6486d1e52dda314a8d0ce84d9014ce5e0f9c94812119a73d579e2fc", + "memory": { + "limit": { + "bytes": 52428800 + }, + "request": { + "bytes": 52428800 + } + }, + "name": "kindnet-cni", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kindnet-4tnzw" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "e2738582ad159bb495172b9571bed309f16f3a5977ca6fd9184e89700369d22b", + "image": { + "name": "registry.k8s.io/etcd:3.5.4-0" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "e2738582ad159bb495172b9571bed309f16f3a5977ca6fd9184e89700369d22b", + "memory": { + "request": { + "bytes": 104857600 + } + }, + "name": "etcd", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "etcd-kind-control-plane" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "6f8e923de52f2af9aa23e91b97bf5f45dc6c631aa950c0a3782f847634bbe60b", + "image": { + "name": "registry.k8s.io/coredns/coredns:v1.9.3" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "6f8e923de52f2af9aa23e91b97bf5f45dc6c631aa950c0a3782f847634bbe60b", + "memory": { + "limit": { + "bytes": 178257920 + }, + "request": { + "bytes": 73400320 + } + }, + "name": "coredns", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "coredns-565d847f94-dgwk8" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "003627b6d02209f47b06938519f61ca8d3baf740f2f04866bfeb9f7d4533e997", + "image": { + "name": "docker.io/kindest/local-path-provisioner:v0.0.22-kind.0" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "id": "003627b6d02209f47b06938519f61ca8d3baf740f2f04866bfeb9f7d4533e997", + "name": "local-path-provisioner", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "local-path-storage", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "local-path-provisioner-684f458cdd-wvdbd" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "f2aa38ca30cec5c42fae07ed5cda3046f9392c2a93624815542881ace6aa3ad2", + "image": { + "name": "registry.k8s.io/kube-scheduler:v1.25.3" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "f2aa38ca30cec5c42fae07ed5cda3046f9392c2a93624815542881ace6aa3ad2", + "name": "kube-scheduler", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-scheduler-kind-control-plane" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "cfcec5447b0a83749e71ac33db2b97db3271f576281f51daf50b3cd3220353af", + "image": { + "name": "registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.6.0" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "id": "cfcec5447b0a83749e71ac33db2b97db3271f576281f51daf50b3cd3220353af", + "name": "kube-state-metrics", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-state-metrics-5897f6cf77-jq242" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "01e704051af1b269270266aa05b6f330d16d88da286600c34744f7abb23618a8", + "image": { + "name": "registry.k8s.io/kube-apiserver:v1.25.3" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "request": { + "cores": 0.25 + } + }, + "id": "01e704051af1b269270266aa05b6f330d16d88da286600c34744f7abb23618a8", + "name": "kube-apiserver", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-apiserver-kind-control-plane" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "9a7de41e53002ae76fe82103317edb4565ce383e3bf0395b796b4486ebc70d05", + "image": { + "name": "registry.k8s.io/kube-proxy:v1.25.3" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "id": "9a7de41e53002ae76fe82103317edb4565ce383e3bf0395b796b4486ebc70d05", + "name": "kube-proxy", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-proxy-flrd6" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "94e7f7b11c08aa225de5477d74f9780548626cb49e60f29b9a7a3fd1d5c27df8", + "image": { + "name": "docker.elastic.co/beats/metricbeat:8.6.0" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "94e7f7b11c08aa225de5477d74f9780548626cb49e60f29b9a7a3fd1d5c27df8", + "memory": { + "limit": { + "bytes": 209715200 + }, + "request": { + "bytes": 104857600 + } + }, + "name": "metricbeat", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "metricbeat-h24sg" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "e937b71f248fd8327b1261ba9d7f8c52be4377ae374c24ddc6911cb8ab918687", + "image": { + "name": "docker.io/library/busybox:1.28" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "id": "e937b71f248fd8327b1261ba9d7f8c52be4377ae374c24ddc6911cb8ab918687", + "name": "hello-cronjob", + "status": { + "phase": "terminated", + "ready": false, + "reason": "Completed", + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "hello-cronjob-27899499-k5d56" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "89392d8ac34feb009401e4d3b1e8f19293b952355f8c8a6b54a0e19ad74c5892", + "image": { + "name": "docker.io/library/busybox:1.28" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "id": "89392d8ac34feb009401e4d3b1e8f19293b952355f8c8a6b54a0e19ad74c5892", + "name": "hello-cronjob", + "status": { + "phase": "terminated", + "ready": false, + "reason": "Completed", + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "hello-cronjob-27899500-skmng" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "d1149ce4c5c9fed787e0858c53f2e78c6f739dd48db2845f315287efd1c7f54e", + "image": { + "name": "docker.io/library/busybox:1.28" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "id": "d1149ce4c5c9fed787e0858c53f2e78c6f739dd48db2845f315287efd1c7f54e", + "name": "hello-cronjob", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "hello-cronjob-27899501-t2lnn" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "f315b3d7ed76c1a93eb20f2adfdbd0783a235c8714fb26462eb9a555427d0246", + "image": { + "name": "docker.io/library/busybox:1.28" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "id": "f315b3d7ed76c1a93eb20f2adfdbd0783a235c8714fb26462eb9a555427d0246", + "name": "hello-cronjob", + "status": { + "phase": "terminated", + "ready": false, + "reason": "Completed", + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "hello-cronjob-27899498-q8cl7" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "849233d7c0fa232729cb223a66d8fb6287feadf4e4369201067397c92d413fe6", + "image": { + "name": "registry.k8s.io/coredns/coredns:v1.9.3" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "849233d7c0fa232729cb223a66d8fb6287feadf4e4369201067397c92d413fe6", + "memory": { + "limit": { + "bytes": 178257920 + }, + "request": { + "bytes": 73400320 + } + }, + "name": "coredns", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "coredns-565d847f94-q2mmv" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "b1ca049c0844dbb44840975d0fb8e0cfd90eeec664bfbc5e0e70d2e2ac47d839", + "image": { + "name": "docker.io/library/perl:5.34.0" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "id": "b1ca049c0844dbb44840975d0fb8e0cfd90eeec664bfbc5e0e70d2e2ac47d839", + "name": "pi", + "status": { + "phase": "terminated", + "ready": false, + "reason": "Completed", + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "pi-m88dn" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "548badac9b0ece0c96e7222138e40aa7b9e47832cab06dc84f45a7591ec378cb", + "image": { + "name": "registry.k8s.io/kube-controller-manager:v1.25.3" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "request": { + "cores": 0.2 + } + }, + "id": "548badac9b0ece0c96e7222138e40aa7b9e47832cab06dc84f45a7591ec378cb", + "name": "kube-controller-manager", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-controller-manager-kind-control-plane" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + } +] \ No newline at end of file diff --git a/metricbeat/module/kubernetes/state_container/_meta/testdata/ksm.v2.7.0.plain-expected.json b/metricbeat/module/kubernetes/state_container/_meta/testdata/ksm.v2.7.0.plain-expected.json new file mode 100644 index 00000000000..0bc2879952d --- /dev/null +++ b/metricbeat/module/kubernetes/state_container/_meta/testdata/ksm.v2.7.0.plain-expected.json @@ -0,0 +1,686 @@ +[ + { + "container": { + "id": "db273ae4a6486d1e52dda314a8d0ce84d9014ce5e0f9c94812119a73d579e2fc", + "image": { + "name": "docker.io/kindest/kindnetd:v20221004-44d545d1" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "limit": { + "cores": 0.1 + }, + "request": { + "cores": 0.1 + } + }, + "id": "db273ae4a6486d1e52dda314a8d0ce84d9014ce5e0f9c94812119a73d579e2fc", + "memory": { + "limit": { + "bytes": 52428800 + }, + "request": { + "bytes": 52428800 + } + }, + "name": "kindnet-cni", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kindnet-4tnzw" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "e2738582ad159bb495172b9571bed309f16f3a5977ca6fd9184e89700369d22b", + "image": { + "name": "registry.k8s.io/etcd:3.5.4-0" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "e2738582ad159bb495172b9571bed309f16f3a5977ca6fd9184e89700369d22b", + "memory": { + "request": { + "bytes": 104857600 + } + }, + "name": "etcd", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "etcd-kind-control-plane" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "6f8e923de52f2af9aa23e91b97bf5f45dc6c631aa950c0a3782f847634bbe60b", + "image": { + "name": "registry.k8s.io/coredns/coredns:v1.9.3" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "6f8e923de52f2af9aa23e91b97bf5f45dc6c631aa950c0a3782f847634bbe60b", + "memory": { + "limit": { + "bytes": 178257920 + }, + "request": { + "bytes": 73400320 + } + }, + "name": "coredns", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "coredns-565d847f94-dgwk8" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "18bddca29930370d9cfa083969de095894f7b77b5c63fd0712128ea7de6c64fd", + "image": { + "name": "docker.io/library/busybox:1.28" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "id": "18bddca29930370d9cfa083969de095894f7b77b5c63fd0712128ea7de6c64fd", + "name": "hello-cronjob", + "status": { + "phase": "terminated", + "ready": false, + "reason": "Completed", + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "hello-cronjob-27900587-r7g6w" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "003627b6d02209f47b06938519f61ca8d3baf740f2f04866bfeb9f7d4533e997", + "image": { + "name": "docker.io/kindest/local-path-provisioner:v0.0.22-kind.0" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "id": "003627b6d02209f47b06938519f61ca8d3baf740f2f04866bfeb9f7d4533e997", + "name": "local-path-provisioner", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "local-path-storage", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "local-path-provisioner-684f458cdd-wvdbd" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "f2aa38ca30cec5c42fae07ed5cda3046f9392c2a93624815542881ace6aa3ad2", + "image": { + "name": "registry.k8s.io/kube-scheduler:v1.25.3" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "f2aa38ca30cec5c42fae07ed5cda3046f9392c2a93624815542881ace6aa3ad2", + "name": "kube-scheduler", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-scheduler-kind-control-plane" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "01e704051af1b269270266aa05b6f330d16d88da286600c34744f7abb23618a8", + "image": { + "name": "registry.k8s.io/kube-apiserver:v1.25.3" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "request": { + "cores": 0.25 + } + }, + "id": "01e704051af1b269270266aa05b6f330d16d88da286600c34744f7abb23618a8", + "name": "kube-apiserver", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-apiserver-kind-control-plane" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "f8e2e2fe9a308d4e81707c0a2daa53424a862e8889601ac7307a54e6aae03612", + "image": { + "name": "docker.io/library/busybox:1.28" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "id": "f8e2e2fe9a308d4e81707c0a2daa53424a862e8889601ac7307a54e6aae03612", + "name": "hello-cronjob", + "status": { + "phase": "terminated", + "ready": false, + "reason": "Completed", + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "hello-cronjob-27900585-6zngl" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "9a7de41e53002ae76fe82103317edb4565ce383e3bf0395b796b4486ebc70d05", + "image": { + "name": "registry.k8s.io/kube-proxy:v1.25.3" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "id": "9a7de41e53002ae76fe82103317edb4565ce383e3bf0395b796b4486ebc70d05", + "name": "kube-proxy", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-proxy-flrd6" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "bbecc08bbf0158bdc85f4ed006cddbf40f51d7348ce5cbd95e86d367d20e8fbb", + "image": { + "name": "docker.elastic.co/beats/metricbeat:8.6.0" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "bbecc08bbf0158bdc85f4ed006cddbf40f51d7348ce5cbd95e86d367d20e8fbb", + "memory": { + "limit": { + "bytes": 209715200 + }, + "request": { + "bytes": 104857600 + } + }, + "name": "metricbeat", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "metricbeat-6xfvl" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "d58ac7bcd7b24a58132d3021f13301d2a0995e74f98596956e8f20e19029f2be", + "image": { + "name": "registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.7.0" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "id": "d58ac7bcd7b24a58132d3021f13301d2a0995e74f98596956e8f20e19029f2be", + "name": "kube-state-metrics", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-state-metrics-548546fc89-qrkzb" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "77d181df6b24476654d367bdcadc543c65371de07cc71044fc8a0bafc20a2105", + "image": { + "name": "docker.io/library/busybox:1.28" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "id": "77d181df6b24476654d367bdcadc543c65371de07cc71044fc8a0bafc20a2105", + "name": "hello-cronjob", + "status": { + "phase": "terminated", + "ready": false, + "reason": "Completed", + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "hello-cronjob-27900586-psw5h" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "849233d7c0fa232729cb223a66d8fb6287feadf4e4369201067397c92d413fe6", + "image": { + "name": "registry.k8s.io/coredns/coredns:v1.9.3" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "request": { + "cores": 0.1 + } + }, + "id": "849233d7c0fa232729cb223a66d8fb6287feadf4e4369201067397c92d413fe6", + "memory": { + "limit": { + "bytes": 178257920 + }, + "request": { + "bytes": 73400320 + } + }, + "name": "coredns", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "coredns-565d847f94-q2mmv" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "b1ca049c0844dbb44840975d0fb8e0cfd90eeec664bfbc5e0e70d2e2ac47d839", + "image": { + "name": "docker.io/library/perl:5.34.0" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "id": "b1ca049c0844dbb44840975d0fb8e0cfd90eeec664bfbc5e0e70d2e2ac47d839", + "name": "pi", + "status": { + "phase": "terminated", + "ready": false, + "reason": "Completed", + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "pi-m88dn" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + }, + { + "container": { + "id": "548badac9b0ece0c96e7222138e40aa7b9e47832cab06dc84f45a7591ec378cb", + "image": { + "name": "registry.k8s.io/kube-controller-manager:v1.25.3" + }, + "runtime": "containerd" + }, + "event": { + "dataset": "kubernetes.container", + "duration": 115000, + "module": "kubernetes" + }, + "kubernetes": { + "container": { + "cpu": { + "request": { + "cores": 0.2 + } + }, + "id": "548badac9b0ece0c96e7222138e40aa7b9e47832cab06dc84f45a7591ec378cb", + "name": "kube-controller-manager", + "status": { + "phase": "running", + "ready": true, + "restarts": 0 + } + }, + "namespace": "kube-system", + "node": { + "name": "kind-control-plane" + }, + "pod": { + "name": "kube-controller-manager-kind-control-plane" + } + }, + "metricset": { + "name": "state_container", + "period": 10000 + }, + "service": { + "address": "127.0.0.1:55555", + "type": "kubernetes" + } + } +] \ No newline at end of file diff --git a/metricbeat/module/kubernetes/state_container/state_container.go b/metricbeat/module/kubernetes/state_container/state_container.go index 523dec36bc3..40d181bfceb 100644 --- a/metricbeat/module/kubernetes/state_container/state_container.go +++ b/metricbeat/module/kubernetes/state_container/state_container.go @@ -153,8 +153,17 @@ func (m *MetricSet) Fetch(reporter mb.ReporterV2) error { } split := strings.Index(cID, "://") if split != -1 { +<<<<<<< HEAD util.ShouldPut(containerFields, "runtime", cID[:split], m.Logger()) util.ShouldPut(containerFields, "id", cID[split+3:], m.Logger()) +======= + kubernetes.ShouldPut(containerFields, "runtime", cID[:split], m.Logger()) + + // Add splitted container.id ECS field and update kubernetes.container.id with splitted value + kubernetes.ShouldPut(containerFields, "id", cID[split+3:], m.Logger()) + kubernetes.ShouldPut(event, "id", cID[split+3:], m.Logger()) + +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)) } } if containerImage, ok := event["image"]; ok { diff --git a/metricbeat/module/kubernetes/util/kubernetes.go b/metricbeat/module/kubernetes/util/kubernetes.go index deac93945a1..8b39f1bad3a 100644 --- a/metricbeat/module/kubernetes/util/kubernetes.go +++ b/metricbeat/module/kubernetes/util/kubernetes.go @@ -207,7 +207,7 @@ func NewContainerMetadataEnricher( if !ok { base.Logger().Debugf("Error while casting event: %s", ok) } - meta := metaGen.Generate(pod) + pmeta := metaGen.Generate(pod) statuses := make(map[string]*kubernetes.PodContainerStatus) mapStatuses := func(s []kubernetes.PodContainerStatus) { @@ -218,7 +218,12 @@ func NewContainerMetadataEnricher( mapStatuses(pod.Status.ContainerStatuses) mapStatuses(pod.Status.InitContainerStatuses) for _, container := range append(pod.Spec.Containers, pod.Spec.InitContainers...) { +<<<<<<< HEAD cuid := ContainerUID(pod.GetObjectMeta().GetNamespace(), pod.GetObjectMeta().GetName(), container.Name) +======= + cmeta := mapstr.M{} + metrics := NewContainerMetrics() +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)) // Report container limits to PerfMetrics cache if cpu, ok := container.Resources.Limits["cpu"]; ok { @@ -237,13 +242,20 @@ func NewContainerMetadataEnricher( // which is in the form of :// split := strings.Index(s.ContainerID, "://") if split != -1 { +<<<<<<< HEAD ShouldPut(meta, "container.id", s.ContainerID[split+3:], base.Logger()) ShouldPut(meta, "container.runtime", s.ContainerID[:split], base.Logger()) +======= + kubernetes2.ShouldPut(cmeta, "container.id", s.ContainerID[split+3:], base.Logger()) + + kubernetes2.ShouldPut(cmeta, "container.runtime", s.ContainerID[:split], base.Logger()) +>>>>>>> 4ac4973250 (Fix container enricher with correct container ids for pods with multiple containers (#34516)) } } id := join(pod.GetObjectMeta().GetNamespace(), pod.GetObjectMeta().GetName(), container.Name) - m[id] = meta + cmeta.DeepUpdate(pmeta) + m[id] = cmeta } }, // delete