Skip to content

Commit ffd60de

Browse files
chore: rename soname to Pyroscope.Profiler.Native (#120)
* chore: rename soname to Pyroscope.Profiler.Native * Revert "chore: rename soname to Pyroscope.Profiler.Native" This reverts commit 377f525. * hopefully break integration test * Reapply "chore: rename soname to Pyroscope.Profiler.Native" This reverts commit 9b44c1f. * revert debug log * large runners for integration tests * large runners * maybe fix alpine tests * print an error message
1 parent 77874f1 commit ffd60de

File tree

8 files changed

+38
-22
lines changed

8 files changed

+38
-22
lines changed

.github/workflows/integration_test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ permissions:
1212
jobs:
1313
build-profiler-images:
1414
name: Build Profiler Image
15-
runs-on: ubuntu-x64-small
15+
runs-on: ubuntu-x64-large
1616
strategy:
1717
matrix:
1818
flavour:
@@ -39,7 +39,7 @@ jobs:
3939
run-integration-test:
4040
name: Run Integration Test
4141
needs: build-profiler-images
42-
runs-on: ubuntu-x64-small
42+
runs-on: ubuntu-x64-large
4343
strategy:
4444
fail-fast: false
4545
matrix:

Pyroscope.Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ RUN mkdir build-${CMAKE_BUILD_TYPE} && \
3030
-DCMAKE_CXX_FLAGS_DEBUG="-g -O0" \
3131
-DCMAKE_C_FLAGS_DEBUG="-g -O0"
3232

33-
RUN cd build-${CMAKE_BUILD_TYPE} && make -j16 Datadog.Profiler.Native Datadog.Linux.ApiWrapper.x64
33+
RUN cd build-${CMAKE_BUILD_TYPE} && make -j16 Pyroscope.Profiler.Native Datadog.Linux.ApiWrapper.x64
3434

3535
FROM busybox:1.36.1-glibc
36-
COPY --from=builder /profiler/profiler/_build/DDProf-Deploy/linux/Datadog.Profiler.Native.so /Pyroscope.Profiler.Native.so
36+
COPY --from=builder /profiler/profiler/_build/DDProf-Deploy/linux/Pyroscope.Profiler.Native.so /Pyroscope.Profiler.Native.so
3737
COPY --from=builder /profiler/profiler/_build/DDProf-Deploy/linux/Datadog.Linux.ApiWrapper.x64.so /Pyroscope.Linux.ApiWrapper.x64.so
3838

Pyroscope.musl.Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ RUN mkdir build-${CMAKE_BUILD_TYPE} && \
3838
-DCMAKE_CXX_FLAGS_DEBUG="-g -O0" \
3939
-DCMAKE_C_FLAGS_DEBUG="-g -O0"
4040

41-
RUN cd build-${CMAKE_BUILD_TYPE} && make -j16 Datadog.Profiler.Native Datadog.Linux.ApiWrapper.x64
41+
RUN cd build-${CMAKE_BUILD_TYPE} && make -j16 Pyroscope.Profiler.Native Datadog.Linux.ApiWrapper.x64
4242

4343
FROM busybox:1.36.1-musl
44-
COPY --from=builder /profiler/profiler/_build/DDProf-Deploy/linux-musl/Datadog.Profiler.Native.so /Pyroscope.Profiler.Native.so
44+
COPY --from=builder /profiler/profiler/_build/DDProf-Deploy/linux-musl/Pyroscope.Profiler.Native.so /Pyroscope.Profiler.Native.so
4545
COPY --from=builder /profiler/profiler/_build/DDProf-Deploy/linux-musl/Datadog.Linux.ApiWrapper.x64.so /Pyroscope.Linux.ApiWrapper.x64.so
4646

Pyroscope/Pyroscope/Profiler.cs

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ public void SetDynamicTag(string key, string value)
4343
{
4444
NativeInterop.SetDynamicTag(key, value);
4545
}
46-
catch (DllNotFoundException)
46+
catch (DllNotFoundException ex)
4747
{
48+
DllNotFound(ex);
4849
_dllNotFound = true;
4950
}
5051
}
@@ -59,8 +60,9 @@ public void ClearDynamicTags()
5960
{
6061
NativeInterop.ClearDynamicTags();
6162
}
62-
catch (DllNotFoundException)
63+
catch (DllNotFoundException ex)
6364
{
65+
DllNotFound(ex);
6466
_dllNotFound = true;
6567
}
6668
}
@@ -80,8 +82,9 @@ public void SetCPUTrackingEnabled(bool enabled)
8082
{
8183
NativeInterop.SetCPUTrackingEnabled(enabled);
8284
}
83-
catch (DllNotFoundException)
85+
catch (DllNotFoundException ex)
8486
{
87+
DllNotFound(ex);
8588
_dllNotFound = true;
8689
}
8790
}
@@ -100,8 +103,9 @@ public void SetAllocationTrackingEnabled(bool enabled)
100103
{
101104
NativeInterop.SetAllocationTrackingEnabled(enabled);
102105
}
103-
catch (DllNotFoundException)
106+
catch (DllNotFoundException ex)
104107
{
108+
DllNotFound(ex);
105109
_dllNotFound = true;
106110
}
107111
}
@@ -120,8 +124,9 @@ public void SetContentionTrackingEnabled(bool enabled)
120124
{
121125
NativeInterop.SetContentionTrackingEnabled(enabled);
122126
}
123-
catch (DllNotFoundException)
127+
catch (DllNotFoundException ex)
124128
{
129+
DllNotFound(ex);
125130
_dllNotFound = true;
126131
}
127132
}
@@ -140,8 +145,9 @@ public void SetExceptionTrackingEnabled(bool enabled)
140145
{
141146
NativeInterop.SetExceptionTrackingEnabled(enabled);
142147
}
143-
catch (DllNotFoundException)
148+
catch (DllNotFoundException ex)
144149
{
150+
DllNotFound(ex);
145151
_dllNotFound = true;
146152
}
147153
}
@@ -156,8 +162,9 @@ public void SetAuthToken(string authToken)
156162
{
157163
NativeInterop.SetAuthToken(authToken);
158164
}
159-
catch (DllNotFoundException)
165+
catch (DllNotFoundException ex)
160166
{
167+
DllNotFound(ex);
161168
_dllNotFound = true;
162169
}
163170
}
@@ -172,11 +179,16 @@ public void SetBasicAuth(string username, string password)
172179
{
173180
NativeInterop.SetBasicAuth(username, password);
174181
}
175-
catch (DllNotFoundException)
182+
catch (DllNotFoundException ex)
176183
{
184+
DllNotFound(ex);
177185
_dllNotFound = true;
178186
}
179187
}
188+
189+
private static void DllNotFound(DllNotFoundException ex) {
190+
Console.WriteLine($"[Profiler] Failed to load Pyroscope.Profiler.Native.so : {ex}.\nConsider setting LD_LIBRARY_PATH pointing to the directory containing the Pyroscope.Profiler.Native.so");
191+
}
180192

181193
private readonly ContextTracker _contextTracker;
182194
private bool _dllNotFound;

itest.Dockerfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,19 @@ FROM --platform=linux/amd64 mcr.microsoft.com/dotnet/aspnet:$SDK_VERSION$SDK_IMA
3333

3434
WORKDIR /dotnet
3535

36-
COPY --from=sdk /Pyroscope.Profiler.Native.so ./Pyroscope.Profiler.Native.so
37-
COPY --from=sdk /Pyroscope.Linux.ApiWrapper.x64.so ./Pyroscope.Linux.ApiWrapper.x64.so
36+
# place the binaries in a subfolder - to rigger a problme when SONAME was Datadog.Profiler.Native
37+
# and dynamic linker could not find the profiler lib.
38+
COPY --from=sdk /Pyroscope.Profiler.Native.so ./subfolder/Pyroscope.Profiler.Native.so
39+
COPY --from=sdk /Pyroscope.Linux.ApiWrapper.x64.so ./subfolder/Pyroscope.Linux.ApiWrapper.x64.so
3840
COPY --from=build /dotnet/app ./
3941

42+
# Fix for alpine not being able to dlopen an already loaded library
43+
ENV LD_LIBRARY_PATH=/dotnet/subfolder/
4044

4145
ENV CORECLR_ENABLE_PROFILING=1
4246
ENV CORECLR_PROFILER={BD1A650D-AC5D-4896-B64F-D6FA25D6B26A}
43-
ENV CORECLR_PROFILER_PATH=/dotnet/Pyroscope.Profiler.Native.so
44-
ENV LD_PRELOAD=/dotnet/Pyroscope.Linux.ApiWrapper.x64.so
47+
ENV CORECLR_PROFILER_PATH=/dotnet/subfolder/Pyroscope.Profiler.Native.so
48+
ENV LD_PRELOAD=/dotnet/subfolder/Pyroscope.Linux.ApiWrapper.x64.so
4549

4650
ENV PYROSCOPE_SERVER_ADDRESS=http://pyroscope:4040
4751
ENV PYROSCOPE_LOG_LEVEL=debug

profiler/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ enable_testing()
143143
add_subdirectory(test)
144144

145145
add_custom_target(profiler)
146-
add_dependencies(profiler Datadog.Profiler.Native)
146+
add_dependencies(profiler Pyroscope.Profiler.Native)
147147

148148
add_custom_target(all-profiler)
149149
add_dependencies(all-profiler profiler profiler-native-tests)

profiler/src/ProfilerEngine/Datadog.Profiler.Native.Linux/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ endif()
5555
# Environment detection
5656
# ******************************************************
5757

58-
SET(PROFILER_BASENAME Datadog.Profiler.Native)
58+
SET(PROFILER_BASENAME Pyroscope.Profiler.Native)
5959
SET(PROFILER_STATIC_LIB_NAME ${PROFILER_BASENAME}.static)
6060
SET(PROFILER_SHARED_LIB_NAME ${PROFILER_BASENAME})
6161

profiler/test/Datadog.Profiler.Native.Tests/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ target_include_directories(${TEST_EXECUTABLE_NAME}
6363
PUBLIC ${googletest_SOURCE_DIR}/googlemock/include
6464
)
6565

66-
add_dependencies(${TEST_EXECUTABLE_NAME} gmock gtest Datadog.Profiler.Native.static libunwind)
66+
add_dependencies(${TEST_EXECUTABLE_NAME} gmock gtest Pyroscope.Profiler.Native.static libunwind)
6767

6868
if (RUN_ASAN)
6969
target_link_libraries(${TEST_EXECUTABLE_NAME} -fsanitize=address)
@@ -74,7 +74,7 @@ if (RUN_UBSAN)
7474
endif()
7575

7676
target_link_libraries(${TEST_EXECUTABLE_NAME}
77-
Datadog.Profiler.Native.static
77+
Pyroscope.Profiler.Native.static
7878
gtest_main
7979
gmock_main
8080
-static-libgcc

0 commit comments

Comments
 (0)