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

Support inode resolution mechanism for Origin Detection #813

Merged
merged 9 commits into from
Jan 19, 2024

Conversation

wdhif
Copy link
Member

@wdhif wdhif commented Jan 16, 2024

Requirements for Contributing to this repository

  • Fill out the template below. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • The pull request must only fix one issue, or add one feature, at the time.
  • The pull request must update the test suite to demonstrate the changed functionality.
  • After you create the pull request, all status checks must be pass before a maintainer reviews your contribution. For more details, please see CONTRIBUTING.

What does this PR do?

Implements the support of Origin Detection when the container ID is unavailable from inside the container by using the inode resolution mechanic. The original Go implementation is here: DataDog/datadog-go#291

Description of the Change

If we are not able to find the container ID from inside the container, we will send instead the cgroup inode to be able to resolve the container ID on the Agent side.

Alternate Designs

Possible Drawbacks

Verification Process

Use the following deployment on a k8s cluster running cgroupv2:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: dummy-dsd-python-app
spec:
  replicas: 1
  selector:
    matchLabels:
      app: dummy-dsd-python-app
  template:
    metadata:
      labels:
        app: dummy-dsd-python-app
        admission.datadoghq.com/enabled: "false"
    spec:
      containers:
      - name: dummy-dsd-python-app
        image: wdhifdatadog/dummy-dsd-python-app
        imagePullPolicy: Always
        env:
        - name: DD_AGENT_HOST
          valueFrom:
            fieldRef:
              fieldPath: status.hostIP

You should then be able to find a dummy.dsd.python.metric with a container_id tag.

Additional Notes

Release Notes

Review checklist (to be filled by reviewers)

  • Feature or bug fix MUST have appropriate tests (unit, integration, etc...)
  • PR title must be written as a CHANGELOG entry (see why)
  • Files changes must correspond to the primary purpose of the PR as described in the title (small unrelated changes should have their own PR)
  • PR must have one changelog/ label attached. If applicable it should have the backward-incompatible label attached.
  • PR should not have do-not-merge/ label attached.
  • If Applicable, issue must have kind/ and severity/ labels attached at least.

@wdhif wdhif added the changelog/Added Added features results into a minor version bump label Jan 16, 2024
@wdhif wdhif force-pushed the CONTINT-1099/wassim.dhif/dogstatsd-inode branch 6 times, most recently from 878714e to 82f01d2 Compare January 16, 2024 17:01
@wdhif wdhif marked this pull request as ready for review January 16, 2024 17:21
@wdhif wdhif requested review from a team as code owners January 16, 2024 17:21
datadog/dogstatsd/container.py Outdated Show resolved Hide resolved
datadog/dogstatsd/container.py Outdated Show resolved Hide resolved
datadog/dogstatsd/container.py Show resolved Hide resolved
datadog/dogstatsd/container.py Show resolved Hide resolved
datadog/dogstatsd/container.py Outdated Show resolved Hide resolved
@wdhif wdhif requested a review from vickenty January 16, 2024 18:16
AliDatadog
AliDatadog previously approved these changes Jan 17, 2024
datadog/dogstatsd/container.py Outdated Show resolved Hide resolved
datadog/dogstatsd/container.py Outdated Show resolved Hide resolved
tests/unit/dogstatsd/test_container.py Show resolved Hide resolved
@wdhif wdhif force-pushed the CONTINT-1099/wassim.dhif/dogstatsd-inode branch from f027da4 to aab46ee Compare January 17, 2024 16:40
@wdhif wdhif force-pushed the CONTINT-1099/wassim.dhif/dogstatsd-inode branch from aab46ee to 63eace9 Compare January 17, 2024 16:45
@wdhif wdhif requested a review from vickenty January 17, 2024 16:46
@wdhif wdhif force-pushed the CONTINT-1099/wassim.dhif/dogstatsd-inode branch from 63eace9 to 97b714b Compare January 18, 2024 14:25
@wdhif wdhif force-pushed the CONTINT-1099/wassim.dhif/dogstatsd-inode branch from 97b714b to 46adcf5 Compare January 18, 2024 16:13
@wdhif wdhif requested a review from vickenty January 18, 2024 16:26
@wdhif wdhif merged commit 17a5f1c into master Jan 19, 2024
11 checks passed
@wdhif wdhif deleted the CONTINT-1099/wassim.dhif/dogstatsd-inode branch January 19, 2024 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog/Added Added features results into a minor version bump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants