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] Gate compilation using cargo features #541

Merged
merged 29 commits into from
Jul 23, 2024

Conversation

danielsn
Copy link
Contributor

@danielsn danielsn commented Jul 19, 2024

What does this PR do?

Adds two new cargo features: collector and receiver. Refactors the code to make it easy to use those cfg to define what gets built at compile time.

Motivation

The current implementation of the library always builds in all code. This is not great, because it bloats binary size etc. We have users who

  1. (.Net) independently collect core-dumps, and then format them into CrashInfo objects, which they upload. They have no need or use for the receiver or collector portions of this code
  2. (Ruby, Python) Use the collector to gather info on crashes, and the receiver to format a CrashInfo object and send it on. They need all parts of the code.
  3. (PHP). Propose to collect the info on crashes in the main binary, then use a sidecar to format a CrashInfo object and send it on. The first binary needs the collector but not the receiver; the sidecar needs the opposite.

Additional Notes

  • Currently, we don't have support when building the ffi library for feature selection. This is a first step towards making that worthwhile.

  • I did some refactoring as I moved code around, but there is still more refactoring that could be done.

How to test the change?

This is a refactor, existing tests cover the functionality

PROF-10245

@danielsn danielsn requested review from a team as code owners July 19, 2024 19:25
@danielsn danielsn force-pushed the dsn/crashtracker-cfg-features branch from 74f236f to 08aa381 Compare July 19, 2024 19:33
@codecov-commenter
Copy link

codecov-commenter commented Jul 19, 2024

Codecov Report

Attention: Patch coverage is 4.59184% with 187 lines in your changes missing coverage. Please review.

Project coverage is 70.45%. Comparing base (89d4831) to head (6da7160).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #541      +/-   ##
==========================================
- Coverage   70.45%   70.45%   -0.01%     
==========================================
  Files         208      213       +5     
  Lines       28414    28408       -6     
==========================================
- Hits        20020    20014       -6     
  Misses       8394     8394              
Components Coverage Δ
crashtracker 25.21% <5.68%> (-0.33%) ⬇️
datadog-alloc 98.73% <ø> (ø)
data-pipeline 50.00% <ø> (ø)
data-pipeline-ffi 0.00% <ø> (ø)
ddcommon 86.43% <ø> (ø)
ddcommon-ffi 75.29% <ø> (ø)
ddtelemetry 58.95% <ø> (ø)
ipc 84.13% <ø> (ø)
profiling 78.09% <3.70%> (ø)
profiling-ffi 56.76% <3.70%> (ø)
serverless 0.00% <ø> (ø)
sidecar 35.42% <ø> (ø)
sidecar-ffi 0.00% <ø> (ø)
spawn-worker 54.98% <ø> (ø)
trace-mini-agent 71.14% <ø> (ø)
trace-normalization 98.24% <ø> (ø)
trace-obfuscation 95.73% <ø> (ø)
trace-protobuf 77.16% <ø> (ø)
trace-utils 91.03% <ø> (ø)

@pr-commenter
Copy link

pr-commenter bot commented Jul 19, 2024

Benchmarks

This comment was omitted because it was over 65536 characters.Please check the Gitlab Job logs to see its output.

@github-actions github-actions bot added the profiling Relates to the profiling* modules. label Jul 19, 2024
taegyunkim
taegyunkim previously approved these changes Jul 19, 2024
@taegyunkim taegyunkim dismissed their stale review July 19, 2024 21:33

Looks like this also needs changes to ffi

Copy link
Contributor

@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--pretty reasonable-looking refactor with minimal changes to how the code operates.

@@ -1,12 +1,13 @@
// Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/
Copy link
Contributor

Choose a reason for hiding this comment

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

Silly question: do these copyright notices indicate the year of first existence for the noted file, or the last update?

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 assume first year of existence. At Amazon we stopped using years, and went to a SPDX header which was much cleaner

crashtracker/src/collector/emitters.rs Outdated Show resolved Hide resolved
crashtracker/src/collector/emitters.rs Show resolved Hide resolved
@danielsn danielsn requested a review from a team as a code owner July 23, 2024 18:21
@danielsn danielsn merged commit a2cd10a into main Jul 23, 2024
32 checks passed
@danielsn danielsn deleted the dsn/crashtracker-cfg-features branch July 23, 2024 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-build profiling Relates to the profiling* modules.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants