Skip to content

Commit

Permalink
[otel-integration] remove kube-state-metrics (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
povilasv authored Nov 9, 2023
1 parent a990636 commit b71fd5e
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 55 deletions.
3 changes: 3 additions & 0 deletions otel-integration/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## OpenTelemtry-Integration

### v0.0.33 / 2023-11-08
* [FIX] Remove Kube-State-Metrics, as K8s Cluster Receiver provides all the needed metrics.

### v0.0.32 / 2023-11-03
* [FIX] Ensure correct order of processors for k8s deployment attributes.

Expand Down
6 changes: 1 addition & 5 deletions otel-integration/k8s-helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: otel-integration
description: OpenTelemetry Integration
version: 0.0.32
version: 0.0.33
keywords:
- OpenTelemetry Collector
- OpenTelemetry Agent
Expand All @@ -24,10 +24,6 @@ dependencies:
version: "0.76.3"
repository: https://cgx.jfrog.io/artifactory/coralogix-charts-virtual
condition: opentelemetry-cluster-collector.enabled
- name: kube-state-metrics
version: "5.8.1"
repository: https://prometheus-community.github.io/helm-charts
condition: global.extensions.kubernetesDashboard.enabled
sources:
- https://github.com/coralogix/opentelemetry-helm-charts/tree/main/charts/opentelemetry-collector
maintainers:
Expand Down
15 changes: 0 additions & 15 deletions otel-integration/k8s-helm/templates/ksm-cr.yaml

This file was deleted.

14 changes: 0 additions & 14 deletions otel-integration/k8s-helm/templates/ksm-crb.yaml

This file was deleted.

68 changes: 47 additions & 21 deletions otel-integration/k8s-helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,15 @@ opentelemetry-cluster-collector:
k8s_cluster:
collection_interval: 10s
allocatable_types_to_report: [cpu, memory]
resource_attributes:
k8s.kubelet.version:
enabled: true
k8s.pod.qos_class:
enabled: true
metrics:
k8s.pod.status_reason:
enabled: true

prometheus:
config:
scrape_configs:
Expand Down Expand Up @@ -367,22 +376,51 @@ opentelemetry-cluster-collector:
- keep_keys(body["object"], ["type", "eventTime", "reason", "regarding", "note", "metadata", "deprecatedFirstTimestamp", "deprecatedLastTimestamp"])
- keep_keys(body["object"]["metadata"], ["creationTimestamp"])
- keep_keys(body["object"]["regarding"], ["kind", "name", "namespace"])
metricstransform/kube-extra-metrics:
metricstransform/k8s-dashboard:
transforms:
# Replace node name for kube node info with the name of the target node.
- include: kube_node_info
- include: k8s.pod.phase
match_type: strict
action: insert
new_name: kube_pod_status_qos_class
- include: k8s.pod.status_reason
match_type: strict
action: insert
new_name: kube_pod_status_reason
- include: k8s.node.allocatable_cpu
match_type: strict
action: update
operations:
- action: update_label
label: node
new_label: k8s.node.name
action: insert
new_name: kube_node_info
transform/k8s-dashboard:
error_mode: ignore
metric_statements:
- context: metric
statements:
# k8s.pod.phase has changed metric units to follow OTEL semantic conventions
# K8s Dashboard uses k8s_pod_phase_1 in their queries.
- set(unit, "1") where name == "k8s.pod.phase"
- set(unit, "") where name == "kube_node_info"
- context: datapoint
statements:
# Transforming k8s.pod.phase to kube_pod_status_qos_class format.
- set(value_int, 1) where metric.name == "kube_pod_status_qos_class"
- set(attributes["qos_class"], resource.attributes["k8s.pod.qos_class"]) where metric.name == "kube_pod_status_qos_class"
- set(attributes["pod"], resource.attributes["k8s.pod.name"]) where metric.name == "kube_pod_status_reason"
# Transforming k8s.pod.status_reason to kube-state-metrics format
- set(attributes["reason"], "Evicted") where metric.name == "kube_pod_status_reason" and value_int == 1
- set(attributes["reason"], "NodeAffinity") where metric.name == "kube_pod_status_reason" and value_int == 2
- set(attributes["reason"], "NodeLost") where metric.name == "kube_pod_status_reason" and value_int == 3
- set(attributes["reason"], "Shutdown") where metric.name == "kube_pod_status_reason" and value_int == 4
- set(attributes["reason"], "UnexpectedAdmissionError") where metric.name == "kube_pod_status_reason" and value_int == 5
- set(value_int, 0) where metric.name == "kube_pod_status_reason" and value_int == 6
- set(value_int, 1) where metric.name == "kube_pod_status_reason" and value_int != 0
# Transforming k8s.node.status_reason to kube-state-metrics format
- set(value_int, 1) where metric.name == "kube_node_info"
- set(attributes["kubelet_version"], resource.attributes["k8s.kubelet.version"]) where metric.name == "kube_node_info"
- context: resource
statements:
- delete_key(attributes, "k8s.pod.qos_class")
- delete_key(attributes, "k8s.kubelet.version")

resourcedetection/env:
detectors: ["system", "env"]
timeout: 2s
Expand Down Expand Up @@ -437,7 +475,7 @@ opentelemetry-cluster-collector:
- coralogix
processors:
- k8sattributes
- metricstransform/kube-extra-metrics
- metricstransform/k8s-dashboard
- transform/k8s-dashboard
- resourcedetection/env
- resourcedetection/region
Expand Down Expand Up @@ -485,15 +523,3 @@ opentelemetry-cluster-collector:

opentelemetry-agent-windows:
enabled: false

kube-state-metrics:
fullnameOverride: coralogix-opentelemetry-kube-state-metrics
prometheusScrape: false
collectors:
- pods
- nodes
metricAllowlist:
- kube_node_info
- kube_pod_status_reason
- kube_pod_status_phase
- kube_pod_status_qos_class

0 comments on commit b71fd5e

Please sign in to comment.