diff --git a/build/docker/Dockerfile b/build/docker/Dockerfile index 1487d3e5..1d0abade 100644 --- a/build/docker/Dockerfile +++ b/build/docker/Dockerfile @@ -23,13 +23,7 @@ FROM debian:11.7@sha256:432f545c6ba13b79e2681f4cc4858788b0ab099fc1cca799cc0fae46 RUN apt update RUN apt install -y systemd -FROM scratch - -ARG USER_UID=10001 -USER ${USER_UID} - -COPY --from=prep /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt -COPY --from=builder /src/swi-k8s-opentelemetry-collector /swi-otelcol +FROM scratch as journalbinaries # dynamically linked libraries that are required for journalctl and the journalctl binary itself # use `ldd /bin/journalctl` to get dynamically linked libraries from the binary @@ -60,6 +54,15 @@ COPY --from=journal /usr/lib/x86_64-linux-gnu/libpcre2-8.so.0 /usr/lib/x86_64-li COPY --from=journal /lib/x86_64-linux-gnu/libcap-ng.so.0 /lib/x86_64-linux-gnu/libcap-ng.so.0 COPY --from=journal /bin/journalctl /bin/journalctl +FROM scratch + +ARG USER_UID=10001 +USER ${USER_UID} + +COPY --from=prep /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt +COPY --from=builder /src/swi-k8s-opentelemetry-collector /swi-otelcol +COPY --from=journalbinaries / / + ENTRYPOINT ["/swi-otelcol"] CMD ["--config=/opt/default-config.yaml"] diff --git a/build/docker/wiremockFiles/redirectKubeStateMetricsResponse.txt b/build/docker/wiremockFiles/redirectKubeStateMetricsResponse.txt index cc4931d2..bf524e14 100644 --- a/build/docker/wiremockFiles/redirectKubeStateMetricsResponse.txt +++ b/build/docker/wiremockFiles/redirectKubeStateMetricsResponse.txt @@ -199,11 +199,6 @@ kube_pod_container_resource_limits{container="test-container",endpoint="http",in kube_pod_container_resource_limits{container="test-container",endpoint="http",instance="test-node",job="test-job",namespace="test-namespace",node="test-node",pod="test-pod",resource="memory",service="test-service",uid="bafeef2c-1292-4a5e-a92c-d709480b04b6",unit="byte",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 3.221225472e+09 1675856675021 kube_pod_container_resource_limits{container="test-container",endpoint="tcp-model",instance="test-node",job="test-job",namespace="test-namespace",node="test-node",pod="test-pod",resource="memory",service="test-service",uid="bafeef2c-1292-4a5e-a92c-d709480b04b6",unit="byte",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 3.221225472e+09 1675856675021 kube_pod_container_resource_limits{container="test-container",endpoint="tcp-model",instance="test-node",job="test-job",namespace="test-namespace",node="test-node",pod="test-pod",resource="cpu",service="test-service",uid="bafeef2c-1292-4a5e-a92c-d709480b04b6",unit="core",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 0.1 1675856675021 -# TYPE kube_pod_container_resource_limits_cpu_cores untyped -kube_pod_container_resource_limits_cpu_cores{container="test-container",endpoint="tcp-model",instance="test-node",job="test-job",namespace="test-namespace",node="test-node",pod="test-pod",service="test-service",uid="71057e83-7723-4db5-a7ca-52ad7904e34d",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 1 1675856675021 -# TYPE kube_pod_container_resource_limits_memory_bytes untyped -kube_pod_container_resource_limits_memory_bytes{container="test-container",endpoint="tcp-model",instance="test-node",job="test-job",namespace="test-namespace",node="test-node",pod="test-pod",service="test-service",uid="03d2b55c-b225-476b-9178-c74f8e5eaba2",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 2.68435456e+08 1675856675021 -kube_pod_container_resource_limits_memory_bytes{container="test-container",endpoint="tcp-model",instance="test-node",job="test-job",namespace="test-namespace",node="test-node",pod="test-pod",service="test-service",uid="bafeef2c-1292-4a5e-a92c-d709480b04b6",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 3.221225472e+09 1675856675021 # TYPE kube_pod_container_resource_requests untyped kube_pod_container_resource_requests{container="test-container",endpoint="http",instance="test-node",job="test-job",namespace="test-namespace",node="test-node",pod="test-pod",resource="cpu",service="test-service",uid="f15ca7ca-af33-4f43-a793-ec3176b31842",unit="core",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 0.1 1675856675021 kube_pod_container_resource_requests{container="test-container",endpoint="http",instance="test-node",job="test-job",namespace="test-namespace",node="test-node",pod="test-pod",resource="memory",service="test-service",uid="bafeef2c-1292-4a5e-a92c-d709480b04b6",unit="byte",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 3.221225472e+09 1675856675021 @@ -242,14 +237,6 @@ kube_pod_info{container="test-container",created_by_kind="ReplicaSet",created_by kube_pod_init_container_info{container="test-container",container_id="docker://f1c98663d614379552d6c9aae831b4eb3e149c469d4d589b62ea077cf3dad807",endpoint="http",image="busybox:1.29.2",image_id="docker-pullable://busybox@sha256:cb63aa0641a885f54de20f61d152187419e8f6b159ed11a251a09d115fdff9bd",instance="test-node",job="test-job",namespace="test-namespace",pod="test-pod",service="test-service",uid="9cab81cb-9da1-4029-ac51-c7c3024c6fbf",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 1 1675856675021 kube_pod_init_container_info{container="test-container",container_id="docker://f55a97f615b1a90f15f114def871a7d4f0ed8a32d9a329cc7e2f94a24d4780c1",endpoint="http",image="fullstorydev/grpcurl:latest",image_id="docker-pullable://fullstorydev/grpcurl@sha256:d42ef512419560776bee5bb51e338a1734a0edb99f450b6d98fd98bcc93796f3",instance="test-node",job="test-job",namespace="test-namespace",pod="test-pod",service="test-service",uid="bafeef2c-1292-4a5e-a92c-d709480b04b6",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 1 1675856675021 kube_pod_init_container_info{container="test-container",container_id="docker://6fb07210b86971939dbfb16ae47f98afdb8214a52a21dd5fc26f21ae35c09d9e",endpoint="http",image="busybox:latest",image_id="docker-pullable://busybox@sha256:b5d6fe0712636ceb7430189de28819e195e8966372edfc2d9409d79402a0dc16",instance="test-node",job="test-job",namespace="test-namespace",pod="test-pod",service="test-service",uid="bafeef2c-1292-4a5e-a92c-d709480b04b6",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 1 1675856675021 -# TYPE kube_pod_init_container_resource_limits_cpu_cores untyped -kube_pod_init_container_resource_limits_cpu_cores{container="test-container",endpoint="http",instance="test-node",job="test-job",namespace="test-namespace",pod="test-pod",service="test-service",uid="2a82ed12-a31a-427a-adb9-d14cf6a4a063",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 0.1 1675856675021 -# TYPE kube_pod_init_container_resource_limits_memory_bytes untyped -kube_pod_init_container_resource_limits_memory_bytes{container="test-container",endpoint="http",instance="test-node",job="test-job",namespace="test-namespace",pod="test-pod",service="test-service",uid="a920ed2f-477d-4ad7-93d6-3222aabfece2",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 1.073741824e+09 1675856675021 -# TYPE kube_pod_init_container_resource_requests_cpu_cores untyped -kube_pod_init_container_resource_requests_cpu_cores{container="test-container",endpoint="http",instance="test-node",job="test-job",namespace="test-namespace",pod="test-pod",service="test-service",uid="c7f7a05a-a1b5-4fd0-a611-8e2a0e7acbf6",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 0.25 1675856675021 -# TYPE kube_pod_init_container_resource_requests_memory_bytes untyped -kube_pod_init_container_resource_requests_memory_bytes{container="test-container",endpoint="http",instance="test-node",job="test-job",namespace="test-namespace",pod="test-pod",service="test-service",uid="c7f7a05a-a1b5-4fd0-a611-8e2a0e7acbf6",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 6.7108864e+07 1675856675021 # TYPE kube_pod_init_container_status_ready untyped kube_pod_init_container_status_ready{container="test-container",endpoint="http",instance="test-node",job="test-job",namespace="test-namespace",pod="test-pod",service="test-service",uid="64b6d309-44e3-4a41-8883-c15c7cc9bc4a",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 1 1675856675021 kube_pod_init_container_status_ready{container="test-container",endpoint="http",instance="test-node",job="test-job",namespace="test-namespace",pod="test-pod",service="test-service",uid="bafeef2c-1292-4a5e-a92c-d709480b04b6",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 1 1675856675021 diff --git a/deploy/helm/CHANGELOG.md b/deploy/helm/CHANGELOG.md index 21e1d0e3..9d3ec4b4 100644 --- a/deploy/helm/CHANGELOG.md +++ b/deploy/helm/CHANGELOG.md @@ -7,14 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased -## [2.8.0-alpha.2] - 2023-09-14 +### Fixed -### Added +- Detection of Node name for Fargate Nodes's metrics -- Add monitoring windows node logs +## [2.8.0-alpha.3] - 2023-10-06 + +### Changed +- Changing log message attributes to respect OTEL log format +### Fixed +- Fixing nodeselector for kube-state-metrics so that it is deployed on linux nodes only + +## [2.8.0-alpha.2] - 2023-09-14 +### Added + +- Add monitoring windows node logs ## [2.8.0-alpha.1] - 2023-09-11 ### Added diff --git a/deploy/helm/Chart.yaml b/deploy/helm/Chart.yaml index 4bbb68e2..fcd1cf61 100644 --- a/deploy/helm/Chart.yaml +++ b/deploy/helm/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: swo-k8s-collector -version: 2.8.0-alpha.2 +version: 2.8.0-alpha.3 appVersion: "0.8.3" description: SolarWinds Kubernetes Integration keywords: diff --git a/deploy/helm/logs-collector-config.yaml b/deploy/helm/logs-collector-config.yaml index 31ca15ab..e1584b75 100644 --- a/deploy/helm/logs-collector-config.yaml +++ b/deploy/helm/logs-collector-config.yaml @@ -29,7 +29,7 @@ processors: - k8s.namespace.name - k8s.pod.name - k8s.pod.uid - - host.hostname + - host.name - service.name @@ -98,12 +98,8 @@ processors: log_statements: - context: log statements: - - set( attributes["syslog.facility"], 1 ) - - set( attributes["syslog.version"], 1 ) - - set( attributes["host.hostname"], attributes["k8s.pod.name"]) + - set( attributes["host.name"], attributes["k8s.pod.name"]) - set( attributes["service.name"], attributes["k8s.container.name"]) - - set( attributes["syslog.procid"], attributes["run_id"]) - - set( attributes["syslog.msgid"], attributes["stream"]) batch: {{ toYaml .Values.otel.logs.batch | indent 4 }} @@ -232,9 +228,8 @@ receivers: - type: move from: attributes.pod_name to: attributes["k8s.pod.name"] - - type: move - from: attributes.run_id - to: attributes["run_id"] + - type: remove + field: attributes.run_id - type: move from: attributes.uid to: attributes["k8s.pod.uid"] diff --git a/deploy/helm/metrics-collector-config.yaml b/deploy/helm/metrics-collector-config.yaml index 59ce5426..dc2c08d8 100644 --- a/deploy/helm/metrics-collector-config.yaml +++ b/deploy/helm/metrics-collector-config.yaml @@ -50,7 +50,6 @@ processors: datapoint: - 'attributes["container"] == "POD" and IsMatch(metric.name, "container_network_.*|k8s.container.*") == true' - # unify attributes attributes/unify_node_attribute: include: @@ -72,9 +71,13 @@ processors: from_attribute: kubernetes_io_hostname action: insert {{- end }} - - key: k8s.node.name - from_attribute: service.instance.id - action: insert + + transform/unify_node_attribute: + metric_statements: + - context: datapoint + statements: + # use "service.instance.id" for Node name when the attributes/unify_node_attribute processor failed to provide it + - set(attributes["k8s.node.name"], resource.attributes["service.instance.id"]) where IsMatch(metric.name, "^(container_.*)|(kube_node_.*)|(kube_pod_info)|(kube_pod_container_resource_requests)|(kube_pod_container_resource_limits)|(kube_pod_init_container_resource_requests)|(kube_pod_init_container_resource_limits)$") == true and attributes["k8s.node.name"] == nil attributes/unify_volume_attribute: include: @@ -1484,6 +1487,7 @@ service: - transform - filter/remove_internal - attributes/unify_node_attribute + - transform/unify_node_attribute - attributes/unify_volume_attribute - attributes/identify_init_container - attributes/identify_standard_container diff --git a/deploy/helm/templates/swo-agent-statefulset.yaml b/deploy/helm/templates/swo-agent-statefulset.yaml index 644c8308..ef0d0c3f 100644 --- a/deploy/helm/templates/swo-agent-statefulset.yaml +++ b/deploy/helm/templates/swo-agent-statefulset.yaml @@ -27,6 +27,8 @@ spec: solarwinds/swo-agent: "true" spec: securityContext: {} + nodeSelector: + kubernetes.io/os: linux containers: - name: swo-agent image: "{{ .Values.swoagent.image.repository }}:{{ .Values.swoagent.image.tag | default "v2.3.16@sha256:c42c9ca134db54341dc88c3e0c35b1a04db4629b1d97bfde524dfc5d2b8722e5" }}" diff --git a/deploy/helm/tests/__snapshot__/logs-collector-config-map-windows_test.yaml.snap b/deploy/helm/tests/__snapshot__/logs-collector-config-map-windows_test.yaml.snap index 61e5c3d0..1176fb17 100644 --- a/deploy/helm/tests/__snapshot__/logs-collector-config-map-windows_test.yaml.snap +++ b/deploy/helm/tests/__snapshot__/logs-collector-config-map-windows_test.yaml.snap @@ -34,7 +34,7 @@ Logs config for windows nodes should match snapshot when using default values: - k8s.namespace.name - k8s.pod.name - k8s.pod.uid - - host.hostname + - host.name - service.name memory_limiter: check_interval: 1s @@ -65,12 +65,8 @@ Logs config for windows nodes should match snapshot when using default values: log_statements: - context: log statements: - - set( attributes["syslog.facility"], 1 ) - - set( attributes["syslog.version"], 1 ) - - set( attributes["host.hostname"], attributes["k8s.pod.name"]) + - set( attributes["host.name"], attributes["k8s.pod.name"]) - set( attributes["service.name"], attributes["k8s.container.name"]) - - set( attributes["syslog.procid"], attributes["run_id"]) - - set( attributes["syslog.msgid"], attributes["stream"]) receivers: filelog: encoding: utf-8 @@ -156,9 +152,8 @@ Logs config for windows nodes should match snapshot when using default values: - from: attributes.pod_name to: attributes["k8s.pod.name"] type: move - - from: attributes.run_id - to: attributes["run_id"] - type: move + - field: attributes.run_id + type: remove - from: attributes.uid to: attributes["k8s.pod.uid"] type: move diff --git a/deploy/helm/tests/__snapshot__/logs-collector-config-map_test.yaml.snap b/deploy/helm/tests/__snapshot__/logs-collector-config-map_test.yaml.snap index 5e1543a8..b907fc34 100644 --- a/deploy/helm/tests/__snapshot__/logs-collector-config-map_test.yaml.snap +++ b/deploy/helm/tests/__snapshot__/logs-collector-config-map_test.yaml.snap @@ -34,7 +34,7 @@ Logs config should match snapshot when using default values: - k8s.namespace.name - k8s.pod.name - k8s.pod.uid - - host.hostname + - host.name - service.name memory_limiter: check_interval: 1s @@ -85,12 +85,8 @@ Logs config should match snapshot when using default values: log_statements: - context: log statements: - - set( attributes["syslog.facility"], 1 ) - - set( attributes["syslog.version"], 1 ) - - set( attributes["host.hostname"], attributes["k8s.pod.name"]) + - set( attributes["host.name"], attributes["k8s.pod.name"]) - set( attributes["service.name"], attributes["k8s.container.name"]) - - set( attributes["syslog.procid"], attributes["run_id"]) - - set( attributes["syslog.msgid"], attributes["stream"]) receivers: filelog: encoding: utf-8 @@ -176,9 +172,8 @@ Logs config should match snapshot when using default values: - from: attributes.pod_name to: attributes["k8s.pod.name"] type: move - - from: attributes.run_id - to: attributes["run_id"] - type: move + - field: attributes.run_id + type: remove - from: attributes.uid to: attributes["k8s.pod.uid"] type: move diff --git a/deploy/helm/tests/__snapshot__/logs-fargate-config-map_test.yaml.snap b/deploy/helm/tests/__snapshot__/logs-fargate-config-map_test.yaml.snap index 4b7fb884..0f72621c 100644 --- a/deploy/helm/tests/__snapshot__/logs-fargate-config-map_test.yaml.snap +++ b/deploy/helm/tests/__snapshot__/logs-fargate-config-map_test.yaml.snap @@ -24,7 +24,7 @@ Fargate logging ConfigMap spec should include additional filters when they are c Match * Add sw.k8s.cluster.uid Add sw.k8s.log.type container - Add sw.k8s.agent.manifest.version "2.8.0-alpha.2" + Add sw.k8s.agent.manifest.version "2.8.0-alpha.3" flb_log_cw: "false" output.conf: | [OUTPUT] @@ -64,7 +64,7 @@ Fargate logging ConfigMap spec should match snapshot when Fargate logging is ena Match * Add sw.k8s.cluster.uid Add sw.k8s.log.type container - Add sw.k8s.agent.manifest.version "2.8.0-alpha.2" + Add sw.k8s.agent.manifest.version "2.8.0-alpha.3" flb_log_cw: "false" output.conf: | [OUTPUT] diff --git a/deploy/helm/tests/__snapshot__/metrics-collector-config-map-fargate_test.yaml.snap b/deploy/helm/tests/__snapshot__/metrics-collector-config-map-fargate_test.yaml.snap index 17e2c857..83d65517 100644 --- a/deploy/helm/tests/__snapshot__/metrics-collector-config-map-fargate_test.yaml.snap +++ b/deploy/helm/tests/__snapshot__/metrics-collector-config-map-fargate_test.yaml.snap @@ -339,9 +339,6 @@ Metrics config should match snapshot when using default values: - action: insert from_attribute: node key: k8s.node.name - - action: insert - from_attribute: service.instance.id - key: k8s.node.name include: match_type: regexp metric_names: @@ -1926,6 +1923,13 @@ Metrics config should match snapshot when using default values: - delete_key(resource.attributes, "sw.k8s.job.found") - delete_key(resource.attributes, "sw.k8s.cronjob.found") - delete_key(resource.attributes, "sw.k8s.node.found") + transform/unify_node_attribute: + metric_statements: + - context: datapoint + statements: + - set(attributes["k8s.node.name"], resource.attributes["service.instance.id"]) + where IsMatch(metric.name, "^(container_.*)|(kube_node_.*)|(kube_pod_info)|(kube_pod_container_resource_requests)|(kube_pod_container_resource_limits)|(kube_pod_init_container_resource_requests)|(kube_pod_init_container_resource_limits)$") + == true and attributes["k8s.node.name"] == nil receivers: k8s_events: null prometheus/kube-state-metrics: @@ -1989,6 +1993,7 @@ Metrics config should match snapshot when using default values: - transform - filter/remove_internal - attributes/unify_node_attribute + - transform/unify_node_attribute - attributes/unify_volume_attribute - attributes/identify_init_container - attributes/identify_standard_container diff --git a/deploy/helm/tests/__snapshot__/metrics-collector-config-map_test.yaml.snap b/deploy/helm/tests/__snapshot__/metrics-collector-config-map_test.yaml.snap index 3a67f7fa..e378529c 100644 --- a/deploy/helm/tests/__snapshot__/metrics-collector-config-map_test.yaml.snap +++ b/deploy/helm/tests/__snapshot__/metrics-collector-config-map_test.yaml.snap @@ -342,9 +342,6 @@ Metrics config should match snapshot when using default values: - action: insert from_attribute: kubernetes_io_hostname key: k8s.node.name - - action: insert - from_attribute: service.instance.id - key: k8s.node.name include: match_type: regexp metric_names: @@ -1929,6 +1926,13 @@ Metrics config should match snapshot when using default values: - delete_key(resource.attributes, "sw.k8s.job.found") - delete_key(resource.attributes, "sw.k8s.cronjob.found") - delete_key(resource.attributes, "sw.k8s.node.found") + transform/unify_node_attribute: + metric_statements: + - context: datapoint + statements: + - set(attributes["k8s.node.name"], resource.attributes["service.instance.id"]) + where IsMatch(metric.name, "^(container_.*)|(kube_node_.*)|(kube_pod_info)|(kube_pod_container_resource_requests)|(kube_pod_container_resource_limits)|(kube_pod_init_container_resource_requests)|(kube_pod_init_container_resource_limits)$") + == true and attributes["k8s.node.name"] == nil receivers: k8s_events: null prometheus/kube-state-metrics: @@ -1992,6 +1996,7 @@ Metrics config should match snapshot when using default values: - transform - filter/remove_internal - attributes/unify_node_attribute + - transform/unify_node_attribute - attributes/unify_volume_attribute - attributes/identify_init_container - attributes/identify_standard_container diff --git a/deploy/helm/values.yaml b/deploy/helm/values.yaml index af3b0ef2..395e588f 100644 --- a/deploy/helm/values.yaml +++ b/deploy/helm/values.yaml @@ -401,6 +401,10 @@ kube-state-metrics: prometheusScrape: false + nodeSelector: + kubernetes.io/os: linux + kubernetes.io/arch: amd64 + swoagent: # Whether the SWO Agent should be deployed as part of this chart. # If not, integrations are not available. diff --git a/tests/integration/expected_output.json b/tests/integration/expected_output.json index 3ae3e6f3..f539e632 100644 --- a/tests/integration/expected_output.json +++ b/tests/integration/expected_output.json @@ -156,7 +156,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -392,7 +392,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -634,7 +634,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -876,7 +876,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -1118,7 +1118,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -1360,7 +1360,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -1566,7 +1566,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -1814,7 +1814,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -2068,7 +2068,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -2310,7 +2310,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -2534,7 +2534,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -2740,7 +2740,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -3242,7 +3242,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -3460,7 +3460,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -3666,7 +3666,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -4555,7 +4555,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -5028,7 +5028,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -5228,7 +5228,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -5554,7 +5554,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -5831,7 +5831,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -6753,7 +6753,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -6961,7 +6961,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -7167,7 +7167,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -7779,7 +7779,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -8015,7 +8015,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -8233,7 +8233,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -8506,7 +8506,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -8736,7 +8736,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -8960,7 +8960,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -9215,7 +9215,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -9403,7 +9403,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -9597,7 +9597,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -9898,7 +9898,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -10123,7 +10123,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -10305,7 +10305,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -10373,194 +10373,6 @@ } ] }, - { - "resource": { - "attributes": [ - { - "key": "container", - "value": { - "stringValue": "test-container" - } - }, - { - "key": "http.scheme", - "value": { - "stringValue": "http" - } - }, - { - "key": "k8s.cluster.name", - "value": { - "stringValue": "cluster name" - } - }, - { - "key": "k8s.container.name", - "value": { - "stringValue": "test-container" - } - }, - { - "key": "k8s.namespace.annotations.description", - "value": { - "stringValue": "This is a test namespace." - } - }, - { - "key": "k8s.namespace.labels.app", - "value": { - "stringValue": "test-app" - } - }, - { - "key": "k8s.namespace.labels.kubernetes.io/metadata.name", - "value": { - "stringValue": "test-namespace" - } - }, - { - "key": "k8s.namespace.labels.purpose", - "value": { - "stringValue": "testing" - } - }, - { - "key": "k8s.namespace.name", - "value": { - "stringValue": "test-namespace" - } - }, - { - "key": "k8s.node.name", - "value": { - "stringValue": "test-node" - } - }, - { - "key": "k8s.pod.annotations.test-annotation", - "value": { - "stringValue": "test-value" - } - }, - { - "key": "k8s.pod.labels.app", - "value": { - "stringValue": "test-pod" - } - }, - { - "key": "k8s.pod.name", - "value": { - "stringValue": "test-pod" - } - }, - { - "key": "k8s.pod.uid", - "value": { - "stringValue": "2a82ed12-a31a-427a-adb9-d14cf6a4a063" - } - }, - { - "key": "namespace", - "value": { - "stringValue": "test-namespace" - } - }, - { - "key": "net.host.name", - "value": { - "stringValue": "test-node" - } - }, - { - "key": "net.host.port", - "value": { - "stringValue": "" - } - }, - { - "key": "pod", - "value": { - "stringValue": "test-pod" - } - }, - { - "key": "sw.k8s.agent.app.version", - "value": { - "stringValue": "0.8.3" - } - }, - { - "key": "sw.k8s.agent.manifest.version", - "value": { - "stringValue": "2.8.0-alpha.2" - } - }, - { - "key": "sw.k8s.cluster.uid", - "value": { - "stringValue": "cluster-uid-123456789" - } - }, - { - "key": "sw.k8s.container.init", - "value": { - "stringValue": "true" - } - }, - { - "key": "uid", - "value": { - "stringValue": "2a82ed12-a31a-427a-adb9-d14cf6a4a063" - } - } - ] - }, - "scopeMetrics": [ - { - "metrics": [ - { - "gauge": { - "dataPoints": [ - { - "asDouble": 0.1, - "attributes": [ - { - "key": "endpoint", - "value": { - "stringValue": "http" - } - }, - { - "key": "prometheus", - "value": { - "stringValue": "prometheus-system/kube-prometheus-kube-prome-prometheus" - } - }, - { - "key": "prometheus_replica", - "value": { - "stringValue": "prometheus-kube-prometheus-kube-prome-prometheus-0" - } - }, - { - "key": "service", - "value": { - "stringValue": "test-service" - } - } - ], - "timeUnixNano": "0" - } - ] - }, - "name": "k8s.kube_pod_init_container_resource_limits_cpu_cores" - } - ], - "scope": {} - } - ] - }, { "resource": { "attributes": [ @@ -10681,7 +10493,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -10875,7 +10687,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -11063,7 +10875,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -11245,7 +11057,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -11433,7 +11245,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -11627,7 +11439,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -11653,43 +11465,6 @@ "scopeMetrics": [ { "metrics": [ - { - "gauge": { - "dataPoints": [ - { - "asDouble": 1073741824, - "attributes": [ - { - "key": "endpoint", - "value": { - "stringValue": "http" - } - }, - { - "key": "prometheus", - "value": { - "stringValue": "prometheus-system/kube-prometheus-kube-prome-prometheus" - } - }, - { - "key": "prometheus_replica", - "value": { - "stringValue": "prometheus-kube-prometheus-kube-prome-prometheus-0" - } - }, - { - "key": "service", - "value": { - "stringValue": "test-service" - } - } - ], - "timeUnixNano": "0" - } - ] - }, - "name": "k8s.kube_pod_init_container_resource_limits_memory_bytes" - }, { "name": "k8s.kube_pod_init_container_status_restarts_total", "sum": { @@ -11866,7 +11641,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -12060,7 +11835,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -12284,7 +12059,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -12719,7 +12494,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -12913,7 +12688,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -13294,7 +13069,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -13524,7 +13299,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -13913,7 +13688,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -14107,7 +13882,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -14137,7 +13912,7 @@ "gauge": { "dataPoints": [ { - "asDouble": 0.25, + "asDouble": 0, "attributes": [ { "key": "endpoint", @@ -14168,13 +13943,13 @@ } ] }, - "name": "k8s.kube_pod_init_container_resource_requests_cpu_cores" + "name": "k8s.kube_pod_init_container_status_running" }, { "gauge": { "dataPoints": [ { - "asDouble": 67108864, + "asDouble": 1, "attributes": [ { "key": "endpoint", @@ -14205,13 +13980,13 @@ } ] }, - "name": "k8s.kube_pod_init_container_resource_requests_memory_bytes" + "name": "k8s.kube_pod_init_container_status_terminated" }, { "gauge": { "dataPoints": [ { - "asDouble": 0, + "asDouble": 1, "attributes": [ { "key": "endpoint", @@ -14231,6 +14006,12 @@ "stringValue": "prometheus-kube-prometheus-kube-prome-prometheus-0" } }, + { + "key": "reason", + "value": { + "stringValue": "Completed" + } + }, { "key": "service", "value": { @@ -14242,93 +14023,13 @@ } ] }, - "name": "k8s.kube_pod_init_container_status_running" + "name": "k8s.kube_pod_init_container_status_terminated_reason" }, { "gauge": { "dataPoints": [ { - "asDouble": 1, - "attributes": [ - { - "key": "endpoint", - "value": { - "stringValue": "http" - } - }, - { - "key": "prometheus", - "value": { - "stringValue": "prometheus-system/kube-prometheus-kube-prome-prometheus" - } - }, - { - "key": "prometheus_replica", - "value": { - "stringValue": "prometheus-kube-prometheus-kube-prome-prometheus-0" - } - }, - { - "key": "service", - "value": { - "stringValue": "test-service" - } - } - ], - "timeUnixNano": "0" - } - ] - }, - "name": "k8s.kube_pod_init_container_status_terminated" - }, - { - "gauge": { - "dataPoints": [ - { - "asDouble": 1, - "attributes": [ - { - "key": "endpoint", - "value": { - "stringValue": "http" - } - }, - { - "key": "prometheus", - "value": { - "stringValue": "prometheus-system/kube-prometheus-kube-prome-prometheus" - } - }, - { - "key": "prometheus_replica", - "value": { - "stringValue": "prometheus-kube-prometheus-kube-prome-prometheus-0" - } - }, - { - "key": "reason", - "value": { - "stringValue": "Completed" - } - }, - { - "key": "service", - "value": { - "stringValue": "test-service" - } - } - ], - "timeUnixNano": "0" - } - ] - }, - "name": "k8s.kube_pod_init_container_status_terminated_reason" - }, - { - "gauge": { - "dataPoints": [ - { - "asDouble": 0, + "asDouble": 0, "attributes": [ { "key": "endpoint", @@ -14504,7 +14205,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -14900,7 +14601,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -15106,7 +14807,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -15461,7 +15162,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -15813,7 +15514,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -15881,382 +15582,6 @@ } ] }, - { - "resource": { - "attributes": [ - { - "key": "container", - "value": { - "stringValue": "test-container" - } - }, - { - "key": "http.scheme", - "value": { - "stringValue": "http" - } - }, - { - "key": "k8s.cluster.name", - "value": { - "stringValue": "cluster name" - } - }, - { - "key": "k8s.container.name", - "value": { - "stringValue": "test-container" - } - }, - { - "key": "k8s.namespace.annotations.description", - "value": { - "stringValue": "This is a test namespace." - } - }, - { - "key": "k8s.namespace.labels.app", - "value": { - "stringValue": "test-app" - } - }, - { - "key": "k8s.namespace.labels.kubernetes.io/metadata.name", - "value": { - "stringValue": "test-namespace" - } - }, - { - "key": "k8s.namespace.labels.purpose", - "value": { - "stringValue": "testing" - } - }, - { - "key": "k8s.namespace.name", - "value": { - "stringValue": "test-namespace" - } - }, - { - "key": "k8s.pod.annotations.test-annotation", - "value": { - "stringValue": "test-value" - } - }, - { - "key": "k8s.pod.labels.app", - "value": { - "stringValue": "test-pod" - } - }, - { - "key": "k8s.pod.name", - "value": { - "stringValue": "test-pod" - } - }, - { - "key": "k8s.pod.uid", - "value": { - "stringValue": "03d2b55c-b225-476b-9178-c74f8e5eaba2" - } - }, - { - "key": "namespace", - "value": { - "stringValue": "test-namespace" - } - }, - { - "key": "net.host.name", - "value": { - "stringValue": "test-node" - } - }, - { - "key": "net.host.port", - "value": { - "stringValue": "" - } - }, - { - "key": "pod", - "value": { - "stringValue": "test-pod" - } - }, - { - "key": "sw.k8s.agent.app.version", - "value": { - "stringValue": "0.8.3" - } - }, - { - "key": "sw.k8s.agent.manifest.version", - "value": { - "stringValue": "2.8.0-alpha.2" - } - }, - { - "key": "sw.k8s.cluster.uid", - "value": { - "stringValue": "cluster-uid-123456789" - } - }, - { - "key": "sw.k8s.container.init", - "value": { - "stringValue": "false" - } - }, - { - "key": "uid", - "value": { - "stringValue": "03d2b55c-b225-476b-9178-c74f8e5eaba2" - } - } - ] - }, - "scopeMetrics": [ - { - "metrics": [ - { - "gauge": { - "dataPoints": [ - { - "asDouble": 268435456, - "attributes": [ - { - "key": "endpoint", - "value": { - "stringValue": "tcp-model" - } - }, - { - "key": "node", - "value": { - "stringValue": "test-node" - } - }, - { - "key": "prometheus", - "value": { - "stringValue": "prometheus-system/kube-prometheus-kube-prome-prometheus" - } - }, - { - "key": "prometheus_replica", - "value": { - "stringValue": "prometheus-kube-prometheus-kube-prome-prometheus-0" - } - }, - { - "key": "service", - "value": { - "stringValue": "test-service" - } - } - ], - "timeUnixNano": "0" - } - ] - }, - "name": "k8s.kube_pod_container_resource_limits_memory_bytes" - } - ], - "scope": {} - } - ] - }, - { - "resource": { - "attributes": [ - { - "key": "container", - "value": { - "stringValue": "test-container" - } - }, - { - "key": "http.scheme", - "value": { - "stringValue": "http" - } - }, - { - "key": "k8s.cluster.name", - "value": { - "stringValue": "cluster name" - } - }, - { - "key": "k8s.container.name", - "value": { - "stringValue": "test-container" - } - }, - { - "key": "k8s.namespace.annotations.description", - "value": { - "stringValue": "This is a test namespace." - } - }, - { - "key": "k8s.namespace.labels.app", - "value": { - "stringValue": "test-app" - } - }, - { - "key": "k8s.namespace.labels.kubernetes.io/metadata.name", - "value": { - "stringValue": "test-namespace" - } - }, - { - "key": "k8s.namespace.labels.purpose", - "value": { - "stringValue": "testing" - } - }, - { - "key": "k8s.namespace.name", - "value": { - "stringValue": "test-namespace" - } - }, - { - "key": "k8s.pod.annotations.test-annotation", - "value": { - "stringValue": "test-value" - } - }, - { - "key": "k8s.pod.labels.app", - "value": { - "stringValue": "test-pod" - } - }, - { - "key": "k8s.pod.name", - "value": { - "stringValue": "test-pod" - } - }, - { - "key": "k8s.pod.uid", - "value": { - "stringValue": "71057e83-7723-4db5-a7ca-52ad7904e34d" - } - }, - { - "key": "namespace", - "value": { - "stringValue": "test-namespace" - } - }, - { - "key": "net.host.name", - "value": { - "stringValue": "test-node" - } - }, - { - "key": "net.host.port", - "value": { - "stringValue": "" - } - }, - { - "key": "pod", - "value": { - "stringValue": "test-pod" - } - }, - { - "key": "sw.k8s.agent.app.version", - "value": { - "stringValue": "0.8.3" - } - }, - { - "key": "sw.k8s.agent.manifest.version", - "value": { - "stringValue": "2.8.0-alpha.2" - } - }, - { - "key": "sw.k8s.cluster.uid", - "value": { - "stringValue": "cluster-uid-123456789" - } - }, - { - "key": "sw.k8s.container.init", - "value": { - "stringValue": "false" - } - }, - { - "key": "uid", - "value": { - "stringValue": "71057e83-7723-4db5-a7ca-52ad7904e34d" - } - } - ] - }, - "scopeMetrics": [ - { - "metrics": [ - { - "gauge": { - "dataPoints": [ - { - "asDouble": 1, - "attributes": [ - { - "key": "endpoint", - "value": { - "stringValue": "tcp-model" - } - }, - { - "key": "node", - "value": { - "stringValue": "test-node" - } - }, - { - "key": "prometheus", - "value": { - "stringValue": "prometheus-system/kube-prometheus-kube-prome-prometheus" - } - }, - { - "key": "prometheus_replica", - "value": { - "stringValue": "prometheus-kube-prometheus-kube-prome-prometheus-0" - } - }, - { - "key": "service", - "value": { - "stringValue": "test-service" - } - } - ], - "timeUnixNano": "0" - } - ] - }, - "name": "k8s.kube_pod_container_resource_limits_cpu_cores" - } - ], - "scope": {} - } - ] - }, { "resource": { "attributes": [ @@ -16371,7 +15696,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -16809,49 +16134,6 @@ }, "name": "k8s.kube_pod_container_resource_limits" }, - { - "gauge": { - "dataPoints": [ - { - "asDouble": 3221225472, - "attributes": [ - { - "key": "endpoint", - "value": { - "stringValue": "tcp-model" - } - }, - { - "key": "node", - "value": { - "stringValue": "test-node" - } - }, - { - "key": "prometheus", - "value": { - "stringValue": "prometheus-system/kube-prometheus-kube-prome-prometheus" - } - }, - { - "key": "prometheus_replica", - "value": { - "stringValue": "prometheus-kube-prometheus-kube-prome-prometheus-0" - } - }, - { - "key": "service", - "value": { - "stringValue": "test-service" - } - } - ], - "timeUnixNano": "0" - } - ] - }, - "name": "k8s.kube_pod_container_resource_limits_memory_bytes" - }, { "gauge": { "dataPoints": [ @@ -17074,7 +16356,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -17329,7 +16611,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -17578,7 +16860,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -21523,7 +20805,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -21741,7 +21023,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -21878,7 +21160,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { @@ -22975,7 +22257,7 @@ { "key": "sw.k8s.agent.manifest.version", "value": { - "stringValue": "2.8.0-alpha.2" + "stringValue": "2.8.0-alpha.3" } }, { diff --git a/tests/integration/test_metric_collection.py b/tests/integration/test_metric_collection.py index a8cb9df6..34dbbfbc 100644 --- a/tests/integration/test_metric_collection.py +++ b/tests/integration/test_metric_collection.py @@ -126,7 +126,7 @@ def assert_test_metric_names_found(content): missing_metric_names = [ name for name in expected_metric_names if name not in metric_names] - error = f'Some specific metric names are not found in the response\ + error = f'Some specific metric names are not found in the response. \ Missing metrics: {missing_metric_names}' return (metric_matches, error) diff --git a/tests/integration/test_utils.py b/tests/integration/test_utils.py index 8d8020b0..3a6a1bdf 100644 --- a/tests/integration/test_utils.py +++ b/tests/integration/test_utils.py @@ -158,16 +158,24 @@ def process_metric_type(metric): sort_datapoints(metric) def merge_datapoints(existing_datapoints, new_datapoints): - existing_datapoints_dict = {datapoint_sorting_key(dp): dp for dp in existing_datapoints} + merged_datapoints = [(datapoint_sorting_key(dp), dp) for dp in existing_datapoints] for new_datapoint in new_datapoints: new_datapoint_hash_key = datapoint_sorting_key(new_datapoint) + found = False # flag to track if a matching datapoint was found + + for key, existing_datapoint in merged_datapoints: + if key == new_datapoint_hash_key: + existing_datapoint.update(new_datapoint) # update existing_datapoint in-place + found = True # set flag to True since a matching datapoint was found + break # exit the loop since a match was found and handled + + if not found: # if no matching datapoint was found, append the new datapoint + merged_datapoints.append((new_datapoint_hash_key, new_datapoint)) - if new_datapoint_hash_key in existing_datapoints_dict: - existing_datapoints_dict[new_datapoint_hash_key].update(new_datapoint) - else: - existing_datapoints.append(new_datapoint) - + existing_datapoints.clear() + existing_datapoints.extend(dp for _, dp in merged_datapoints) + def merge_metrics(existing_metric, new_metric): metric_types = ["sum", "gauge", "histogram"] @@ -178,11 +186,12 @@ def merge_metrics(existing_metric, new_metric): merge_datapoints(existing_datapoints, new_datapoints) def merge_scope_metrics(existing_scope, new_scope): - existing_metrics = {metric["name"]: metric for metric in existing_scope["metrics"]} - for new_metric in new_scope["metrics"]: - if new_metric["name"] in existing_metrics: - merge_metrics(existing_metrics[new_metric["name"]], new_metric) + new_metric_name = new_metric["name"] + for existing_metric in existing_scope["metrics"]: + if existing_metric["name"] == new_metric_name: + merge_metrics(existing_metric, new_metric) + break else: existing_scope["metrics"].append(new_metric) @@ -198,17 +207,20 @@ def merge_resources(existing_resource, new_resource): existing_scopes.append(new_scope) def custom_json_merge(result, new_json): - new_resources = {resource_sorting_key(resource): resource for resource in new_json["resourceMetrics"]} + new_resources = [(resource_sorting_key(resource), resource) for resource in new_json["resourceMetrics"]] + for existing_resource in result["resourceMetrics"]: existing_key = resource_sorting_key(existing_resource) - if existing_key in new_resources: - merge_resources(existing_resource, new_resources.pop(existing_key)) + matching_new_resources = [item for item in new_resources if item[0] == existing_key] + for _, new_resource in matching_new_resources: + merge_resources(existing_resource, new_resource) + new_resources.remove((existing_key, new_resource)) - result["resourceMetrics"].extend(new_resources.values()) + result["resourceMetrics"].extend(resource for _, resource in new_resources) def get_merged_json(content): result = {"resourceMetrics": []} - for line in content.splitlines(): + for line in content.splitlines()[-10:]: # only process the last 10 json lines custom_json_merge(result, json.loads(line)) # Sort the result and set timeStamps to 0 to make it easier to compare