This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-java.git
The following commit(s) were added to refs/heads/main by this push:
new ac0df43d71 Fix the tag key of ttfr to align with otlp semantic (#799)
ac0df43d71 is described below
commit ac0df43d7140e726eba9e5e5b1b75cf364c71dff
Author: peachisai <[email protected]>
AuthorDate: Tue Mar 17 22:08:08 2026 +0800
Fix the tag key of ttfr to align with otlp semantic (#799)
---
.../java/org/apache/skywalking/apm/agent/core/context/tag/Tags.java | 6 +++---
.../apm/plugin/spring/ai/v1/ChatModelStreamInterceptor.java | 2 +-
.../scenarios/spring-ai-1.x-scenario/config/expectedData.yaml | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git
a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/tag/Tags.java
b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/tag/Tags.java
index 995b91f582..3d0b9f37cb 100644
---
a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/tag/Tags.java
+++
b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/tag/Tags.java
@@ -238,17 +238,17 @@ public final class Tags {
/**
* GEN_AI_STREAM_TTFR represents the time to first response (TTFR) for
streaming operations.
*/
- public static final StringTag GEN_AI_STREAM_TTFR = new StringTag(40,
"gen_ai.stream.ttfr");
+ public static final StringTag GEN_AI_SERVER_TIME_TO_FIRST_TOKEN = new
StringTag(40, "gen_ai.server.time_to_first_token");
/**
* GEN_AI_INPUT_MESSAGES represents the chat history provided to the model
as an input.
*/
- public static final StringTag GEN_AI_INPUT_MESSAGES = new StringTag(44,
"gen_ai.input.messages");
+ public static final StringTag GEN_AI_INPUT_MESSAGES = new StringTag(41,
"gen_ai.input.messages");
/**
* GEN_AI_OUTPUT_MESSAGES represents the messages returned by the model
where each message represents a specific model response (choice, candidate).
*/
- public static final StringTag GEN_AI_OUTPUT_MESSAGES = new StringTag(45,
"gen_ai.output.messages");
+ public static final StringTag GEN_AI_OUTPUT_MESSAGES = new StringTag(42,
"gen_ai.output.messages");
/**
* Creates a {@code StringTag} with the given key and cache it, if it's
created before, simply return it without
diff --git
a/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
b/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
index e0c11c32ec..1674e82011 100644
---
a/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
+++
b/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
@@ -150,7 +150,7 @@ public class ChatModelStreamInterceptor implements
InstanceMethodsAroundIntercep
return;
}
if (state.firstResponseReceived.compareAndSet(false, true)) {
- Tags.GEN_AI_STREAM_TTFR.set(span,
String.valueOf(System.currentTimeMillis() - state.startTime));
+ Tags.GEN_AI_SERVER_TIME_TO_FIRST_TOKEN.set(span,
String.valueOf(System.currentTimeMillis() - state.startTime));
}
}
diff --git
a/test/plugin/scenarios/spring-ai-1.x-scenario/config/expectedData.yaml
b/test/plugin/scenarios/spring-ai-1.x-scenario/config/expectedData.yaml
index 161eb6e2f2..5f40e79a48 100644
--- a/test/plugin/scenarios/spring-ai-1.x-scenario/config/expectedData.yaml
+++ b/test/plugin/scenarios/spring-ai-1.x-scenario/config/expectedData.yaml
@@ -116,7 +116,7 @@ segmentItems:
- { key: gen_ai.request.temperature, value: '0.7' }
- { key: gen_ai.request.top_k, value: null }
- { key: gen_ai.request.top_p, value: '0.9' }
- - { key: gen_ai.stream.ttfr, value: not null }
+ - { key: gen_ai.server.time_to_first_token, value: not null }
- { key: gen_ai.response.id, value: 'chatcmpl-fc1b64d3' }
- { key: gen_ai.response.model, value: gpt-4.1-2025-04-14 }
- { key: gen_ai.response.finish_reasons, value: STOP }