Skip to content

[processor/k8sattributesprocessor] Add pod_delete_grace_period configuration option#48127

Open
giuliano-sider wants to merge 2 commits intoopen-telemetry:mainfrom
giuliano-sider:add-pod-delete-grace-period
Open

[processor/k8sattributesprocessor] Add pod_delete_grace_period configuration option#48127
giuliano-sider wants to merge 2 commits intoopen-telemetry:mainfrom
giuliano-sider:add-pod-delete-grace-period

Conversation

@giuliano-sider
Copy link
Copy Markdown

Description

This PR adds the pod_delete_grace_period configuration option to the k8sattributes processor, making the cache eviction grace window for deleted pods configurable.

By default, after receiving a pod deletion event, the processor keeps the pod's metadata in its lookup cache for a short duration (120s) before eviction. This ensures that delayed spans, metrics, or logs originating from the pod can still be correctly enriched. With this change, users can tune this duration to match their environment's constraints (e.g. reducing memory overhead by lowering the duration, or setting it to 0s to evict immediately).

Important

Stacked PR: This PR is stacked on top of [processor/k8sattributesprocessor] Add watch_sync_period config option. Only the changes in the second commit (Add pod_delete_grace_period config option...) are new to this PR.


Link to tracking Issue

The issue of configurability (and its longstanding TODO) are brought up in #48110.


Testing & Verification

Automated Tests

  • Added unit test coverage in config_test.go ensuring custom pod_delete_grace_period values (e.g., 30s) are successfully loaded, parsed, and validated.
  • Added unit test coverage verifying that negative durations (e.g., -30s) correctly fail configuration validation.
  • All tests compiled and passed successfully:
    go test -v ./...

Documentation

  • Added a description of the config in the README.
  • Added an entry to the user changelog.

@github-actions github-actions Bot added the first-time contributor PRs made by new contributors label May 5, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

Welcome, contributor! Thank you for your contribution to opentelemetry-collector-contrib.

Important reminders:

  • Read our Contributing Guidelines.
  • Sign the CLA if you haven't already.
  • First-time contributors should have at most one PR not marked as draft until their first PR is merged.
  • If your change isn't one of our priority components, reviews may take more time.
  • Give reviewers at least a few days before pinging them for feedback.
  • If you need help or struggle to move your PR forward, raise the topic on #otel-collector-dev or a Collector SIG meeting.

@giuliano-sider giuliano-sider force-pushed the add-pod-delete-grace-period branch from 0c43299 to 06ebcf8 Compare May 5, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

first-time contributor PRs made by new contributors processor/k8sattributes k8s Attributes processor waiting-for-code-owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants