From 54d93eca15f883a340c74d71e99f98293a11b575 Mon Sep 17 00:00:00 2001 From: obs-gh-alexlew <153021320+obs-gh-alexlew@users.noreply.github.com> Date: Wed, 21 Aug 2024 14:45:39 -0700 Subject: [PATCH 1/7] feat: bump observe-agent version to 1.0.0 (#180) --- charts/agent/Chart.yaml | 2 +- charts/agent/README.md | 10 +++++----- charts/agent/templates/_config-exporters.tpl | 7 +++---- charts/agent/templates/_observe-agent.tpl | 5 ++++- charts/agent/values.yaml | 8 ++++---- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/charts/agent/Chart.yaml b/charts/agent/Chart.yaml index 2e9c1530..db42e4dc 100644 --- a/charts/agent/Chart.yaml +++ b/charts/agent/Chart.yaml @@ -3,7 +3,7 @@ name: agent description: Chart to install K8s collection stack based on Observe Agent type: application version: 0.5.2 -appVersion: "0.11.0" +appVersion: "1.0.0" dependencies: - name: opentelemetry-collector version: 0.101.1 diff --git a/charts/agent/README.md b/charts/agent/README.md index 14f57920..51c5199b 100644 --- a/charts/agent/README.md +++ b/charts/agent/README.md @@ -1,6 +1,6 @@ # agent -![Version: 0.5.2](https://img.shields.io/badge/Version-0.5.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.11.0](https://img.shields.io/badge/AppVersion-0.11.0-informational?style=flat-square) +![Version: 0.5.2](https://img.shields.io/badge/Version-0.5.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square) > [!CAUTION] > This chart is under active development and is not meant to be installed yet. @@ -80,7 +80,7 @@ Chart to install K8s collection stack based on Observe Agent | daemonset-logs-metrics.extraVolumes[4].name | string | `"hostfs"` | | | daemonset-logs-metrics.image.pullPolicy | string | `"IfNotPresent"` | | | daemonset-logs-metrics.image.repository | string | `"observeinc/observe-agent"` | | -| daemonset-logs-metrics.image.tag | string | `"0.11.0"` | | +| daemonset-logs-metrics.image.tag | string | `"1.0.0"` | | | daemonset-logs-metrics.initContainers[0].env[0].name | string | `"NAMESPACE"` | | | daemonset-logs-metrics.initContainers[0].env[0].valueFrom.fieldRef.fieldPath | string | `"metadata.namespace"` | | | daemonset-logs-metrics.initContainers[0].image | string | `"observeinc/kube-cluster-info:v0.11.1"` | | @@ -136,7 +136,7 @@ Chart to install K8s collection stack based on Observe Agent | deployment-agent-monitor.extraVolumes[0].name | string | `"observe-agent-deployment-config"` | | | deployment-agent-monitor.image.pullPolicy | string | `"IfNotPresent"` | | | deployment-agent-monitor.image.repository | string | `"observeinc/observe-agent"` | | -| deployment-agent-monitor.image.tag | string | `"0.11.0"` | | +| deployment-agent-monitor.image.tag | string | `"1.0.0"` | | | deployment-agent-monitor.initContainers[0].env[0].name | string | `"NAMESPACE"` | | | deployment-agent-monitor.initContainers[0].env[0].valueFrom.fieldRef.fieldPath | string | `"metadata.namespace"` | | | deployment-agent-monitor.initContainers[0].image | string | `"observeinc/kube-cluster-info:v0.11.1"` | | @@ -190,7 +190,7 @@ Chart to install K8s collection stack based on Observe Agent | deployment-cluster-events.extraVolumes[0].name | string | `"observe-agent-deployment-config"` | | | deployment-cluster-events.image.pullPolicy | string | `"IfNotPresent"` | | | deployment-cluster-events.image.repository | string | `"observeinc/observe-agent"` | | -| deployment-cluster-events.image.tag | string | `"0.11.0"` | | +| deployment-cluster-events.image.tag | string | `"1.0.0"` | | | deployment-cluster-events.initContainers[0].env[0].name | string | `"NAMESPACE"` | | | deployment-cluster-events.initContainers[0].env[0].valueFrom.fieldRef.fieldPath | string | `"metadata.namespace"` | | | deployment-cluster-events.initContainers[0].image | string | `"observeinc/kube-cluster-info:v0.11.1"` | | @@ -244,7 +244,7 @@ Chart to install K8s collection stack based on Observe Agent | deployment-cluster-metrics.extraVolumes[0].name | string | `"observe-agent-deployment-config"` | | | deployment-cluster-metrics.image.pullPolicy | string | `"IfNotPresent"` | | | deployment-cluster-metrics.image.repository | string | `"observeinc/observe-agent"` | | -| deployment-cluster-metrics.image.tag | string | `"0.11.0"` | | +| deployment-cluster-metrics.image.tag | string | `"1.0.0"` | | | deployment-cluster-metrics.initContainers[0].env[0].name | string | `"NAMESPACE"` | | | deployment-cluster-metrics.initContainers[0].env[0].valueFrom.fieldRef.fieldPath | string | `"metadata.namespace"` | | | deployment-cluster-metrics.initContainers[0].image | string | `"observeinc/kube-cluster-info:v0.11.1"` | | diff --git a/charts/agent/templates/_config-exporters.tpl b/charts/agent/templates/_config-exporters.tpl index bb42c4a3..938fd31f 100644 --- a/charts/agent/templates/_config-exporters.tpl +++ b/charts/agent/templates/_config-exporters.tpl @@ -1,25 +1,24 @@ {{- define "config.exporters.otlphttp.observe.base" -}} otlphttp/observe/base: - endpoint: "{{ trimSuffix "/" .Values.observe.collectionEndpoint }}/v2/otel" + endpoint: "{{ .Values.observe.collectionEndpoint | toString | trimSuffix "/" }}/v2/otel" headers: authorization: "Bearer {{ .Values.observe.token }}" {{- end -}} {{- define "config.exporters.otlphttp.observe.entity" -}} otlphttp/observe/entity: - logs_endpoint: "{{ trimSuffix "/" .Values.observe.collectionEndpoint }}/v1/kubernetes/v1/entity" + logs_endpoint: "{{ .Values.observe.collectionEndpoint | toString | trimSuffix "/" }}/v1/kubernetes/v1/entity" headers: authorization: "Bearer {{ .Values.observe.entityToken }}" {{- end -}} {{- define "config.exporters.prometheusremotewrite" -}} prometheusremotewrite: - endpoint: "{{ trimSuffix "/" .Values.observe.collectionEndpoint }}/v1/prometheus" + endpoint: "{{ .Values.observe.collectionEndpoint | toString | trimSuffix "/" }}/v1/prometheus" headers: authorization: "Bearer {{ .Values.observe.token }}" resource_to_telemetry_conversion: enabled: true # Convert resource attributes to metric labels - {{- end -}} {{- define "config.exporters.debug" -}} diff --git a/charts/agent/templates/_observe-agent.tpl b/charts/agent/templates/_observe-agent.tpl index 487d39f0..3c8033e2 100644 --- a/charts/agent/templates/_observe-agent.tpl +++ b/charts/agent/templates/_observe-agent.tpl @@ -11,5 +11,8 @@ host_monitoring: logs: enabled: false metrics: - enabled: false + host: + enabled: false + process: + enabled: false {{- end }} diff --git a/charts/agent/values.yaml b/charts/agent/values.yaml index 52c5e756..21a29643 100644 --- a/charts/agent/values.yaml +++ b/charts/agent/values.yaml @@ -50,7 +50,7 @@ deployment-cluster-events: repository: observeinc/observe-agent # Overrides the image tag whose default is the chart appVersion. # The service's name will be applied to the end of this value. - tag: "0.11.0" + tag: "1.0.0" pullPolicy: IfNotPresent command: @@ -159,7 +159,7 @@ deployment-cluster-metrics: repository: observeinc/observe-agent # # Overrides the image tag whose default is the chart appVersion. # # The service's name will be applied to the end of this value. - tag: "0.11.0" + tag: "1.0.0" pullPolicy: IfNotPresent command: @@ -266,7 +266,7 @@ daemonset-logs-metrics: repository: observeinc/observe-agent # # Overrides the image tag whose default is the chart appVersion. # # The service's name will be applied to the end of this value. - tag: "0.11.0" + tag: "1.0.0" pullPolicy: IfNotPresent command: @@ -405,7 +405,7 @@ deployment-agent-monitor: repository: observeinc/observe-agent # # Overrides the image tag whose default is the chart appVersion. # # The service's name will be applied to the end of this value. - tag: "0.11.0" + tag: "1.0.0" pullPolicy: IfNotPresent command: From 589fe615f04f863a0ed2067a697a62242ef5c58e Mon Sep 17 00:00:00 2001 From: obs-gh-alexlew <153021320+obs-gh-alexlew@users.noreply.github.com> Date: Wed, 21 Aug 2024 15:55:16 -0700 Subject: [PATCH 2/7] fix: bump chart version to 0.6.0 (#182) --- charts/agent/Chart.yaml | 2 +- charts/agent/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/agent/Chart.yaml b/charts/agent/Chart.yaml index db42e4dc..0a83c99f 100644 --- a/charts/agent/Chart.yaml +++ b/charts/agent/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: agent description: Chart to install K8s collection stack based on Observe Agent type: application -version: 0.5.2 +version: 0.6.0 appVersion: "1.0.0" dependencies: - name: opentelemetry-collector diff --git a/charts/agent/README.md b/charts/agent/README.md index 51c5199b..cb1c8a81 100644 --- a/charts/agent/README.md +++ b/charts/agent/README.md @@ -1,6 +1,6 @@ # agent -![Version: 0.5.2](https://img.shields.io/badge/Version-0.5.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square) +![Version: 0.6.0](https://img.shields.io/badge/Version-0.6.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square) > [!CAUTION] > This chart is under active development and is not meant to be installed yet. From 8e5b1898b3f2ac6dd699ff8393e291dfaec8b663 Mon Sep 17 00:00:00 2001 From: obs-gh-enricogiorio <162458291+obs-gh-enricogiorio@users.noreply.github.com> Date: Thu, 22 Aug 2024 15:56:47 +0200 Subject: [PATCH 3/7] feat: add podCIDR facet for Node (#181) --- charts/agent/templates/_deployment-cluster-events-config.tpl | 1 + 1 file changed, 1 insertion(+) diff --git a/charts/agent/templates/_deployment-cluster-events-config.tpl b/charts/agent/templates/_deployment-cluster-events-config.tpl index 0304771d..464ba6f5 100644 --- a/charts/agent/templates/_deployment-cluster-events-config.tpl +++ b/charts/agent/templates/_deployment-cluster-events-config.tpl @@ -154,6 +154,7 @@ processors: - set(attributes["observe_transform"]["facets"]["kubeletVersion"], body["status"]["nodeInfo"]["kubeletVersion"]) - set(attributes["observe_transform"]["facets"]["osImage"], body["status"]["nodeInfo"]["osImage"]) - set(attributes["observe_transform"]["facets"]["taints"], body["spec"]["taints"]) + - set(attributes["observe_transform"]["facets"]["podCIDR"], body["spec"]["podCIDR"]) # For Deployment - context: log conditions: From 7da9cd1961e001246ed11e82e03af06fcde0f3bf Mon Sep 17 00:00:00 2001 From: obs-gh-enricogiorio <162458291+obs-gh-enricogiorio@users.noreply.github.com> Date: Fri, 23 Aug 2024 19:27:04 +0200 Subject: [PATCH 4/7] fix: Revert "feat: add podCIDR facet for Node (#181)" (#186) This reverts commit 8e5b1898b3f2ac6dd699ff8393e291dfaec8b663. --- charts/agent/templates/_deployment-cluster-events-config.tpl | 1 - 1 file changed, 1 deletion(-) diff --git a/charts/agent/templates/_deployment-cluster-events-config.tpl b/charts/agent/templates/_deployment-cluster-events-config.tpl index 464ba6f5..0304771d 100644 --- a/charts/agent/templates/_deployment-cluster-events-config.tpl +++ b/charts/agent/templates/_deployment-cluster-events-config.tpl @@ -154,7 +154,6 @@ processors: - set(attributes["observe_transform"]["facets"]["kubeletVersion"], body["status"]["nodeInfo"]["kubeletVersion"]) - set(attributes["observe_transform"]["facets"]["osImage"], body["status"]["nodeInfo"]["osImage"]) - set(attributes["observe_transform"]["facets"]["taints"], body["spec"]["taints"]) - - set(attributes["observe_transform"]["facets"]["podCIDR"], body["spec"]["podCIDR"]) # For Deployment - context: log conditions: From 055366c5f28c71786da712de7349ca490fa37e37 Mon Sep 17 00:00:00 2001 From: obs-gh-enricogiorio <162458291+obs-gh-enricogiorio@users.noreply.github.com> Date: Fri, 23 Aug 2024 21:59:49 +0200 Subject: [PATCH 5/7] feat: OB-35438 Collect additional k8s metrics (#188) Configure k8s_cluster receiver to collect allocatable cpu, mem, storage and ephemeral-storage metrics. Configure kubeletstats receiver to collect all optional metrics that are not collected by default. Remove deprecated metrics in favor of up-to-date ones: - k8s.node.cpu.utilization --> k8s.node.cpu.usage - k8s.pod.cpu.utilization --> k8s.pod.cpu.usage - container.cpu.utilization --> container.cpu.usage --- .../_daemonset-logs-metrics-config.tpl | 49 +++++++++++++++++++ .../_deployment-cluster-metrics-config.tpl | 5 ++ 2 files changed, 54 insertions(+) diff --git a/charts/agent/templates/_daemonset-logs-metrics-config.tpl b/charts/agent/templates/_daemonset-logs-metrics-config.tpl index 643dbcad..da3d353b 100644 --- a/charts/agent/templates/_daemonset-logs-metrics-config.tpl +++ b/charts/agent/templates/_daemonset-logs-metrics-config.tpl @@ -62,11 +62,60 @@ receivers: collection_interval: 10s auth_type: 'serviceAccount' endpoint: '${env:K8S_NODE_NAME}:10250' + node: '${env:K8S_NODE_NAME}' insecure_skip_verify: true + k8s_api_config: + auth_type: serviceAccount metric_groups: - node - pod - container + metrics: + # Disable deprecated metrics + k8s.node.cpu.utilization: + enabled: false + k8s.pod.cpu.utilization: + enabled: false + container.cpu.utilization: + enabled: false + # The following metrics are optional and must be enabled manually as per: + # https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/kubeletstatsreceiver/documentation.md#optional-metrics + container.cpu.usage: + enabled: true + container.uptime: + enabled: true + k8s.container.cpu.node.utilization: + enabled: true + k8s.container.cpu_limit_utilization: + enabled: true + k8s.container.cpu_request_utilization: + enabled: true + k8s.container.memory.node.utilization: + enabled: true + k8s.container.memory_limit_utilization: + enabled: true + k8s.container.memory_request_utilization: + enabled: true + k8s.node.cpu.usage: + enabled: true + k8s.node.uptime: + enabled: true + k8s.pod.cpu.node.utilization: + enabled: true + k8s.pod.cpu.usage: + enabled: true + k8s.pod.cpu_limit_utilization: + enabled: true + k8s.pod.cpu_request_utilization: + enabled: true + k8s.pod.memory.node.utilization: + enabled: true + k8s.pod.memory_limit_utilization: + enabled: true + k8s.pod.memory_request_utilization: + enabled: true + k8s.pod.uptime: + enabled: true filelog: exclude: [] diff --git a/charts/agent/templates/_deployment-cluster-metrics-config.tpl b/charts/agent/templates/_deployment-cluster-metrics-config.tpl index 7517a811..9c5c25cf 100644 --- a/charts/agent/templates/_deployment-cluster-metrics-config.tpl +++ b/charts/agent/templates/_deployment-cluster-metrics-config.tpl @@ -15,6 +15,11 @@ receivers: - Ready - MemoryPressure - DiskPressure + allocatable_types_to_report: + - cpu + - memory + - storage + - ephemeral-storage metrics: k8s.node.condition: enabled: true From 3874e6bb2ac313ce2de8c71898f97dd0b54c6bef Mon Sep 17 00:00:00 2001 From: xuewei Date: Thu, 22 Aug 2024 21:11:46 +0000 Subject: [PATCH 6/7] feat: cleanup Deployment/ReplicaSet/ConfigMap facets - deployment -> deploymentName - current/available/ready/desired/etc -> fooReplicas - dropped deployment's total, as we should just use desired instead - dropped ConfigMap's data, as we do NOT want to put the entire configmap data in the facets fixup: updateReplicas -> updatedReplicas, and drop revision for good --- .../_deployment-cluster-events-config.tpl | 50 +++++++------------ 1 file changed, 19 insertions(+), 31 deletions(-) diff --git a/charts/agent/templates/_deployment-cluster-events-config.tpl b/charts/agent/templates/_deployment-cluster-events-config.tpl index 0304771d..c691ef9d 100644 --- a/charts/agent/templates/_deployment-cluster-events-config.tpl +++ b/charts/agent/templates/_deployment-cluster-events-config.tpl @@ -113,11 +113,18 @@ processors: # facets - set(attributes["observe_transform"]["facets"]["creationTimestamp"], body["metadata"]["creationTimestamp"]) - set(attributes["observe_transform"]["facets"]["deletionTimestamp"], body["metadata"]["deletionTimestamp"]) - # - set(attributes["observe_transform"]["facets"]["ownerReference"], body["metadata"]["ownerReferences"][0]) - set(attributes["observe_transform"]["facets"]["ownerRefKind"], body["metadata"]["ownerReferences"][0]["kind"]) - set(attributes["observe_transform"]["facets"]["ownerRefName"], body["metadata"]["ownerReferences"][0]["name"]) - set(attributes["observe_transform"]["facets"]["labels"], body["metadata"]["labels"]) - set(attributes["observe_transform"]["facets"]["annotations"], body["metadata"]["annotations"]) + # controllers with correlation tags + - set(attributes["observe_transform"]["facets"]["replicasetName"], body["metadata"]["ownerReferences"][0]["name"]) where body["metadata"]["ownerReferences"][0]["kind"] == "ReplicaSet" + - set(attributes["observe_transform"]["facets"]["daemonsetName"], body["metadata"]["ownerReferences"][0]["name"]) where body["metadata"]["ownerReferences"][0]["kind"] == "DaemonSet" + - set(attributes["observe_transform"]["facets"]["jobName"], body["metadata"]["ownerReferences"][0]["name"]) where body["metadata"]["ownerReferences"][0]["kind"] == "Job" + - set(attributes["observe_transform"]["facets"]["statefulsetName"], body["metadata"]["ownerReferences"][0]["name"]) where body["metadata"]["ownerReferences"][0]["kind"] == "StatefulSet" + - set(attributes["observe_transform"]["facets"]["deploymentName"], body["metadata"]["ownerReferences"][0]["name"]) where body["metadata"]["ownerReferences"][0]["kind"] == "ReplicaSet" + - replace_pattern(attributes["observe_transform"]["facets"]["deploymentName"], "^(.*)-[0-9a-f]+$$", "$$1") + - set(attributes["observe_transform"]["facets"]["deploymentName"], body["metadata"]["ownerReferences"][0]["name"]) where body["metadata"]["ownerReferences"][0]["kind"] == "Deployment" # For Pod - context: log conditions: @@ -130,14 +137,6 @@ processors: - set(attributes["observe_transform"]["facets"]["startTime"], body["status"]["startTime"]) - set(attributes["observe_transform"]["facets"]["readinessGates"], body["object"]["spec"]["readinessGates"]) - set(attributes["observe_transform"]["facets"]["nodeName"], body["spec"]["nodeName"]) - # controllers - - set(attributes["observe_transform"]["facets"]["replicasetName"], body["metadata"]["ownerReferences"][0]["name"]) where body["metadata"]["ownerReferences"][0]["kind"] == "ReplicaSet" - - set(attributes["observe_transform"]["facets"]["daemonsetName"], body["metadata"]["ownerReferences"][0]["name"]) where body["metadata"]["ownerReferences"][0]["kind"] == "DaemonSet" - - set(attributes["observe_transform"]["facets"]["jobName"], body["metadata"]["ownerReferences"][0]["name"]) where body["metadata"]["ownerReferences"][0]["kind"] == "Job" - - set(attributes["observe_transform"]["facets"]["statefulsetName"], body["metadata"]["ownerReferences"][0]["name"]) where body["metadata"]["ownerReferences"][0]["kind"] == "StatefulSet" - - set(attributes["observe_transform"]["facets"]["deploymentName"], body["metadata"]["ownerReferences"][0]["name"]) where body["metadata"]["ownerReferences"][0]["kind"] == "ReplicaSet" - - replace_pattern(attributes["observe_transform"]["facets"]["deploymentName"], "^(.*)-[0-9a-f]+$$", "$$1") - # For Namespace - context: log conditions: @@ -160,33 +159,22 @@ processors: - body["kind"] == "Deployment" statements: - set(attributes["observe_transform"]["facets"]["selector"], body["spec"]["selector"]["matchLabels"]) - - set(attributes["observe_transform"]["facets"]["revision"], body["metadata"]["annotations"]["deployment.kubernetes.io/revision"]) - - set(attributes["observe_transform"]["facets"]["desired"], body["spec"]["replicas"]) - - set(attributes["observe_transform"]["facets"]["updated"], body["status"]["updatedReplicas"]) - - set(attributes["observe_transform"]["facets"]["total"], body["status"]["replicas"]) - - set(attributes["observe_transform"]["facets"]["available"], body["status"]["availableReplicas"]) - - set(attributes["observe_transform"]["facets"]["unavailable"], body["status"]["unavailableReplicas"]) - - set(attributes["observe_transform"]["facets"]["ready"], body["status"]["readyReplicas"]) - - set(attributes["observe_transform"]["facets"]["ready"], 0) where attributes["observe_transform"]["facets"]["ready"] == nil + - set(attributes["observe_transform"]["facets"]["desiredReplicas"], body["spec"]["replicas"]) + - set(attributes["observe_transform"]["facets"]["updatedReplicas"], body["status"]["updatedReplicas"]) + - set(attributes["observe_transform"]["facets"]["availableReplicas"], body["status"]["availableReplicas"]) + - set(attributes["observe_transform"]["facets"]["readyReplicas"], body["status"]["readyReplicas"]) + - set(attributes["observe_transform"]["facets"]["readyReplicas"], 0) where attributes["observe_transform"]["facets"]["readyReplicas"] == nil + - set(attributes["observe_transform"]["facets"]["unavailableReplicas"], body["status"]["unavailableReplicas"]) # For ReplicaSet - context: log conditions: - body["kind"] == "ReplicaSet" statements: - - set(cache["ownerReferences"], body["metadata"]["ownerReferences"]) - - flatten(cache, depth=3) - - set(attributes["observe_transform"]["facets"]["deployment"], cache["ownerReferences.0"]["name"]) - - set(attributes["observe_transform"]["facets"]["revision"], body["metadata"]["annotations"]["deployment.kubernetes.io/revision"]) - - set(attributes["observe_transform"]["facets"]["desired"], body["spec"]["replicas"]) - - set(attributes["observe_transform"]["facets"]["current"], body["status"]["replicas"]) - - set(attributes["observe_transform"]["facets"]["ready"], body["status"]["readyReplicas"]) - - set(attributes["observe_transform"]["facets"]["ready"], 0) where attributes["observe_transform"]["facets"]["ready"] == nil - # For ConfigMap - - context: log - conditions: - - body["kind"] == "ConfigMap" - statements: - - set(attributes["observe_transform"]["facets"]["data"], body["data"]) + - set(attributes["observe_transform"]["facets"]["desiredReplicas"], body["spec"]["replicas"]) + - set(attributes["observe_transform"]["facets"]["currentReplicas"], body["status"]["replicas"]) + - set(attributes["observe_transform"]["facets"]["availableReplicas"], body["status"]["availableReplicas"]) + - set(attributes["observe_transform"]["facets"]["readyReplicas"], body["status"]["readyReplicas"]) + - set(attributes["observe_transform"]["facets"]["readyReplicas"], 0) where attributes["observe_transform"]["facets"]["readyReplicas"] == nil # For Event - context: log conditions: From c62a44b5bdf29f2b9da1c63db8e9b31506ead36f Mon Sep 17 00:00:00 2001 From: xuewei Date: Mon, 26 Aug 2024 06:24:03 +0000 Subject: [PATCH 7/7] feat: cleanup tagging for (mostly) metrics 1. in k8sattributes, stop adding all labels and annotations as tags. As that is a very pretty big list with unclear value. We should enable them selectively when user needs them. 2. removed k8sattributes/podcontroller, no one is using them 3. dropped resourcedetection for all deployments This is the one that tags a lot of node level information. But, for deployments, it tags about the node that the deployment runs on, instead of the node that runs the things being monitored (e.g. pods). So, the result is very confusing. Let's just drop it. We can add selective tags back when they are useful. 4. change the debug_objectSource tag to debug_source Since it was initially used for entity/object streams only. But now it's being used for logs & metrics data too. --- charts/agent/templates/_config-processors.tpl | 27 ------------------- .../_daemonset-logs-metrics-config.tpl | 25 +++++++++++------ .../_deployment-agent-monitor-config.tpl | 8 +++--- .../_deployment-cluster-events-config.tpl | 18 ++++++------- .../_deployment-cluster-metrics-config.tpl | 8 +++--- 5 files changed, 31 insertions(+), 55 deletions(-) diff --git a/charts/agent/templates/_config-processors.tpl b/charts/agent/templates/_config-processors.tpl index d6cd77d6..f6ab67b2 100644 --- a/charts/agent/templates/_config-processors.tpl +++ b/charts/agent/templates/_config-processors.tpl @@ -14,14 +14,6 @@ batch: {{- define "config.processors.attributes.k8sattributes" -}} k8sattributes: extract: - annotations: - - from: pod - key_regex: (.*) - tag_name: $$1 - labels: - - from: pod - key_regex: (.*) - tag_name: $$1 metadata: - k8s.namespace.name - k8s.deployment.name @@ -33,7 +25,6 @@ k8sattributes: - k8s.node.name - k8s.pod.name - k8s.pod.uid - - k8s.pod.start_time - k8s.cluster.uid - k8s.node.name - k8s.node.uid @@ -49,24 +40,6 @@ k8sattributes: - from: connection {{- end -}} -{{- define "config.processors.attributes.k8sattributes.podcontroller" -}} -k8sattributes/podcontroller: - extract: - metadata: - - k8s.deployment.name - - k8s.statefulset.name - - k8s.replicaset.name - - k8s.daemonset.name - - k8s.cronjob.name - - k8s.job.name - pod_association: - - sources: - - from: resource_attribute - name: k8s.pod.name - - from: resource_attribute - name: k8s.namespace.name -{{- end -}} - {{- define "config.processors.attributes.observe_common" -}} attributes/observe_common: actions: diff --git a/charts/agent/templates/_daemonset-logs-metrics-config.tpl b/charts/agent/templates/_daemonset-logs-metrics-config.tpl index da3d353b..bbed1d21 100644 --- a/charts/agent/templates/_daemonset-logs-metrics-config.tpl +++ b/charts/agent/templates/_daemonset-logs-metrics-config.tpl @@ -145,14 +145,19 @@ processors: {{- include "config.processors.attributes.observe_common" . | nindent 2 }} # attributes to append to objects - attributes/debug_objectSource_pod_logs: + attributes/debug_source_pod_logs: actions: - - key: debug_objectSource + - key: debug_source action: insert value: pod_logs - attributes/debug_objectSource_kublet_metrics: + attributes/debug_source_hostmetrics: actions: - - key: debug_objectSource + - key: debug_source + action: insert + value: hostmetrics + attributes/debug_source_kubletstats_metrics: + actions: + - key: debug_source action: insert value: kubeletstats_metrics @@ -161,11 +166,15 @@ service: pipelines: logs: receivers: [filelog] - processors: [memory_limiter, batch, resourcedetection/cloud, k8sattributes, attributes/observe_common, attributes/debug_objectSource_pod_logs] + processors: [memory_limiter, batch, resourcedetection/cloud, k8sattributes, attributes/observe_common, attributes/debug_source_pod_logs] exporters: [otlphttp/observe/base, debug/override] - metrics: - receivers: [hostmetrics, kubeletstats] - processors: [memory_limiter, batch, resourcedetection/cloud, k8sattributes, attributes/observe_common, attributes/debug_objectSource_kublet_metrics] + hostmetrics: + receivers: [hostmetrics] + processors: [memory_limiter, batch, resourcedetection/cloud, k8sattributes, attributes/observe_common, attributes/debug_source_hostmetrics] + exporters: [prometheusremotewrite, debug/override] + kubeletstatsmetrics: + receivers: [kubeletstats] + processors: [memory_limiter, batch, resourcedetection/cloud, k8sattributes, attributes/observe_common, attributes/debug_source_kubletstats_metrics] exporters: [prometheusremotewrite, debug/override] {{- include "config.service.telemetry" . | nindent 2 }} diff --git a/charts/agent/templates/_deployment-agent-monitor-config.tpl b/charts/agent/templates/_deployment-agent-monitor-config.tpl index 75253e68..3015fe5e 100644 --- a/charts/agent/templates/_deployment-agent-monitor-config.tpl +++ b/charts/agent/templates/_deployment-agent-monitor-config.tpl @@ -54,8 +54,6 @@ receivers: processors: {{- include "config.processors.memory_limiter" . | nindent 2 }} -{{- include "config.processors.resource_detection.cloud" . | nindent 2 }} - {{- include "config.processors.batch" . | nindent 2 }} {{- include "config.processors.attributes.k8sattributes" . | nindent 2 }} @@ -63,9 +61,9 @@ processors: {{- include "config.processors.attributes.observe_common" . | nindent 2 }} # attributes to append to objects - attributes/debug_objectSource_agent_monitor: + attributes/debug_source_agent_monitor: actions: - - key: debug_objectSource + - key: debug_source action: insert value: agent_monitor @@ -74,7 +72,7 @@ service: pipelines: metrics: receivers: [prometheus/collector] - processors: [memory_limiter, batch, resourcedetection/cloud, attributes/observe_common, k8sattributes, attributes/debug_objectSource_agent_monitor] + processors: [memory_limiter, batch, attributes/observe_common, k8sattributes, attributes/debug_source_agent_monitor] exporters: [prometheusremotewrite] {{- include "config.service.telemetry" . | nindent 2 }} diff --git a/charts/agent/templates/_deployment-cluster-events-config.tpl b/charts/agent/templates/_deployment-cluster-events-config.tpl index c691ef9d..80ca91a5 100644 --- a/charts/agent/templates/_deployment-cluster-events-config.tpl +++ b/charts/agent/templates/_deployment-cluster-events-config.tpl @@ -75,8 +75,6 @@ receivers: processors: {{- include "config.processors.memory_limiter" . | nindent 2 }} -{{- include "config.processors.resource_detection.cloud" . | nindent 2 }} - {{- include "config.processors.batch" . | nindent 2 }} {{- include "config.processors.attributes.observe_common" . | nindent 2 }} @@ -93,8 +91,8 @@ processors: - set(attributes["observe_filter"], "objects_pull_watch") # unwrapping for the object_watch stream - set(attributes["observe_transform"]["control"]["isDelete"], true) where body["object"] != nil and body["type"] == "DELETED" - - set(attributes["observe_transform"]["control"]["debug_objectSource"], "watch") where body["object"] != nil and body["type"] != nil - - set(attributes["observe_transform"]["control"]["debug_objectSource"], "pull") where body["object"] == nil or body["type"] == nil + - set(attributes["observe_transform"]["control"]["debug_source"], "watch") where body["object"] != nil and body["type"] != nil + - set(attributes["observe_transform"]["control"]["debug_source"], "pull") where body["object"] == nil or body["type"] == nil - set(body, body["object"]) where body["object"] != nil and body["type"] != nil # native columns: valid_from, valid_to, kind - set(attributes["observe_transform"]["valid_from"], observed_time_unix_nano) @@ -205,8 +203,8 @@ processors: - set(attributes["observe_filter"], "objects_pull_watch") # unwrap the object out of the watch stream - set(attributes["observe_transform"]["control"]["isDelete"], true) where body["object"] != nil and body["type"] == "DELETED" - - set(attributes["observe_transform"]["control"]["debug_objectSource"], "watch") where body["object"] != nil and body["type"] != nil - - set(attributes["observe_transform"]["control"]["debug_objectSource"], "pull") where body["object"] == nil or body["type"] == nil + - set(attributes["observe_transform"]["control"]["debug_source"], "watch") where body["object"] != nil and body["type"] != nil + - set(attributes["observe_transform"]["control"]["debug_source"], "pull") where body["object"] == nil or body["type"] == nil - set(body, body["object"]) where body["object"] != nil and body["type"] != nil # native columns: valid_from, valid_to, kind - set(attributes["observe_transform"]["valid_from"], observed_time_unix_nano) @@ -233,20 +231,20 @@ service: pipelines: logs/objects: receivers: [k8sobjects/objects] - processors: [memory_limiter, batch, resourcedetection/cloud, attributes/observe_common, transform/object, observek8sattributes] + processors: [memory_limiter, batch, attributes/observe_common, transform/object, observek8sattributes] exporters: [otlphttp/observe/base, debug/override] logs/cluster: receivers: [k8sobjects/cluster] - processors: [memory_limiter, batch, resourcedetection/cloud, attributes/observe_common, filter/cluster, transform/cluster] + processors: [memory_limiter, batch, attributes/observe_common, filter/cluster, transform/cluster] exporters: [otlphttp/observe/base, debug/override] {{ if .Values.observe.entityToken -}} logs/entity: receivers: [k8sobjects/objects] - processors: [memory_limiter, batch, resourcedetection/cloud, attributes/observe_common, transform/object, observek8sattributes] + processors: [memory_limiter, batch, attributes/observe_common, transform/object, observek8sattributes] exporters: [otlphttp/observe/entity, debug/override] logs/cluster/entity: receivers: [k8sobjects/cluster] - processors: [memory_limiter, batch, resourcedetection/cloud, attributes/observe_common, filter/cluster, transform/cluster] + processors: [memory_limiter, batch, attributes/observe_common, filter/cluster, transform/cluster] exporters: [otlphttp/observe/entity, debug/override] {{- end }} diff --git a/charts/agent/templates/_deployment-cluster-metrics-config.tpl b/charts/agent/templates/_deployment-cluster-metrics-config.tpl index 9c5c25cf..11aa3d35 100644 --- a/charts/agent/templates/_deployment-cluster-metrics-config.tpl +++ b/charts/agent/templates/_deployment-cluster-metrics-config.tpl @@ -27,8 +27,6 @@ receivers: processors: {{- include "config.processors.memory_limiter" . | nindent 2 }} -{{- include "config.processors.resource_detection.cloud" . | nindent 2 }} - {{- include "config.processors.batch" . | nindent 2 }} {{- include "config.processors.attributes.k8sattributes" . | nindent 2 }} @@ -36,9 +34,9 @@ processors: {{- include "config.processors.attributes.observe_common" . | nindent 2 }} # attributes to append to objects - attributes/debug_objectSource_cluster_metrics: + attributes/debug_source_cluster_metrics: actions: - - key: debug_objectSource + - key: debug_source action: insert value: cluster_metrics @@ -47,7 +45,7 @@ service: pipelines: metrics: receivers: [k8s_cluster] - processors: [memory_limiter, batch, resourcedetection/cloud, k8sattributes, attributes/observe_common, attributes/debug_objectSource_cluster_metrics] + processors: [memory_limiter, batch, k8sattributes, attributes/observe_common, attributes/debug_source_cluster_metrics] exporters: [prometheusremotewrite, debug/override] {{- include "config.service.telemetry" . | nindent 2 }}