Skip to content

Commit aea89e3

Browse files
committed
Code review follow-up fixes
1 parent 3a93165 commit aea89e3

File tree

5 files changed

+22
-25
lines changed

5 files changed

+22
-25
lines changed

dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/InstrumenterModule.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,11 @@ public static ReferenceMatcher loadStaticMuzzleReferences(
109109

110110
/**
111111
* @return Class names of helpers to inject into the user's classloader.
112-
* <blockquote>
113-
* <p><b>NOTE:</b> The order matters. If the muzzle check fails with a NoClassDefFoundError
114-
* (as seen in build/reports/muzzle-*.txt), it may be because some helper classes depend on
115-
* each other. In this case, the order must be adjusted accordingly.
116-
* </blockquote>
112+
* <p><b>NOTE:</b> The order of the returned helper classes matters. If a muzzle check fails
113+
* with a NoClassDefFoundError, as logged in build/reports/muzzle-*.txt, it is likely that one
114+
* helper class depends on another that appears later in the list. In this case, the returned
115+
* list must be reordered so that the referred helper class appears before the one that refers
116+
* to it.
117117
*/
118118
public String[] helperClassNames() {
119119
return NO_HELPERS;

dd-java-agent/instrumentation/openai-java/openai-java-3.0/src/test/groovy/OpenAiTest.groovy

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ abstract class OpenAiTest extends InstrumentationSpecification {
5353
handlers {
5454
prefix("/$API_VERSION/") {
5555
def requestBody = request.text
56-
def recFile = RequestResponseRecord.requestToFileName(request.method, requestBody.getBytes(Charsets.UTF_8))
56+
def recFile = RequestResponseRecord.requestToFileName("POST", requestBody.getBytes(Charsets.UTF_8))
5757
def rec = cache.get(recFile)
5858
if (rec == null) {
5959
String path = request.path
@@ -122,31 +122,30 @@ abstract class OpenAiTest extends InstrumentationSpecification {
122122
CompletionCreateParams completionCreateParams(boolean json) {
123123
if (json) {
124124
CompletionCreateParams.builder()
125-
.model("gpt-3.5-turbo-instruct")
126-
.prompt("Tell me a story about building the best SDK!")
127-
.build()
128-
125+
.model("gpt-3.5-turbo-instruct")
126+
.prompt("Tell me a story about building the best SDK!")
127+
.build()
129128
} else {
130129
CompletionCreateParams.builder()
131-
.model(CompletionCreateParams.Model.GPT_3_5_TURBO_INSTRUCT)
132-
.prompt("Tell me a story about building the best SDK!")
133-
.build()
130+
.model(CompletionCreateParams.Model.GPT_3_5_TURBO_INSTRUCT)
131+
.prompt("Tell me a story about building the best SDK!")
132+
.build()
134133
}
135134
}
136135

137136
CompletionCreateParams completionCreateStreamedParams(boolean json) {
138137
if (json) {
139138
CompletionCreateParams.builder()
140-
.model("gpt-3.5-turbo-instruct")
141-
.prompt("Tell me a story about building the best SDK!")
142-
.streamOptions(ChatCompletionStreamOptions.builder().includeUsage(true).build())
143-
.build()
139+
.model("gpt-3.5-turbo-instruct")
140+
.prompt("Tell me a story about building the best SDK!")
141+
.streamOptions(ChatCompletionStreamOptions.builder().includeUsage(true).build())
142+
.build()
144143
} else {
145144
CompletionCreateParams.builder()
146-
.model(CompletionCreateParams.Model.GPT_3_5_TURBO_INSTRUCT)
147-
.prompt("Tell me a story about building the best SDK!")
148-
.streamOptions(ChatCompletionStreamOptions.builder().includeUsage(true).build())
149-
.build()
145+
.model(CompletionCreateParams.Model.GPT_3_5_TURBO_INSTRUCT)
146+
.prompt("Tell me a story about building the best SDK!")
147+
.streamOptions(ChatCompletionStreamOptions.builder().includeUsage(true).build())
148+
.build()
150149
}
151150
}
152151

dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/asserts/TagsAssert.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ class TagsAssert {
239239
if (expected instanceof Pattern) {
240240
assert value =~ expected: "Tag \"$name\": \"${value.toString()}\" does not match pattern \"$expected\""
241241
} else if (expected instanceof Class) {
242-
assert ((Class) expected).isInstance(value): "Tag \"$name\": instance check $expected failed for \"${value.toString()}\" of class \"${value?.class}\""
242+
assert ((Class) expected).isInstance(value): "Tag \"$name\": instance check $expected failed for \"${value.toString()}\" of class \"${value.class}\""
243243
} else if (expected instanceof Closure) {
244244
assert ((Closure) expected).call(value): "Tag \"$name\": closure call ${expected.toString()} failed with \"$value\""
245245
} else if (expected instanceof CharSequence) {

dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/server/http/TestHttpServer.groovy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,6 @@ class TestHttpServer implements AutoCloseable {
426426
this.contentLength = req.contentLength
427427
this.contentType = req.contentType?.split(";")
428428
this.body = req.inputStream.bytes
429-
this.method = req.method
430429
}
431430

432431
def getPath() {

dd-trace-core/src/main/java/datadog/trace/llmobs/writer/ddintake/LLMObsSpanMapper.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,8 @@ public void map(List<? extends CoreSpan<?>> trace, Writable writable) {
167167

168168
private CharSequence llmObsSpanName(CoreSpan<?> span) {
169169
CharSequence operationName = span.getOperationName();
170-
CharSequence resourceName = span.getResourceName();
171170
if ("openai.request".contentEquals(operationName)) {
172-
return "OpenAI." + resourceName;
171+
return "OpenAI." + span.getResourceName();
173172
}
174173
return operationName;
175174
}

0 commit comments

Comments
 (0)