Skip to content

Commit

Permalink
fix: Move k8s.cluster.name to resource_attributes
Browse files Browse the repository at this point in the history
Move observe_common attributes (k8s.cluster.name, k8s.cluster.uid) from
attributes to resource_attributes for otellogs.
  • Loading branch information
obs-gh-enricogiorio committed Oct 21, 2024
1 parent 0c5ab0c commit f5b70d4
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion charts/agent/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: agent
description: Chart to install K8s collection stack based on Observe Agent
type: application
version: 0.24.0
version: 0.24.1
appVersion: "1.1.0"
dependencies:
- name: opentelemetry-collector
Expand Down
2 changes: 1 addition & 1 deletion charts/agent/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# agent

![Version: 0.24.0](https://img.shields.io/badge/Version-0.24.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.1.0](https://img.shields.io/badge/AppVersion-1.1.0-informational?style=flat-square)
![Version: 0.24.1](https://img.shields.io/badge/Version-0.24.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.1.0](https://img.shields.io/badge/AppVersion-1.1.0-informational?style=flat-square)

> [!CAUTION]
> This chart is under active development and is not meant to be installed yet.
Expand Down
22 changes: 9 additions & 13 deletions charts/agent/templates/_cluster-events-config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ processors:

{{- include "config.processors.batch" . | nindent 2 }}

{{- include "config.processors.attributes.observe_common" . | nindent 2 }}
{{- include "config.processors.resource.observe_common" . | nindent 2 }}

{{- include "config.processors.attributes.observek8sattributes" . | nindent 2 }}

Expand All @@ -99,10 +99,8 @@ processors:
- set(attributes["observe_transform"]["control"]["isDelete"], false) where attributes["observe_transform"]["control"]["isDelete"] == nil
- set(attributes["observe_transform"]["control"]["version"], body["metadata"]["resourceVersion"])
# identifiers
- set(attributes["observe_transform"]["identifiers"]["clusterName"], attributes["k8s.cluster.name"])
- set(attributes["observe_transform"]["identifiers"]["clusterUid"], attributes["k8s.cluster.uid"])
- set(resource.attributes["clusterName"], attributes["k8s.cluster.name"])
- set(resource.attributes["clusterUid"], attributes["k8s.cluster.uid"])
- set(attributes["observe_transform"]["identifiers"]["clusterName"], resource.attributes["k8s.cluster.name"])
- set(attributes["observe_transform"]["identifiers"]["clusterUid"], resource.attributes["k8s.cluster.uid"])
- set(attributes["observe_transform"]["identifiers"]["kind"], body["kind"])
- set(attributes["observe_transform"]["identifiers"]["name"], body["metadata"]["name"])
- set(attributes["observe_transform"]["identifiers"]["namespaceName"], body["metadata"]["namespace"])
Expand Down Expand Up @@ -415,10 +413,8 @@ processors:
- set(attributes["observe_transform"]["control"]["isDelete"], false) where attributes["observe_transform"]["control"]["isDelete"] == nil
- set(attributes["observe_transform"]["control"]["version"], body["metadata"]["resourceVersion"])
# identifiers
- set(attributes["observe_transform"]["identifiers"]["clusterName"], attributes["k8s.cluster.name"])
- set(attributes["observe_transform"]["identifiers"]["clusterUid"], attributes["k8s.cluster.uid"])
- set(resource.attributes["clusterName"], attributes["k8s.cluster.name"])
- set(resource.attributes["clusterUid"], attributes["k8s.cluster.uid"])
- set(attributes["observe_transform"]["identifiers"]["clusterName"], resource.attributes["k8s.cluster.name"])
- set(attributes["observe_transform"]["identifiers"]["clusterUid"], resource.attributes["k8s.cluster.uid"])
- set(attributes["observe_transform"]["identifiers"]["uid"], attributes["k8s.cluster.uid"])
- set(attributes["observe_transform"]["identifiers"]["kind"], "Cluster")
- set(attributes["observe_transform"]["identifiers"]["name"], attributes["k8s.cluster.name"])
Expand All @@ -434,20 +430,20 @@ service:
pipelines:
logs/objects:
receivers: [k8sobjects/objects]
processors: [memory_limiter, batch, attributes/observe_common, transform/object, observek8sattributes]
processors: [memory_limiter, batch, resource/observe_common, transform/object, observek8sattributes]
exporters: [otlphttp/observe/base, debug/override]
logs/cluster:
receivers: [k8sobjects/cluster]
processors: [memory_limiter, batch, attributes/observe_common, filter/cluster, transform/cluster]
processors: [memory_limiter, batch, resource/observe_common, filter/cluster, transform/cluster]
exporters: [otlphttp/observe/base, debug/override]
{{ if .Values.observe.entityToken.use -}}
logs/entity:
receivers: [k8sobjects/objects]
processors: [memory_limiter, batch, attributes/observe_common, transform/object, observek8sattributes]
processors: [memory_limiter, batch, resource/observe_common, transform/object, observek8sattributes]
exporters: [otlphttp/observe/entity, debug/override]
logs/cluster/entity:
receivers: [k8sobjects/cluster]
processors: [memory_limiter, batch, attributes/observe_common, filter/cluster, transform/cluster]
processors: [memory_limiter, batch, resource/observe_common, filter/cluster, transform/cluster]
exporters: [otlphttp/observe/entity, debug/override]
{{- end }}

Expand Down
6 changes: 3 additions & 3 deletions charts/agent/templates/_cluster-metrics-config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ processors:

{{- include "config.processors.attributes.k8sattributes" . | nindent 2 }}

{{- include "config.processors.attributes.observe_common" . | nindent 2 }}
{{- include "config.processors.resource.observe_common" . | nindent 2 }}

# attributes to append to objects
attributes/debug_source_cluster_metrics:
Expand All @@ -170,12 +170,12 @@ service:
pipelines:
metrics:
receivers: [k8s_cluster]
processors: [memory_limiter, k8sattributes, batch, attributes/observe_common, attributes/debug_source_cluster_metrics]
processors: [memory_limiter, k8sattributes, batch, resource/observe_common, attributes/debug_source_cluster_metrics]
exporters: [prometheusremotewrite, debug/override]
{{- if .Values.application.prometheusScrape.enabled }}
metrics/pod_metrics:
receivers: [prometheus/pod_metrics]
processors: [memory_limiter, k8sattributes, batch, attributes/observe_common, attributes/debug_source_pod_metrics]
processors: [memory_limiter, k8sattributes, batch, resource/observe_common, attributes/debug_source_pod_metrics]
exporters: [prometheusremotewrite, debug/override]
{{ end -}}
{{- include "config.service.telemetry" . | nindent 2 }}
Expand Down
10 changes: 7 additions & 3 deletions charts/agent/templates/_config-processors.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,25 @@ k8sattributes:
- k8s.cluster.uid
- k8s.node.name
- k8s.node.uid
- k8s.container.name
passthrough: false
pod_association:
- sources:
- from: resource_attribute
name: k8s.pod.ip
- sources:
- from: resource_attribute
name: k8s.container.restart_count
- sources:
- from: resource_attribute
name: k8s.pod.uid
- sources:
- from: connection
{{- end -}}

{{- define "config.processors.attributes.observe_common" -}}
attributes/observe_common:
actions:
{{- define "config.processors.resource.observe_common" -}}
resource/observe_common:
attributes:
- key: k8s.cluster.name
action: insert
value: ${env:OBSERVE_CLUSTER_NAME}
Expand Down
4 changes: 2 additions & 2 deletions charts/agent/templates/_monitor-config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ processors:

{{- include "config.processors.attributes.k8sattributes" . | nindent 2 }}

{{- include "config.processors.attributes.observe_common" . | nindent 2 }}
{{- include "config.processors.resource.observe_common" . | nindent 2 }}

# attributes to append to objects
attributes/debug_source_agent_monitor:
Expand All @@ -72,7 +72,7 @@ service:
pipelines:
metrics:
receivers: [prometheus/collector]
processors: [memory_limiter, k8sattributes, batch, attributes/observe_common, attributes/debug_source_agent_monitor]
processors: [memory_limiter, k8sattributes, batch, resource/observe_common, attributes/debug_source_agent_monitor]
exporters: [prometheusremotewrite]
{{- include "config.service.telemetry" . | nindent 2 }}

Expand Down
8 changes: 4 additions & 4 deletions charts/agent/templates/_node-logs-metrics-config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ processors:

{{- include "config.processors.attributes.k8sattributes" . | nindent 2 }}

{{- include "config.processors.attributes.observe_common" . | nindent 2 }}
{{- include "config.processors.resource.observe_common" . | nindent 2 }}
# attributes to append to objects
attributes/debug_source_pod_logs:
actions:
Expand All @@ -168,19 +168,19 @@ service:
{{- if .Values.node.containers.logs.enabled }}
logs:
receivers: [filelog]
processors: [memory_limiter, k8sattributes, batch, resourcedetection/cloud, attributes/observe_common, attributes/debug_source_pod_logs]
processors: [memory_limiter, batch, resourcedetection/cloud, k8sattributes, resource/observe_common, attributes/debug_source_pod_logs]
exporters: [otlphttp/observe/base, debug/override]
{{- end -}}
{{- if .Values.node.metrics.enabled }}
metrics/hostmetrics:
receivers: [hostmetrics]
processors: [memory_limiter, k8sattributes, batch, resourcedetection/cloud, attributes/observe_common, attributes/debug_source_hostmetrics]
processors: [memory_limiter, batch, resourcedetection/cloud, k8sattributes, resource/observe_common, attributes/debug_source_hostmetrics]
exporters: [prometheusremotewrite, debug/override]
{{- end -}}
{{- if .Values.node.containers.metrics.enabled }}
metrics/kubeletstats:
receivers: [kubeletstats]
processors: [memory_limiter, k8sattributes, batch, resourcedetection/cloud, attributes/observe_common, attributes/debug_source_kubletstats_metrics]
processors: [memory_limiter, batch, resourcedetection/cloud, k8sattributes, resource/observe_common, attributes/debug_source_kubletstats_metrics]
exporters: [prometheusremotewrite, debug/override]
{{- end -}}
{{- include "config.service.telemetry" . | nindent 2 }}
Expand Down

0 comments on commit f5b70d4

Please sign in to comment.