Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ Release Notes.
* Bump the netty shaded into the agent from `4.1.124.Final` to `4.1.139.Final` (with netty-tcnative-boringssl-static
`2.0.70.Final` → `2.0.84.Final`, the version netty `4.1.139.Final` is built with) to clear the netty-codec,
netty-codec-http, netty-codec-http2, netty-handler and netty-handler-proxy CVEs.
* Report the time to first token of a streaming call of the `spring-ai-1.x` plugin in the
`gen_ai.response.time_to_first_chunk` tag, in seconds, the span attribute the OpenTelemetry GenAI semantic conventions
define for it, instead of in `gen_ai.server.time_to_first_token`, in milliseconds, a name the conventions give to a
metric. `Tags.GEN_AI_SERVER_TIME_TO_FIRST_TOKEN` is renamed to `Tags.GEN_AI_RESPONSE_TIME_TO_FIRST_CHUNK`. An OAP that
reads only the previous tag shows no time to first token for the calls this agent traces.

All issues and pull requests are [here](https://github.com/apache/skywalking/milestone/267?closed=1)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,10 @@ public static final class HTTP {
public static final StringTag GEN_AI_RESPONSE_FINISH_REASONS = new StringTag(39, "gen_ai.response.finish_reasons");

/**
* GEN_AI_STREAM_TTFR represents the time to first response (TTFR) for streaming operations.
* GEN_AI_RESPONSE_TIME_TO_FIRST_CHUNK represents the time from the start of the call to the first chunk of a
* streaming response, in seconds.
*/
public static final StringTag GEN_AI_SERVER_TIME_TO_FIRST_TOKEN = new StringTag(40, "gen_ai.server.time_to_first_token");
public static final StringTag GEN_AI_RESPONSE_TIME_TO_FIRST_CHUNK = new StringTag(40, "gen_ai.response.time_to_first_chunk");

/**
* GEN_AI_INPUT_MESSAGES represents the chat history provided to the model as an input.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ private void recordTtfrIfFirstToken(AbstractSpan span, Generation generation, St
return;
}
if (state.firstResponseReceived.compareAndSet(false, true)) {
Tags.GEN_AI_SERVER_TIME_TO_FIRST_TOKEN.set(span, String.valueOf(System.currentTimeMillis() - state.startTime));
Tags.GEN_AI_RESPONSE_TIME_TO_FIRST_CHUNK.set(
span, String.valueOf((System.currentTimeMillis() - state.startTime) / 1000.0));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.server.time_to_first_token, value: not null }
- { key: gen_ai.response.time_to_first_chunk, 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 }
Expand Down
Loading