gnodet-bot commented on code in PR #26608:
URL: https://github.com/apache/camel/pull/26608#discussion_r4052491468
##########
components/camel-ai/camel-ai-observability-api/src/main/java/org/apache/camel/component/ai/observability/GenAiOperationName.java:
##########
@@ -24,6 +24,8 @@ public enum GenAiOperationName {
CHAT("chat"),
EMBEDDINGS("embeddings"),
GENERATE_CONTENT("generate_content"),
+ /** Audio transcription and translation operations. */
+ TRANSCRIPTION("transcription"),
Review Comment:
⚠️ **`TRANSCRIPTION` is being used for both transcription and translation**
— see the companion comment on `OpenAIAudioTranslationProducer`.
Add a `TRANSLATION` variant here so each operation maps to the correct
semantic convention value:
```suggestion
/** Audio transcription operation. */
TRANSCRIPTION("transcription"),
/** Audio translation operation. */
TRANSLATION("translation"),
```
##########
components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIAudioTranslationProducer.java:
##########
@@ -73,8 +76,17 @@ public void process(Exchange exchange) throws Exception {
}
TranslationCreateParams params = paramsBuilder.build();
- TranslationCreateResponse response = getEndpoint().getClient()
- .audio().translations().create(params);
+ GenAiObservation observation =
OpenAIGenAiProducerSupport.start(exchange, GenAiOperationName.TRANSCRIPTION,
model);
Review Comment:
⚠️ **Wrong operation name for translation spans**
`GenAiOperationName.TRANSCRIPTION` is used here, but this is the
**translation** producer. Every span emitted by
`OpenAIAudioTranslationProducer` will be tagged
`gen_ai.operation.name=transcription`, making translation spans
indistinguishable from transcription spans in dashboards and alert rules.
The `TRANSCRIPTION` enum Javadoc says "Audio transcription and translation
operations" — but that was written to justify reuse, not as a hard
OpenTelemetry requirement. The GenAI semantic convention specifies
`translation` as a distinct operation name.
The fix is to add a `TRANSLATION("translation")` variant (or at minimum
`TRANSLATION("translation")` alongside `TRANSCRIPTION`) and use it here:
```suggestion
GenAiObservation observation =
OpenAIGenAiProducerSupport.start(exchange, GenAiOperationName.TRANSLATION,
model);
```
##########
components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIAudioTranslationProducer.java:
##########
@@ -73,8 +76,17 @@ public void process(Exchange exchange) throws Exception {
}
TranslationCreateParams params = paramsBuilder.build();
- TranslationCreateResponse response = getEndpoint().getClient()
- .audio().translations().create(params);
+ GenAiObservation observation =
OpenAIGenAiProducerSupport.start(exchange, GenAiOperationName.TRANSCRIPTION,
model);
Review Comment:
🧪 **Missing observability test for translation**
This PR adds observability wrapping to both `OpenAIAudioSpeechProducer`
(using `GENERATE_CONTENT`) and `OpenAIAudioTranslationProducer` (using
`TRANSCRIPTION`/should be `TRANSLATION`), but neither producer has a
corresponding observability test. `OpenAIAudioTranscriptionObservabilityTest`
and `OpenAIImageGenerationObservabilityTest` were added for transcription and
image-generation respectively — the same pattern must be applied for speech and
translation.
Without tests, the observability wiring for speech and translation is
unverified and could silently break (e.g., missing span, wrong
`gen_ai.operation.name` tag).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]