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

Label frames with container_id #274

Merged
merged 12 commits into from
Jun 9, 2023
Merged

Label frames with container_id #274

merged 12 commits into from
Jun 9, 2023

Conversation

r1viollet
Copy link
Collaborator

@r1viollet r1viollet commented Jun 6, 2023

What does this PR do?

Add a label with container_id information
We won't lookup short lived processes.

Motivation

When viewing data from a host, we want to understand if our process is running within a container.
Refer to following issue: #220

Additional Notes

This introduces a ProcessHdr object as an attempt to move some of the responsibilities to this object.

I have a libdatadog PR open : DataDog/libdatadog#169
Though I will not wait for the libdatadog code. Most of the code would be the same.

How to test the change?

I added some unit tests that make sure we are able to read the container_id information.
An end to end test is still missing.

include/ddprof_process.hpp Outdated Show resolved Hide resolved
}
}
++(it->second._sample_counter);
if(!force && (it->second._sample_counter) < k_nb_samples_container_id_lookup) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something I'll want to talk about.

src/ddprof_process.cc Outdated Show resolved Hide resolved
@r1viollet
Copy link
Collaborator Author

This PR will add a custom slice dimension using the container-id:
Example of user experience
image

@r1viollet r1viollet force-pushed the r1viollet/tag_containers branch from 600aab7 to 603604c Compare June 6, 2023 15:03
Clarify status of container-id field
@r1viollet
Copy link
Collaborator Author

This PR will add a custom slice dimension using the container-id: Example of user experience image

I slightly changed the labels. They now read:

  • None : not running within a container
  • Unknown: We did not perform the lookup (as we only do so for long-lived pids)

@r1viollet r1viollet force-pushed the r1viollet/tag_containers branch from 280f212 to 8679d17 Compare June 7, 2023 13:06
@r1viollet r1viollet changed the title R1viollet/tag containers Label frames with container_id Jun 7, 2023
@r1viollet r1viollet force-pushed the r1viollet/tag_containers branch from 8679d17 to c857927 Compare June 7, 2023 13:16
Fix error when returning ref to temp element
docs/Build.md Show resolved Hide resolved
@r1viollet r1viollet marked this pull request as ready for review June 7, 2023 14:22
Copy link
Collaborator

@sanchda sanchda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Staggering. This is a tremendous step in the right direction and major context that we were missing. Very happy to see this in the code!

include/ddprof_process.hpp Outdated Show resolved Hide resolved
include/ddprof_process.hpp Outdated Show resolved Hide resolved
docs/Build.md Show resolved Hide resolved
include/unwind_output.hpp Outdated Show resolved Hide resolved
return {};
}
}
container_id = "none";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, interesting. So our default is "unknown", but failure to process this upgrades it to "none". I think there's value in having a semantic distinction and I think these two values are as good as any other, but in the future we may want to be more descriptive.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for highlighting that this was unclear. I added comments.
none means that it is operating outside a container.

sanchda
sanchda previously approved these changes Jun 7, 2023
Copy link
Collaborator

@sanchda sanchda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Staggering. This is a tremendous step in the right direction and major context that we were missing. Very happy to see this in the code!

@r1viollet
Copy link
Collaborator Author

CI was flaky due to a metric push failing.

Copy link
Collaborator

@sanchda sanchda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, this is great!

@r1viollet r1viollet merged commit 87a287a into main Jun 9, 2023
@r1viollet r1viollet deleted the r1viollet/tag_containers branch June 9, 2023 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants