Skip to content

Add Karpenter & Keda metrics integration to OTEL Container Insights - #2223

Open
vaishnavi-30-beep wants to merge 15 commits into
mainfrom
feature/karpenter-integration
Open

Add Karpenter & Keda metrics integration to OTEL Container Insights#2223
vaishnavi-30-beep wants to merge 15 commits into
mainfrom
feature/karpenter-integration

Conversation

@vaishnavi-30-beep

@vaishnavi-30-beep vaishnavi-30-beep commented Jul 31, 2026

Copy link
Copy Markdown

Summary

This PR adds the Karpenter and KEDA metrics pipeline YAMLs to the agent's config translator, ensuring both scraping configurations are preserved during the transition from helm chart templates to agent-side config translation.

Companion to helm chart PR:

Description of changes:

translator/translate/otel/pipeline/opentelemetry/containerinsights/karpenter.yaml

  • Added Prometheus receiver with Kubernetes pod service discovery targeting Karpenter pods in kube-system namespace
  • Added scope processor (cloudwatch.pipeline: karpenter) for pipeline attribution
  • Added groupbyattrs and transform processors for K8s semantic convention enrichment (pod, namespace, node promotion)
  • Added dedicated resourcedetection instance (cloud-level attributes only — no host/AZ to avoid reflecting the scraper's node)
  • Added k8sattributes processors for pod and node enrichment
  • Added transform processors for workload derivation, cluster name, cloud resource ID, unit inference
  • Added pipeline definition wiring receiver through processors to forward connector

translator/translate/otel/pipeline/opentelemetry/containerinsights/keda.yaml

  • Added Prometheus receiver with Kubernetes pod service discovery targeting KEDA operator pods in keda namespace
  • Added filter processor to drop generic client-go/control-plane metrics (rest_client, apiserver, workqueue, process, go) that conflict with the apiserver pipeline
  • Added scope processor (cloudwatch.pipeline: keda, scope.name: github.com/kedacore/keda) for pipeline attribution
  • Added groupbyattrs and transform processors for K8s semantic convention enrichment (pod, namespace, node promotion)
  • Added dedicated resourcedetection instance (cloud-level attributes only)
  • Added k8sattributes processors for pod enrichment
  • Added transform processors for workload derivation, cluster name, cloud resource ID, unit inference
  • Added pipeline definition wiring receiver through processors to forward connector

translator/translate/otel/pipeline/opentelemetry/containerinsights/translator.go

  • Embedded karpenter.yaml and keda.yaml via //go:embed
  • Registered karpenter and keda pipelines under roleCluster in NewTranslators(), gated by solutionEnabled()

translator/config/schema.json

  • Added karpenter and keda objects with enabled boolean under solutions

translator/tocwconfig/tocwconfig_test.go

  • Added TestContainerInsightsKarpenterConfig golden test
  • Added TestContainerInsightsKedaConfig golden test

translator/tocwconfig/sampleConfig/opentelemetry/

  • Added KEDA golden test files (input JSON + expected YAML)
  • Added Karpenter golden test files (input JSON + expected YAML)
  • Regenerated Karpenter expected YAML to match current translator output

Testing

  • go build ./... passes
  • TestContainerInsightsKarpenterConfig passes
  • TestContainerInsightsKedaConfig passes
  • Pipeline output compared against helm chart template — all processors, receiver config, and pipeline ordering match

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@vaishnavi-30-beep
vaishnavi-30-beep requested a review from a team as a code owner July 31, 2026 12:02
Add the solutions field to the container_insights schema definition
with a global enabled toggle and the karpenter.enabled sub-field.
This validates configs that use the karpenter pipeline toggle.
… test

Add KEDA metrics scraping as a new solution alongside Karpenter in the
OTel Container Insights translator. The KEDA pipeline discovers the
keda-operator pod via K8s service discovery and scrapes its Prometheus
metrics endpoint, dropping generic Go runtime metrics that conflict
with the apiserver pipeline.

Changes:
- Add keda.yaml pipeline template with receiver, processors, and
  pipeline wiring matching the helm chart config
- Register keda solution in translator.go with solutionEnabled gate
- Add keda schema entry in schema.json
- Add golden test (input JSON + expected YAML) for KEDA pipeline
- Fix Karpenter test: update JSON to use correct key paths
  (opentelemetry.cluster_name, role instead of mode) and regenerate
  expected YAML to match current translator output
@sky333999 sky333999 changed the title Add Karpenter metrics integration to OTEL Container Insights Add Karpenter & Keda metrics integration to OTEL Container Insights Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant