Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[processor/k8sattributesprocessor] add debug logs #11060

Merged
merged 1 commit into from
Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 🧰

Expand Down
3 changes: 3 additions & 0 deletions processor/k8sattributesprocessor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand All @@ -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)
}
Expand Down