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

Correlate traces to profiles with the OTel ebpf profiler #197

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

elsakeirouz
Copy link

@elsakeirouz elsakeirouz commented Mar 31, 2025

Description

Based on Elastic's work to correlate traces to profiles for Java using the ebpf profiler.

@elsakeirouz elsakeirouz self-assigned this Mar 31, 2025
@elsakeirouz elsakeirouz requested a review from a team as a code owner March 31, 2025 13:09
@elsakeirouz elsakeirouz requested review from dmehala and removed request for a team March 31, 2025 13:09
@elsakeirouz elsakeirouz marked this pull request as draft March 31, 2025 13:09
@pr-commenter
Copy link

pr-commenter bot commented Mar 31, 2025

Benchmarks

Benchmark execution time: 2025-04-11 15:57:36

Comparing candidate commit 45310ad in PR branch elsa/trace-to-profile-corr with baseline commit c85660b in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 1 metrics, 0 unstable metrics.

@elsakeirouz elsakeirouz removed the request for review from dmehala March 31, 2025 13:12
@elsakeirouz elsakeirouz force-pushed the elsa/trace-to-profile-corr branch from c0d6295 to fe712b5 Compare March 31, 2025 13:15
@elsakeirouz
Copy link
Author

elsakeirouz commented Mar 31, 2025

What do we think of using something like #ifdef linux/unix for parts that might not be relevant on Windows/MacOS? To be fair, since this code specifically is meant to work with the ebpf profiler on Linux, and will eventually only run if prompted, I do not see the point of compiling it on other OSs.

@dubloom
Copy link
Contributor

dubloom commented Mar 31, 2025

What do we think of using something like #ifdef linux/unix for parts that might not be relevant on Windows/MacOS? To be fair, since this code specifically is meant to work with the ebpf profiler on Linux, and will eventually only run if prompted, I do not see the point of compiling it on other OSs.

My 2 cents here: if the code does not add a big compile time, I think we will pay more in code readibility by adding #ifdef (as the code is split into multiple files) than we will win in compile time. It can be worth adding some comments to tell it will only work in Linux though.
(Note this is my personal opinion and I'm not really a contributor of dd-trace-cpp atm).

@elsakeirouz
Copy link
Author

What do we think of using something like #ifdef linux/unix for parts that might not be relevant on Windows/MacOS? To be fair, since this code specifically is meant to work with the ebpf profiler on Linux, and will eventually only run if prompted, I do not see the point of compiling it on other OSs.

My 2 cents here: if the code does not add a big compile time, I think we will pay more in code readibility by adding #ifdef (as the code is split into multiple files) than we will win in compile time. It can be worth adding some comments to tell it will only work in Linux though. (Note this is my personal opinion and I'm not really a contributor of dd-trace-cpp atm).

Noted, thanks for your input!

@elsakeirouz elsakeirouz force-pushed the elsa/trace-to-profile-corr branch 2 times, most recently from ef34efa to a9f4269 Compare April 7, 2025 10:55
@elsakeirouz elsakeirouz changed the title DRAFT: POC to correlate traces to profiles with the OTel ebpf profiler Correlate traces to profiles with the OTel ebpf profiler Apr 7, 2025
@elsakeirouz elsakeirouz force-pushed the elsa/trace-to-profile-corr branch 2 times, most recently from 5bbe694 to 475ab08 Compare April 8, 2025 09:45
@codecov-commenter
Copy link

codecov-commenter commented Apr 8, 2025

Codecov Report

Attention: Patch coverage is 98.11321% with 1 line in your changes missing coverage. Please review.

Project coverage is 90.29%. Comparing base (c85660b) to head (45310ad).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/datadog/tracer.cpp 95.83% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #197      +/-   ##
==========================================
+ Coverage   90.21%   90.29%   +0.08%     
==========================================
  Files          79       79              
  Lines        4672     4721      +49     
==========================================
+ Hits         4215     4263      +48     
- Misses        457      458       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@elsakeirouz elsakeirouz force-pushed the elsa/trace-to-profile-corr branch from 475ab08 to 1282c6d Compare April 8, 2025 10:09
@elsakeirouz
Copy link
Author

FYI, the global variables' naming is not set in stone. We plan on moving towards something more generic that does not use the elastic name.

Additionally, I am in the process of a writing a problem statement regarding the way we share process data since dd-trace-cpp already shares that data through memfds.

@elsakeirouz elsakeirouz force-pushed the elsa/trace-to-profile-corr branch 6 times, most recently from 8984269 to fb5241b Compare April 11, 2025 09:20
@elsakeirouz elsakeirouz force-pushed the elsa/trace-to-profile-corr branch 4 times, most recently from 6dc9ac6 to a817fa6 Compare April 11, 2025 14:16
@elsakeirouz
Copy link
Author

What's left to do here is figure how we want to handle runtime-ids in case of forks.

dmehala and others added 2 commits April 11, 2025 14:26
* include/datadog/tracer.h
* include/datadog/tracer_signature.h
* src/datadog/tracer.cpp
@elsakeirouz elsakeirouz force-pushed the elsa/trace-to-profile-corr branch from a817fa6 to 7014f7a Compare April 11, 2025 14:27
* BUILD.bazel
* include/datadog/tls_storage.h
* include/datadog/trace_segment.h
* include/datadog/tracer.h
* src/datadog/trace_segment.cpp
* src/datadog/tracer.cpp
* include/datadog/environment.h
* include/datadog/tracer.h
* include/datadog/tracer_config.h
* src/datadog/tracer.cpp
* src/datadog/tracer_config.cpp
* test/test_tracer.cpp
* test/test_tracer_config.cpp
@elsakeirouz elsakeirouz force-pushed the elsa/trace-to-profile-corr branch from 7014f7a to 45310ad Compare April 11, 2025 15:55
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.

4 participants