From 312b9755732170d59ff9bec87ec6507ba084a654 Mon Sep 17 00:00:00 2001 From: Povilas Versockas Date: Fri, 10 Jun 2022 10:10:25 +0300 Subject: [PATCH] [processor/k8sattributesprocessor] add debug logs --- CHANGELOG.md | 1 + processor/k8sattributesprocessor/processor.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d16713432c22..ace1a0d105a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ - `mezmoexporter`: add logging for HTTP errors (#10875) - `signalfxexporter`: Enable the exporting of seven Kubernetes metrics used in Splunk/SignalFx content by default (#11032) - `googlecloudexporter`: Support writing to multiple GCP projects by setting the `gcp.project.id` resource attribute, and support service account impersonation (#11051) +- `k8sattributeprocessor`: Add debug logs to help identify missing attributes (#11060) ### 🧰 Bug fixes 🧰 diff --git a/processor/k8sattributesprocessor/processor.go b/processor/k8sattributesprocessor/processor.go index 226d3d96a262..60bd2667c5d3 100644 --- a/processor/k8sattributesprocessor/processor.go +++ b/processor/k8sattributesprocessor/processor.go @@ -108,6 +108,7 @@ func (kp *kubernetesprocessor) processLogs(ctx context.Context, ld plog.Logs) (p // processResource adds Pod metadata tags to resource based on pod association configuration func (kp *kubernetesprocessor) processResource(ctx context.Context, resource pcommon.Resource) { podIdentifierKey, podIdentifierValue := extractPodID(ctx, resource.Attributes(), kp.podAssociations) + kp.logger.Debug("evaluating pod identifier", zap.String("key", podIdentifierKey), zap.Any("value", podIdentifierValue)) if podIdentifierKey != "" { resource.Attributes().InsertString(podIdentifierKey, string(podIdentifierValue)) } @@ -118,6 +119,8 @@ func (kp *kubernetesprocessor) processResource(ctx context.Context, resource pco if podIdentifierKey != "" { if pod, ok := kp.kc.GetPod(podIdentifierValue); ok { + kp.logger.Debug("getting the pod", zap.String("key", podIdentifierKey), zap.Any("pod", pod)) + for key, val := range pod.Attributes { resource.Attributes().InsertString(key, val) }