Skip to content

Commit

Permalink
feat: add logic to propagate debug exporter based on top level setting (
Browse files Browse the repository at this point in the history
  • Loading branch information
obs-gh-alexlew authored Jan 14, 2025
1 parent b0c1f12 commit c63edd9
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 10 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.33.0
version: 0.34.0
appVersion: "1.1.0"
dependencies:
- name: opentelemetry-collector
Expand Down
3 changes: 2 additions & 1 deletion charts/agent/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# agent

![Version: 0.33.0](https://img.shields.io/badge/Version-0.33.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.34.0](https://img.shields.io/badge/Version-0.34.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)

> [!CAUTION]
> This chart is under active development and is not meant to be installed yet.
Expand Down Expand Up @@ -28,6 +28,7 @@ Chart to install K8s collection stack based on Observe Agent
|-----|------|---------|-------------|
| agent.config.clusterEvents | string | `nil` | |
| agent.config.clusterMetrics | string | `nil` | |
| agent.config.global.debug.enabled | bool | `false` | |
| agent.config.global.debug.verbosity | string | `"basic"` | |
| agent.config.global.exporters.retryOnFailure.enabled | bool | `true` | |
| agent.config.global.exporters.retryOnFailure.initialInterval | string | `"1s"` | |
Expand Down
12 changes: 10 additions & 2 deletions charts/agent/templates/_cluster-events-config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -430,17 +430,25 @@ processors:
# this is a fake object, there is no k8s yaml object for it
- set(body, "")

{{- $objectsExporters := (list "otlphttp/observe/entity") -}}
{{- $logsClusterExporters := (list "otlphttp/observe/entity") -}}

{{- if eq .Values.agent.config.global.debug.enabled true }}
{{- $objectsExporters = concat $objectsExporters ( list "debug/override" ) | uniq }}
{{- $logsClusterExporters = concat $logsClusterExporters ( list "debug/override" ) | uniq }}
{{- end }}

service:
extensions: [health_check]
pipelines:
logs/objects:
receivers: [k8sobjects/objects]
processors: [memory_limiter, batch, resource/observe_common, transform/unify, observek8sattributes, transform/object]
exporters: [otlphttp/observe/entity, debug/override]
exporters: [{{ join ", " $objectsExporters }}]
logs/cluster:
receivers: [k8sobjects/cluster]
processors: [memory_limiter, batch, resource/observe_common, filter/cluster, transform/cluster]
exporters: [otlphttp/observe/entity, debug/override]
exporters: [{{ join ", " $logsClusterExporters }}]

{{- include "config.service.telemetry" . | nindent 2 }}

Expand Down
12 changes: 10 additions & 2 deletions charts/agent/templates/_cluster-metrics-config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,26 @@ processors:
action: insert
value: pod_metrics

{{- $metricsExporters := (list "prometheusremotewrite") -}}
{{- $podMetricsExporters := (list "prometheusremotewrite") -}}

{{- if eq .Values.agent.config.global.debug.enabled true }}
{{- $metricsExporters = concat $metricsExporters ( list "debug/override" ) | uniq }}
{{- $podMetricsExporters = concat $podMetricsExporters ( list "debug/override" ) | uniq }}
{{- end }}

service:
extensions: [health_check]
pipelines:
metrics:
receivers: [k8s_cluster]
processors: [memory_limiter, k8sattributes, batch, resource/observe_common, attributes/debug_source_cluster_metrics]
exporters: [prometheusremotewrite, debug/override]
exporters: [{{ join ", " $metricsExporters }}]
{{- if .Values.application.prometheusScrape.enabled }}
metrics/pod_metrics:
receivers: [prometheus/pod_metrics]
processors: [memory_limiter, k8sattributes, batch, resource/observe_common, attributes/debug_source_pod_metrics]
exporters: [prometheusremotewrite, debug/override]
exporters: [{{ join ", " $podMetricsExporters }}]
{{ end -}}
{{- include "config.service.telemetry" . | nindent 2 }}

Expand Down
8 changes: 7 additions & 1 deletion charts/agent/templates/_monitor-config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,19 @@ processors:
action: insert
value: agent_monitor

{{- $metricsExporters := (list "prometheusremotewrite") -}}

{{- if eq .Values.agent.config.global.debug.enabled true }}
{{- $metricsExporters = concat $metricsExporters ( list "debug/override" ) | uniq }}
{{- end }}

service:
extensions: [health_check]
pipelines:
metrics:
receivers: [prometheus/collector]
processors: [memory_limiter, k8sattributes, batch, resource/observe_common, attributes/debug_source_agent_monitor]
exporters: [prometheusremotewrite]
exporters: [{{ join ", " $metricsExporters }}]
{{- include "config.service.telemetry" . | nindent 2 }}

{{- end }}
17 changes: 14 additions & 3 deletions charts/agent/templates/_node-logs-metrics-config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -163,26 +163,37 @@ processors:
action: insert
value: kubeletstats_metrics

# Create intermediate lists for pipeline arrays to then modify based on values.yaml
{{- $logsExporters := (list "otlphttp/observe/base") -}}
{{- $hostmetricsExporters := (list "prometheusremotewrite") -}}
{{- $kubeletstatsExporters := (list "prometheusremotewrite") -}}

{{- if eq .Values.agent.config.global.debug.enabled true }}
{{- $logsExporters = concat $logsExporters ( list "debug/override" ) | uniq }}
{{- $hostmetricsExporters = concat $hostmetricsExporters ( list "debug/override" ) | uniq }}
{{- $kubeletstatsExporters = concat $kubeletstatsExporters ( list "debug/override" ) | uniq }}
{{- end }}

service:
extensions: [health_check, file_storage]
pipelines:
{{- if .Values.node.containers.logs.enabled }}
logs:
receivers: [filelog]
processors: [memory_limiter, k8sattributes, batch, resourcedetection/cloud, resource/observe_common, attributes/debug_source_pod_logs]
exporters: [otlphttp/observe/base, debug/override]
exporters: [{{ join ", " $logsExporters }}]
{{- end -}}
{{- if .Values.node.metrics.enabled }}
metrics/hostmetrics:
receivers: [hostmetrics]
processors: [memory_limiter, k8sattributes, batch, resourcedetection/cloud, resource/observe_common, attributes/debug_source_hostmetrics]
exporters: [prometheusremotewrite, debug/override]
exporters: [{{ join ", " $hostmetricsExporters }}]
{{- end -}}
{{- if .Values.node.containers.metrics.enabled }}
metrics/kubeletstats:
receivers: [kubeletstats]
processors: [memory_limiter, k8sattributes, batch, resourcedetection/cloud, resource/observe_common, attributes/debug_source_kubletstats_metrics]
exporters: [prometheusremotewrite, debug/override]
exporters: [{{ join ", " $kubeletstatsExporters }}]
{{- end -}}
{{- include "config.service.telemetry" . | nindent 2 }}

Expand Down
1 change: 1 addition & 0 deletions charts/agent/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ agent:
loggingLevel: WARN
loggingEncoding: console
debug:
enabled: false
# values basic, normal, detailed
verbosity: basic
# additional otel collector config for cluster-events deployment
Expand Down

0 comments on commit c63edd9

Please # to comment.