Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
4c9f6cd
Add a function to retrieve register values
r1viollet Oct 17, 2022
d5bc474
feat: add Python support (wip)
P403n1x87 Oct 17, 2022
173450d
Add build-id information to the pprof mappings (#173)
r1viollet Oct 21, 2022
1264f09
Formalize tracepoint parser (#70)
sanchda Oct 28, 2022
a935559
Sanchda/donothing merge (#200)
sanchda Oct 31, 2022
fb74638
Bump version to 0.10.0 (#201)
r1viollet Nov 4, 2022
d900b2d
Parameter for relenv branch
r1viollet Nov 6, 2022
c515c21
Increase the size of the ring buffer for custom events
r1viollet Nov 9, 2022
23175b0
Simplify elf report
nsavoire Nov 10, 2022
74065b4
Allow usage of jemalloc in ddprof (#207)
r1viollet Nov 14, 2022
91224aa
Release v0.10.1 (#208)
r1viollet Nov 15, 2022
558069b
Fix codeql reported vulnerabilities
nsavoire Nov 15, 2022
dbb4f44
Improve changelog according to release 0.9.3 notes (#209)
r1viollet Nov 16, 2022
922575e
Zsh minor fix (#211)
r1viollet Nov 29, 2022
45ea7fe
Fix crash when using custom stack (#213)
r1viollet Jan 26, 2023
e0241d5
Bump version number to 0.11.0
r1viollet Feb 7, 2023
3db76d1
Upgrade dependencies (#218)
r1viollet Feb 27, 2023
3117f97
Fix tag validation
r1viollet Mar 3, 2023
3eeb178
JITDump support (#215)
r1viollet Mar 6, 2023
55a7a71
Upgrade codeql version
r1viollet Mar 7, 2023
8ce08a6
Documentation update - v0.11.0 (#225)
r1viollet Mar 13, 2023
534f30b
Add jq as a build time dependency
r1viollet Mar 13, 2023
3ec1508
Bump to version v0.11.1 to prepare for release
r1viollet Mar 15, 2023
7c5a5e3
Update help documentation
r1viollet Mar 17, 2023
5377a9a
Bump version to 0.12.0
r1viollet Mar 23, 2023
f0e9bb2
Remove extra ';'
sjanel Mar 23, 2023
8e15159
Set kInvalidSocket private
sjanel Mar 23, 2023
3671974
Add necessary includes
sjanel Mar 23, 2023
2413dc7
Enable UDS settings (#233)
r1viollet Mar 23, 2023
4417d19
Better Rust demangling (#230)
sanchda Mar 24, 2023
2123b03
Adjust APIs to libdatadog 2.1.0 (#237)
r1viollet Apr 3, 2023
fc23dfd
Fix formatting issues
sanchda Apr 3, 2023
2cf414e
Minor - add a test to backpopulate mechanism
r1viollet Mar 16, 2023
e04803f
Exporter leak fix - Drop request error
r1viollet Apr 11, 2023
4ea7384
Feature/leak detection (#224)
r1viollet Apr 18, 2023
727955b
Remove native library mode
r1viollet Apr 18, 2023
7be6e73
Fix for ci downstream
r1viollet Apr 19, 2023
219e24b
Fix management of file descriptors
r1viollet May 3, 2023
54a6cf7
Minor refactoring - Extract presets (#246)
r1viollet May 4, 2023
c95dec4
Fix incomplete qualifier
r1viollet May 3, 2023
c756879
Fix latest release link in readme
dbenamydd May 5, 2023
38ef810
Fix regression for short lived processes (#251)
r1viollet May 10, 2023
613990d
Fix segfault on arm64
nsavoire May 12, 2023
0d3d95a
Mask API key when printing parameters (#252)
r1viollet May 15, 2023
1a2a818
Bump version to 0.13.0
r1viollet May 15, 2023
d1c7161
Add python script to check for unsafe libc functions (#256)
nsavoire May 15, 2023
4361cbd
Report downstream pipeline failures to GH (#259)
nsavoire May 16, 2023
37a4864
Fix race condition in ddprof.o generation (#258)
nsavoire May 16, 2023
bce568f
Install the austin library to allow python frames to show up
r1viollet May 17, 2023
97bd025
Fix compilation for ubuntu
r1viollet May 17, 2023
ca82dcb
Update link to austin library
r1viollet May 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ compile_commands.json
*.s
*.bc
*.swp
*.dump
.env
.env_perso.yml
test/configs/perso.yml
Expand Down
27 changes: 25 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,31 @@ trigger_internal_build:
DDPROF_SHORT_COMMIT_SHA: ${CI_COMMIT_SHORT_SHA}
DDPROF_COMMIT_TAG: ${CI_COMMIT_TAG}
# Reliability environment downstream branch
DDPROF_RELENV_BRANCH: master
DDPROF_RELENV_BRANCH: ${DDPROF_RELENV_BRANCH-"master"}
trigger:
project: DataDog/ddprof-build
project: DataDog/apm-reliability/ddprof-build
strategy: depend
branch: $DOWNSTREAM_BUILD_BRANCH

# Following jobs are required otherwise gitsync will not report downstream pipeline failure to github

# This job is used to determine is downstream pipeline has succeeded
report_failure:
tags: ["arch:amd64"]
when: on_failure
needs: [trigger_internal_build]
# allow_failure: true prevents the job from showing up in github statuses (because it's filtered by gitsync)
allow_failure: true
script:
- echo "STATUS=1" >> .env
artifacts:
reports:
dotenv: .env

# Final job that will show in github statuses
report_gitlab_CI_status:
tags: ["arch:amd64"]
when: always
stage: .post
script:
- exit ${STATUS}
103 changes: 56 additions & 47 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ cmake_minimum_required(VERSION 3.19)
project(
DDProf
LANGUAGES C CXX
VERSION 0.9.3
VERSION 0.13.0
DESCRIPTION "Datadog's native profiler for Linux")

message(STATUS "Compiler ID: ${CMAKE_C_COMPILER_ID}")
Expand All @@ -23,8 +23,12 @@ endif()
# ~~~
# set(CMAKE_VERBOSE_MAKEFILE on)

# Add build ID info on alpine
add_link_options("LINKER:--build-id=sha1")

# Define the include path of cmake scripts
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/util")

include(ExtendBuildTypes)

Expand Down Expand Up @@ -80,22 +84,27 @@ endif()
# libdatadog_profiling
include(Findlibdatadog)

# Event Parser
add_subdirectory(src/event_parser)

# elfutils
include(Findelfutils)

# ---- Static analysis ----
include(ClangTidy)
include(CppcheckConfig)
include(Format)

# Generated code needs to be available for cppcheck to work
include(CppcheckConfig)
add_dependencies(cppcheck DDProf::Parser)

# ---- Libraries (needed by ut) ----

option(DDPROF_JEMALLOC "Enable jemalloc stats" OFF)
if(${DDPROF_JEMALLOC})
option(DDPROF_ALLOCATOR "Define the type of allocator (STANDARD / JEMALLOC)" STANDARD)
if("${DDPROF_ALLOCATOR}" STREQUAL "JEMALLOC")
# jemalloc for debug
include(Jemalloc)
message(STATUS "Adding jemalloc for DBG purpose" ${JEMALLOC_ROOT_DIR})
add_compile_definitions("DBG_JEMALLOC")
message(STATUS "Using Allocator Jemalloc from:" ${JEMALLOC_LIBRARIES})
endif()

# Install lib cap to retrieve capabilities
Expand Down Expand Up @@ -130,21 +139,24 @@ list(APPEND DDPROF_INCLUDE_LIST ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/
# Find the source files
aux_source_directory(src COMMON_SRC)
aux_source_directory(src/pprof PPROF_SRC)
aux_source_directory(src/demangler DEMANGLER_SRC)
aux_source_directory(src/exporter EXPORTER_SRC)
aux_source_directory(src/exe EXE_SRC)
aux_source_directory(src/jit JIT_SRC)

# Define all sources
set(DDPROF_GLOBAL_SRC ${COMMON_SRC} ${PPROF_SRC} ${EXPORTER_SRC} ${EXE_SRC})
set(DDPROF_GLOBAL_SRC ${COMMON_SRC} ${DEMANGLER_SRC} ${PPROF_SRC} ${EXPORTER_SRC} ${EXE_SRC}
${JIT_SRC})

set(DDPROF_LIBRARY_LIST llvm-demangle ${ELFUTILS_LIBRARIES} Threads::Threads)
set(DDPROF_LIBRARY_LIST DDProf::Parser llvm-demangle ${ELFUTILS_LIBRARIES} Threads::Threads)

if(ON)
# Add the rust library - Refactoring ongoing. OFF for now
list(PREPEND DDPROF_LIBRARY_LIST Datadog::Profiling)
endif()

if(${DDPROF_JEMALLOC})
list(PREPEND DDPROF_LIBRARY_LIST jemalloc)
if("${DDPROF_ALLOCATOR}" STREQUAL "JEMALLOC")
list(PREPEND DDPROF_LIBRARY_LIST ${JEMALLOC_LIBRARIES})
endif()

# libcap, can be removed from version distributed to client
Expand Down Expand Up @@ -191,6 +203,7 @@ set(DD_PROFILING_SOURCES
src/lib/dd_profiling.cc
src/lib/elfutils.cc
src/lib/lib_embedded_data.c
src/lib/pthread_fixes.cc
src/lib/savecontext.cc
src/lib/saveregisters.cc
src/lib/symbol_overrides.cc
Expand All @@ -203,10 +216,12 @@ set(DD_PROFILING_SOURCES
src/ringbuffer_utils.cc
src/signal_helper.cc
src/sys_utils.cc
src/tracepoint_config.cc
src/user_override.cc)

if(BUILD_UNIVERSAL_DDPROF)
list(APPEND DD_PROFILING_SOURCES src/lib/glibc_fixes.c)
# Compiling on different libc, we need to ensure some symbols are available everywhere
list(APPEND DD_PROFILING_SOURCES src/lib/glibc_fixes.c src/lib/libc_compatibility.c)
endif()

# libddprofiling_embeded.so is the actual profiling library
Expand All @@ -232,6 +247,8 @@ if(BUILD_UNIVERSAL_DDPROF)
endif()
endif()

target_link_libraries(dd_profiling-embedded PRIVATE DDProf::Parser)

# Fix for link error in sanitizeddebug build mode with gcc:
# ~~~
# /usr/bin/ld: ./libdd_profiling.so: undefined reference to `__dynamic_cast'
Expand All @@ -247,6 +264,17 @@ target_link_libraries(
)
target_link_libraries(dd_profiling-embedded PUBLIC dl pthread rt)


# add libaustin
add_library(austin SHARED IMPORTED)
set_target_properties(austin PROPERTIES
IMPORTED_LOCATION "/austin/src/libaustin.a"
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR}/include/libaustin"
)




set(LIBDD_PROFILING_EMBEDDED_OBJECT "${CMAKE_BINARY_DIR}/libdd_profiling-embedded.o")
add_custom_command(
OUTPUT ${LIBDD_PROFILING_EMBEDDED_OBJECT}
Expand All @@ -266,6 +294,16 @@ add_exe(
LIBRARIES ${DDPROF_LIBRARY_LIST}
DEFINITIONS ${DDPROF_DEFINITION_LIST})
target_link_libraries(ddprof PRIVATE libddprofiling_embedded_object)



# link libaustin to ddprof
target_link_libraries(ddprof PRIVATE austin)





if(USE_LOADER)
target_compile_definitions(ddprof PRIVATE "DDPROF_USE_LOADER")
target_link_libraries(ddprof PRIVATE libdd_loader_object)
Expand Down Expand Up @@ -293,6 +331,10 @@ add_custom_command(
COMMAND objcopy --rename-section .data=.rodata,alloc,load,readonly,data,contents
${DDPROF_EXE_OBJECT}
DEPENDS ddprof)
# add_custom_target is required here, because multiple targets depend on ${DDPROF_EXE_OBJECT}
# Without add_custom_target (only add_custom_command), each dependent target will run the custom
# command and they will race, leading to spurious failures.
add_custom_target(generate_ddprof_object DEPENDS ${DDPROF_EXE_OBJECT})

add_library(ddprof_exe_object OBJECT IMPORTED GLOBAL)
set_target_properties(ddprof_exe_object PROPERTIES IMPORTED_OBJECTS "${DDPROF_EXE_OBJECT}")
Expand All @@ -305,22 +347,23 @@ target_include_directories(
${CMAKE_SOURCE_DIR}/third_party)
set_target_properties(dd_profiling-static
PROPERTIES PUBLIC_HEADER "${CMAKE_SOURCE_DIR}/include/lib/dd_profiling.h")
target_link_libraries(dd_profiling-static PRIVATE DDProf::Parser)
target_link_libraries(dd_profiling-static PUBLIC dl pthread rt)

if(USE_LOADER)
# When using a loader, libdd_profiling.so is a loader that embeds both libdd_profiling-embedded.so
# and ddprof executable.
add_library(dd_profiling-shared SHARED src/lib/glibc_fixes.c src/lib/lib_embedded_data.c
src/lib/loader.c src/sha1.c)
target_link_libraries(dd_profiling-shared PRIVATE libddprofiling_embedded_object
target_link_libraries(dd_profiling-shared PRIVATE DDProf::Parser libddprofiling_embedded_object
ddprof_exe_object)
target_compile_definitions(dd_profiling-shared PRIVATE DDPROF_EMBEDDED_LIB_DATA
DDPROF_EMBEDDED_EXE_DATA)
else()
# Without loader, libdd_profiling.so is basically the same as libdd_profiling-embedded.so plus an
# embedded ddprof executable.
add_library(dd_profiling-shared SHARED ${DD_PROFILING_SOURCES} src/lib/lib_embedded_data.c)
target_link_libraries(dd_profiling-shared PRIVATE ddprof_exe_object)
target_link_libraries(dd_profiling-shared PRIVATE DDProf::Parser ddprof_exe_object)
target_compile_definitions(dd_profiling-shared PRIVATE DDPROF_EMBEDDED_EXE_DATA)

# Fix for link error in sanitizeddebug build mode with gcc:
Expand Down Expand Up @@ -366,40 +409,6 @@ install(
ARCHIVE DESTINATION ddprof/lib
PUBLIC_HEADER DESTINATION ddprof/include)

# ---- Declaration of native library ----
option(BUILD_NATIVE_LIB "Build a library out of the native profiler" ON)
if(${BUILD_NATIVE_LIB})

# Define all sources
set(DDPROF_LIB_SRC ${COMMON_SRC} src/lib/ddprof_output.cc)

# Libs to link
set(NATIVE_LIB_LIBRARY_LIST llvm-demangle ${ELFUTILS_LIBRARIES} Threads::Threads)

if(${DDPROF_JEMALLOC})
list(PREPEND NATIVE_LIB_LIBRARY_LIST jemalloc)
endif()

# Create the lib
add_library(ddprof-native ${DDPROF_LIB_SRC})

set_target_properties(ddprof-native PROPERTIES VERSION ${PROJECT_VERSION})
set_target_properties(ddprof-native PROPERTIES COMPILE_DEFINITIONS DDPROF_NATIVE_LIB)

# libcap, can be removed from version distributed to client
list(APPEND NATIVE_LIB_LIBRARY_LIST libcap)

target_include_directories(ddprof-native PRIVATE ${DDPROF_INCLUDE_LIST})

target_link_libraries(ddprof-native PRIVATE ${NATIVE_LIB_LIBRARY_LIST})
add_library(DDProf::Native ALIAS ddprof-native)

option(ACCURACY_TEST "Enable accuracy test" OFF)
if(${ACCURACY_TEST})
add_subdirectory(test/self_unwind)
endif()
endif()

# ---- Unit tests ----

# Unit tests Add infrastructure for enabling tests
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ We're always happy to help contributors with their pull requests.

## Final word

Many thanks to all of our contributors, and looking forward to seeing you on Github! :tada:
Many thanks to all of our contributors, and looking forward to seeing you on Github!
3 changes: 3 additions & 0 deletions CppCheckSuppressions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ missingInclude

// Ignore warnings from third parties
*:*/third_party/*

// Ignore Lex and Yacc defects
*:*/event_parser/*
Loading