Skip to content

Commit

Permalink
Merge branch 'main' into duncan-harvey/serverless-mini-agent-bump-ver…
Browse files Browse the repository at this point in the history
…sion
  • Loading branch information
duncanpharvey authored Sep 13, 2024
2 parents 843e5ac + dea9035 commit 91a4c85
Show file tree
Hide file tree
Showing 14 changed files with 202 additions and 40 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,12 @@ jobs:
if: matrix.platform != 'windows-latest'
run: |
set -e
rm -rf examples/ffi/build
mkdir examples/ffi/build
cd examples/ffi/build
# Add BUILD_SYMBOLIZER variable only for Linux platforms
if [[ "${{ matrix.platform }}" == "ubuntu-latest" ]]; then
cmake -S .. -DDatadog_ROOT=$LIBDD_OUTPUT_FOLDER -DBUILD_SYMBOLIZER=true
cmake --build .
cmake --build .
./symbolizer
else
cmake -S .. -DDatadog_ROOT=$LIBDD_OUTPUT_FOLDER
Expand Down
53 changes: 28 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ resolver = "2"
[workspace.package]
rust-version = "1.76.0"
edition = "2021"
version = "12.0.0"
version = "13.0.0"
license = "Apache-2.0"

[profile.dev]
Expand Down
8 changes: 6 additions & 2 deletions build-profiling-ffi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ cp -v LICENSE LICENSE-3rdparty.yml NOTICE "$destdir/"


datadog_profiling_ffi="datadog-profiling-ffi"
FEATURES="--features crashtracker-collector,crashtracker-receiver,cbindgen,datadog-profiling-ffi/ddtelemetry-ffi"
FEATURES="--features crashtracker-collector,crashtracker-receiver,cbindgen,datadog-profiling-ffi/ddtelemetry-ffi,datadog-profiling-ffi/demangler"
if [[ "$symbolizer" -eq 1 ]]; then
FEATURES="--features crashtracker-collector,crashtracker-receiver,cbindgen,datadog-profiling-ffi/ddtelemetry-ffi,cbindgen,datadog-profiling-ffi/ddtelemetry-ffi,symbolizer"
FEATURES="--features crashtracker-collector,crashtracker-receiver,cbindgen,datadog-profiling-ffi/ddtelemetry-ffi,cbindgen,datadog-profiling-ffi/ddtelemetry-ffi,datadog-profiling-ffi/demangler,symbolizer"
fi

if [[ ! -z ${ARG_FEATURES} ]]; then
Expand Down Expand Up @@ -169,6 +169,10 @@ if [[ "$fix_macos_rpath" -eq 1 ]]; then
install_name_tool -id @rpath/${shared_library_name} "$destdir/lib/${shared_library_name}"
fi

if command -v patchelf > /dev/null && [[ "$target" != "x86_64-pc-windows-msvc" ]]; then
patchelf --set-soname ${shared_library_name} "$destdir/lib/${shared_library_rename}"
fi

# objcopy might not be available on macOS
if command -v objcopy > /dev/null && [[ "$target" != "x86_64-pc-windows-msvc" ]]; then
# Remove .llvmbc section which is not useful for clients
Expand Down
2 changes: 2 additions & 0 deletions builder/build/arch/apple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ pub fn strip_libraries(lib_path: &str) {

strip.wait().expect("Failed to strip library");
}

pub fn fix_soname(_lib_path: &str) {}
9 changes: 9 additions & 0 deletions builder/build/arch/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,12 @@ pub fn strip_libraries(lib_path: &str) {

debug.wait().expect("Failed to set debuglink");
}

pub fn fix_soname(lib_path: &str) {
Command::new("patchelf")
.arg("--set-soname")
.arg(PROF_DYNAMIC_LIB)
.arg(lib_path.to_owned() + "/" + PROF_DYNAMIC_LIB)
.spawn()
.expect("failed to change the soname");
}
9 changes: 9 additions & 0 deletions builder/build/arch/musl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,12 @@ pub fn strip_libraries(lib_path: &str) {

debug.wait().expect("Failed to set debuglink");
}

pub fn fix_soname(lib_path: &str) {
Command::new("patchelf")
.arg("--set-soname")
.arg(PROF_DYNAMIC_LIB)
.arg(lib_path)
.spawn()
.expect("failed to change the soname");
}
1 change: 1 addition & 0 deletions builder/build/arch/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ pub const BUILD_CRASHTRACKER: bool = false;

pub fn fix_rpath(_lib_path: &str) {}
pub fn strip_libraries(_lib_path: &str) {}
pub fn fix_soname(_lib_path: &str) {}
2 changes: 2 additions & 0 deletions builder/build/profiling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ impl Profiling {
.collect();
fs::copy(from_static, to_static).expect("unable to copy static lib");

arch::fix_soname(&self.target_lib);

// Generate debug information
arch::strip_libraries(&self.target_lib);
Ok(())
Expand Down
3 changes: 3 additions & 0 deletions serverless/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ env_logger = "0.10.0"
datadog-trace-mini-agent = { path = "../trace-mini-agent" }
datadog-trace-protobuf = { path = "../trace-protobuf" }
datadog-trace-utils = { path = "../trace-utils" }
dogstatsd = { path = "../dogstatsd" }
tokio = { version = "1", features = ["macros", "rt-multi-thread"]}
tokio-util = { version = "0.7", default-features = false }

[[bin]]
name = "datadog-serverless-trace-mini-agent"
Expand Down
Loading

0 comments on commit 91a4c85

Please sign in to comment.