Skip to content

Commit 2f1d9e9

Browse files
authored
Fix the logic that was failing to record TTFR (#798)
1 parent 233effa commit 2f1d9e9

1 file changed

Lines changed: 2 additions & 2 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/ChatModelStreamInterceptor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allAr
6363
return;
6464
}
6565

66+
ContextManager.getRuntimeContext().put(Constants.SPRING_AI_STREAM_START_TIME, System.currentTimeMillis());
67+
6668
ChatOptions chatOptions = prompt.getOptions();
6769
if (chatOptions == null) {
6870
return;
@@ -72,8 +74,6 @@ public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allAr
7274
Tags.GEN_AI_TEMPERATURE.set(span, String.valueOf(chatOptions.getTemperature()));
7375
Tags.GEN_AI_TOP_K.set(span, String.valueOf(chatOptions.getTopK()));
7476
Tags.GEN_AI_TOP_P.set(span, String.valueOf(chatOptions.getTopP()));
75-
76-
ContextManager.getRuntimeContext().put(Constants.SPRING_AI_STREAM_START_TIME, System.currentTimeMillis());
7777
}
7878

7979
@Override

0 commit comments

Comments
 (0)