File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed
src/main/java/datadog/trace/util Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -246,6 +246,7 @@ dependencies {
246246 api project(' :components:yaml' )
247247 api project(' :components:cli' )
248248 api project(" :utils:time-utils" )
249+ api project(" :utils:container-utils" )
249250
250251 // has to be loaded by system classloader:
251252 // it contains annotations that are also present in the instrumented application classes
Original file line number Diff line number Diff line change 11package datadog .trace .util ;
22
3+ import datadog .common .container .ContainerInfo ;
34import datadog .trace .api .Platform ;
45import datadog .trace .bootstrap .instrumentation .api .AgentTracer ;
56import datadog .trace .context .TraceScope ;
@@ -76,6 +77,11 @@ private static String getOSTempDir() {
7677 // the JDK OS-specific implementations of os::get_temp_directory(), i.e.
7778 // https://github.com/openjdk/jdk/blob/f50bd0d9ec65a6b9596805d0131aaefc1bb913f3/src/hotspot/os/bsd/os_bsd.cpp#L886-L904
7879 if (Platform .isLinux ()) {
80+ if (ContainerInfo .isRunningInContainer ()) {
81+ // See
82+ // https://github.com/openjdk/jdk/blob/39a28ffe4e23274dba34317d8960bfb7e6d203ed/src/hotspot/os/posix/perfMemory_posix.cpp#L136-L146
83+ return "/proc/" + getPid () + "/root/tmp/hsperfdata_" + System .getProperty ("user.name" );
84+ }
7985 return "/tmp/" ;
8086 } else if (Platform .isWindows ()) {
8187 return Stream .of (System .getenv ("TMP" ), System .getenv ("TEMP" ), System .getenv ("USERPROFILE" ))
You can’t perform that action at this time.
0 commit comments