Skip to content

Commit 7b9d5d4

Browse files
khanayan123claude
andcommitted
Address PR feedback: include rootSessionId in logs, respect runtimeIdEnabled, fix test
- Add rootSessionId to Config.toString() for tracer log visibility - Gate getRootSessionId() behind runtimeIdEnabled like getRuntimeId() - Force environment map initialization in test to fix test_inst failures Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d35c504 commit 7b9d5d4

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

dd-java-agent/instrumentation/java/java-lang/java-lang-1.8/src/test/groovy/datadog/trace/instrumentation/java/lang/ProcessImplInstrumentationSpecification.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ class ProcessImplInstrumentationSpecification extends InstrumentationSpecificati
337337
when:
338338
def command = ['/bin/sh', '-c', 'echo $_DD_ROOT_JAVA_SESSION_ID']
339339
def builder = new ProcessBuilder(command)
340+
builder.environment() // force lazy environment map initialization so advice can inject
340341
Process p = builder.start()
341342
def output = p.inputStream.text.trim()
342343
def terminated = p.waitFor(5, TimeUnit.SECONDS)

internal-api/src/main/java/datadog/trace/api/Config.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3130,7 +3130,7 @@ public String getRuntimeId() {
31303130
}
31313131

31323132
public String getRootSessionId() {
3133-
return RuntimeIdHolder.rootSessionId;
3133+
return runtimeIdEnabled ? RuntimeIdHolder.rootSessionId : "";
31343134
}
31353135

31363136
public Long getProcessId() {
@@ -5873,6 +5873,9 @@ public String toString() {
58735873
+ ", runtimeId='"
58745874
+ getRuntimeId()
58755875
+ '\''
5876+
+ ", rootSessionId='"
5877+
+ getRootSessionId()
5878+
+ '\''
58765879
+ ", runtimeVersion='"
58775880
+ runtimeVersion
58785881
+ ", apiKey="

0 commit comments

Comments
 (0)