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
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ Release Notes.
9.9.0
------------------

* Fix the `spring-ai-1.x` plugin recording the literal string `null` as the value of `gen_ai.request.top_k`,
`gen_ai.request.temperature`, `gen_ai.request.top_p` and `gen_ai.request.model` on the span of a streaming chat
request. `ChatOptions` returns `null` for a sampling setting the request does not carry, and `String.valueOf` turned
that into a value the collector keeps as a real tag. The span of the non-streaming request already skipped them, so
the two spans of one request carried different tags.

* Record `gen_ai.request.max_tokens`, `gen_ai.request.frequency_penalty` and `gen_ai.request.presence_penalty` on the
spans of the `spring-ai-1.x` plugin. The `ChatOptions` of a request carries all three, and the OpenTelemetry GenAI
semantic conventions list them as recommended span attributes, but the plugin recorded only the model name and the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,18 @@ public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allAr
return;
}

Tags.GEN_AI_REQUEST_MODEL.set(span, chatOptions.getModel());
Tags.GEN_AI_TEMPERATURE.set(span, String.valueOf(chatOptions.getTemperature()));
Tags.GEN_AI_TOP_K.set(span, String.valueOf(chatOptions.getTopK()));
Tags.GEN_AI_TOP_P.set(span, String.valueOf(chatOptions.getTopP()));

if (chatOptions.getModel() != null) {
Tags.GEN_AI_REQUEST_MODEL.set(span, chatOptions.getModel());
}
if (chatOptions.getTemperature() != null) {
Tags.GEN_AI_TEMPERATURE.set(span, String.valueOf(chatOptions.getTemperature()));
}
if (chatOptions.getTopK() != null) {
Tags.GEN_AI_TOP_K.set(span, String.valueOf(chatOptions.getTopK()));
}
if (chatOptions.getTopP() != null) {
Tags.GEN_AI_TOP_P.set(span, String.valueOf(chatOptions.getTopP()));
}
if (chatOptions.getMaxTokens() != null) {
Tags.GEN_AI_REQUEST_MAX_TOKENS.set(span, String.valueOf(chatOptions.getMaxTokens()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ segmentItems:
- { key: gen_ai.provider.name, value: openai }
- { key: gen_ai.request.model, value: gpt-4.1-2025-04-14 }
- { 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.request.max_tokens, value: '1000' }
- { key: gen_ai.request.frequency_penalty, value: '0.5' }
Expand Down
Loading