This Pull Request implements the support of Origin Detection when the container-id is unavailable from inside the application container only with cgroupv2.
The format is a list of hierarchy-ID:controller-list:cgroup-path similar to:
0::
1:name=systemd:... // only in cgroupv1
Once the path is retrieved, we retrieve the inode of /sys/fs/cgroup + + where is the path retrieved previously.
I am not sure how to create a dummy app that uses this library.
Test
Set up a cgroupv2 environment. A kind cluster should be enough.
Deploy the agent 7.51.0+ with origin detection and dogstatsd enabled. Using helm:
Verify that dummy.metric is correctly tagged with container-id when it wasn't before.
If you are curious about the dummy app, I pushed it here https://github.com/AliDatadog/dummy-dsd-java-app.
Implementation of https://github.com/DataDog/datadog-go/pull/291 but in Java
This Pull Request implements the support of Origin Detection when the container-id is unavailable from inside the application container only with cgroupv2.
It first retrieves the cgroup node path by parsing proc/self/cgroup which is formatted differently depending on the cgroup version. See https://man7.org/linux/man-pages/man7/cgroups.7.html.
The format is a list of hierarchy-ID:controller-list:cgroup-path similar to:
0::
1:name=systemd:... // only in cgroupv1
Once the path is retrieved, we retrieve the inode of /sys/fs/cgroup + + where is the path retrieved previously.
I am not sure how to create a dummy app that uses this library.
Test
dummy.metric
is correctly tagged with container-id when it wasn't before. If you are curious about the dummy app, I pushed it here https://github.com/AliDatadog/dummy-dsd-java-app.