Skip to content

Commit 2fb4307

Browse files
committed
fix
1 parent 768c97d commit 2fb4307

4 files changed

Lines changed: 33 additions & 4 deletions

File tree

apm-sniffer/apm-sdk-plugin/spring-plugins/spring-ai-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/ai/v1/ToolCallbackCallInterceptor.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allAr
4545

4646
AbstractSpan span = ContextManager.createLocalSpan("Spring-ai/tool/execute/" + toolName);
4747
span.setComponent(ComponentsDefine.SPRING_AI);
48-
SpanLayer.asGenAI(span);
4948

5049
Tags.GEN_AI_TOOL_NAME.set(span, toolName);
5150
Tags.GEN_AI_OPERATION_NAME.set(span, Constants.EXECUTE_TOOL);

apm-sniffer/apm-sdk-plugin/spring-plugins/spring-ai-1.x-plugin/src/main/resources/skywalking-plugin.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
spring-ai-1.x=org.apache.skywalking.apm.plugin.spring.ai.v1.define.ChatModelInstrumentation
1818
spring-ai-1.x=org.apache.skywalking.apm.plugin.spring.ai.v1.define.ToolCallbackInstrumentation
19-
spring-ai-1.x=org.apache.skywalking.apm.plugin.spring.ai.v1.define.DefaultToolCallingManagerInstrumentation
2019
spring-ai-1.x=org.apache.skywalking.apm.plugin.spring.ai.v1.define.provider.AnthropicApiInstrumentation
2120
spring-ai-1.x=org.apache.skywalking.apm.plugin.spring.ai.v1.define.provider.DeepSeekApiInstrumentation
2221
spring-ai-1.x=org.apache.skywalking.apm.plugin.spring.ai.v1.define.provider.HuggingfaceChatModelInstrumentation

test/plugin/scenarios/spring-ai-1.x-scenario/config/expectedData.yaml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ segmentItems:
2323
- operationName: Spring-ai/tool/execute/get_weather
2424
parentSpanId: 2
2525
spanId: 3
26-
spanLayer: UNRECOGNIZED
26+
spanLayer: Unknown
2727
spanType: Local
2828
tags:
2929
- { key: gen_ai.tool.name, value: get_weather }
@@ -40,7 +40,29 @@ segmentItems:
4040
- operationName: Spring-ai/openai/call
4141
parentSpanId: 0
4242
spanId: 1
43-
spanLayer: UNRECOGNIZED
43+
spanLayer: GenAI
44+
componentId: 173
45+
spanType: Exit
46+
peer: http://localhost:8080/spring-ai-1.x-scenario/llm/v1/chat/completions
47+
tags:
48+
- { key: gen_ai.operation.name, value: chat }
49+
- { key: gen_ai.provider.name, value: openai }
50+
- { key: gen_ai.request.model, value: gpt-4.1-2025-04-14 }
51+
- { key: gen_ai.request.temperature, value: '0.7' }
52+
- { key: gen_ai.request.top_p, value: '0.9' }
53+
- { key: gen_ai.response.id, value: 'chatcmpl-CyJXJt7gxwDgz' }
54+
- { key: gen_ai.response.model, value: gpt-4.1-2025-04-14 }
55+
- { key: gen_ai.usage.input_tokens, value: '52' }
56+
- { key: gen_ai.usage.output_tokens, value: '17' }
57+
- { key: gen_ai.client.token.usage, value: '69' }
58+
- { key: gen_ai.response.finish_reasons, value: STOP }
59+
- { key: gen_ai.input.messages, value: not null }
60+
- { key: gen_ai.output.messages, value: not null }
61+
62+
- operationName: Spring-ai/openai/stream
63+
parentSpanId: 0
64+
spanId: 4
65+
spanLayer: GenAI
4466
componentId: 173
4567
spanType: Exit
4668
peer: http://localhost:8080/spring-ai-1.x-scenario/llm/v1/chat/completions

test/plugin/scenarios/spring-ai-1.x-scenario/src/main/java/test/apache/skywalking/apm/testcase/jdk/httpclient/controller/CaseController.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ public String testCase() throws Exception {
5454
.call()
5555
.content();
5656

57+
chatClient
58+
.prompt("What's the weather in New York?")
59+
.system(systemPrompt)
60+
.tools(weatherTool)
61+
.stream()
62+
.content()
63+
.doOnNext(System.out::println)
64+
.blockLast();
65+
5766
return "success";
5867
}
5968
}

0 commit comments

Comments
 (0)