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

[crashtracker] Take relative address and build id for remote symbolication #473

Merged
merged 17 commits into from
Jun 14, 2024

Conversation

danielsn
Copy link
Contributor

@danielsn danielsn commented Jun 6, 2024

What does this PR do?

Adds two new fields optional to each stack trace frame: relative_address and build_id

Motivation

This is the information required by a backend symbolizer

Additional Notes

Getting relative addresses from absolute addresses is the responsibility of the client. In the future, we may add functionality to libdatadog to support this.

How to test the change?

Describe here in detail how the change can be validated.

@danielsn danielsn requested a review from a team as a code owner June 6, 2024 16:51
@github-actions github-actions bot added the profiling Relates to the profiling* modules. label Jun 6, 2024
@danielsn danielsn force-pushed the dsn/crashtracker-relative-addresses branch from 1bd5341 to 8367483 Compare June 6, 2024 16:52
@@ -325,12 +327,15 @@ impl<'a> TryFrom<&StackFrame<'a>> for datadog_crashtracker::StackFrame {
}
Some(vec)
};
let relative_address = to_hex(value.relative_address);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this valid to assume a relative offset of 0 is None? Or do we need to be more clever here?

Copy link
Contributor

Choose a reason for hiding this comment

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

the term relative is ambiguous, as it can have different meanings.
we use elf, blazesym uses normalized. I can imagine you are aiming for cross compatibility ?
0 for an elf address is not possible (there are headers)

@codecov-commenter
Copy link

codecov-commenter commented Jun 6, 2024

Codecov Report

Attention: Patch coverage is 0% with 75 lines in your changes missing coverage. Please review.

Project coverage is 69.37%. Comparing base (cd598b9) to head (cb048fd).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #473      +/-   ##
==========================================
- Coverage   69.55%   69.37%   -0.19%     
==========================================
  Files         200      200              
  Lines       26656    26726      +70     
==========================================
  Hits        18541    18541              
- Misses       8115     8185      +70     
Components Coverage Δ
crashtracker 16.70% <0.00%> (-0.50%) ⬇️
datadog-alloc 98.76% <ø> (ø)
data-pipeline 51.30% <ø> (ø)
data-pipeline-ffi 0.00% <ø> (ø)
ddcommon 85.97% <ø> (ø)
ddcommon-ffi 74.15% <ø> (ø)
ddtelemetry 56.37% <ø> (ø)
ipc 84.66% <ø> (ø)
profiling 78.67% <0.00%> (-0.48%) ⬇️
profiling-ffi 58.19% <0.00%> (-1.35%) ⬇️
serverless 0.00% <ø> (ø)
sidecar 36.26% <ø> (ø)
sidecar-ffi 0.00% <ø> (ø)
spawn-worker 54.98% <ø> (ø)
trace-mini-agent 69.36% <ø> (ø)
trace-normalization 97.79% <ø> (ø)
trace-obfuscation 95.73% <ø> (ø)
trace-protobuf 24.52% <ø> (ø)
trace-utils 90.79% <ø> (ø)

peterg17
peterg17 previously approved these changes Jun 10, 2024
Copy link

@peterg17 peterg17 left a comment

Choose a reason for hiding this comment

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

We should need "just" these 2 pieces of information, but I suspect most of the complexity is in deriving the elf address, which could be helpful to exist in libdatadog. Nicolas and Erwan would be the experts here and their code in ddprof probably would be useful to reference

@danielsn danielsn requested a review from peterg17 June 14, 2024 14:58
@danielsn danielsn dismissed peterg17’s stale review June 14, 2024 15:53

Major changes since review

Copy link

@peterg17 peterg17 left a comment

Choose a reason for hiding this comment

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

Looks good!

if let Some(ip) = &self.ip {
let ip = ip.trim_start_matches("0x");
let ip = u64::from_str_radix(ip, 16)?;
let normed = normalizer.normalize_user_addrs(pid, &[ip])?;

Choose a reason for hiding this comment

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

UserMeta::Apk(a) => Self::Apk(a.path.clone()),
UserMeta::Elf(e) => Self::Elf {
path: e.path.clone(),
build_id: e.build_id.clone(),

Choose a reason for hiding this comment

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

Does this handle go build id, which can be in a different part of the metadata than the GNU build id? Or is this irrelevant because we don't currently use libdatadog in dd-trace-go?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd guess the second, but Felix/Nick may have thoughts. If they want it, I'll add it in a followup PR

@danielsn danielsn merged commit 7f9ec03 into main Jun 14, 2024
29 checks passed
@danielsn danielsn deleted the dsn/crashtracker-relative-addresses branch June 14, 2024 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
profiling Relates to the profiling* modules.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants