Skip to content

ChatObservationProperties.class missing logCompletion field and corresponding setter method. #3151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
iAMSagar44 opened this issue May 14, 2025 · 8 comments
Assignees
Labels
bug Something isn't working Observability
Milestone

Comments

@iAMSagar44
Copy link
Contributor

iAMSagar44 commented May 14, 2025

The ChatObservationProperties.class is missing the logCompletion field and its corresponding setter method.

As per the documentation, the following properties have changed in RC1 -

spring.ai.chat.observations.include-prompt → spring.ai.chat.observations.log-prompt
spring.ai.chat.observations.include-completion → spring.ai.chat.observations.log-completion

This is resulting in the following error -

"message": "'spring.ai.chat.observations.log-completion' is an unknown property. Did you mean 'spring.ai.chat.observations.log-prompt'?"

A similar error is noticed for the below property too, due to the missing field (logQueryResponse) in VectorStoreObservationProperties.class
spring.ai.vectorstore.observations.log-query-response

Spring AI version - 1.0.0-RC1

quaff added a commit to quaff/spring-ai that referenced this issue May 14, 2025
…y-response`

Fixes spring-projectsGH-3151

Follow-up of commit ca843e8,`includeCompletion` is renamed to `logCompletion`.

Signed-off-by: Yanming Zhou <[email protected]>
@quaff
Copy link
Contributor

quaff commented May 14, 2025

It should be fixed by #3156

@iAMSagar44
Copy link
Contributor Author

Thanks @quaff. I also noticed that with RC-1 release the chat prompts are no longer shown in a tracing service (like Zipkin). Prior to the RC-1 release, I was able to see the prompts in tracing services like Zipkin, but with the RC-1 release, they have switched observability from tracing to logging.
Is there a way I can switch back to tracing?

@tzolov
Copy link
Contributor

tzolov commented May 14, 2025

Thanks for catching this.
IMO, the issue isn't as critical as it appear. You can continue using the properties as documented (e.g., log-xyz).
The discrepancy exists because ChatObservationProperties isn't used programmatically. The affected properties are only used for conditional auto-configurations (like this), where the values are correctly implemented (e.g., log-completion vs. include-completion).
Tests are working fine with the current implementation, but would likely fail if camelCase (e.g., logCompletion) were used instead of log-completion.

We need to fix this issue, but, IMO, the observability features should still work as documented in the meantime.

@iAMSagar44
Copy link
Contributor Author

@tzolov

Thanks for clarifying.

Prior to the RC-1 release, I was able to see the prompts in tracing services like Zipkin, but with the RC-1 release, it looks like observability has switched from tracing to logging.
Is there a way I can switch back to tracing?
Validating chat memory and prompts across multiple AI agents is easier with tracing services like Zipkin instead of relying on console logs.

@markpollack
Copy link
Member

markpollack commented May 14, 2025

@jonatan-ivanov @shakuzen @ThomasVitale - thoughts?

I think we could provide some additional configuration or example code to use an alternative configuration that reproduces the old behavior.

@markpollack markpollack changed the title RC1 error - ChatObservationProperties.class missing logCompletion field and corresponding setter method. ChatObservationProperties.class missing logCompletion field and corresponding setter method. May 14, 2025
@jonatan-ivanov
Copy link
Member

jonatan-ivanov commented May 14, 2025

Is there a way I can switch back to tracing?

See the discussions in the PR for the background: #3003
If you really want to attach possibly large amount of data to spans, as a workaround, you can copy this (you need to hardcode the key): https://github.com/spring-projects/spring-ai/blob/72a2862bcea951d465d87734ef32b3cc1ab91a4e/spring-ai-client-chat/src/main/java/org/springframework/ai/chat/client/observation/ChatClientPromptContentObservationFilter.java
If you create a bean from this or add @Component, it should work.

Validating chat memory and prompts across multiple AI agents is easier with tracing services like Zipkin instead of relying on console logs.

Those are not necessarily console logs. They are logs going to wherever you want them to go.
The logs contain the traceId and the spanId so if you have the span in Zipkin, you can look them up in your log backend.

Could you please also tell us what is your use-case to add this kind of data (large amount of text) to spans?

@tzolov tzolov self-assigned this May 15, 2025
@tzolov tzolov added bug Something isn't working Observability labels May 15, 2025
@tzolov tzolov added this to the 1.0.0 milestone May 15, 2025
@tzolov tzolov closed this as completed in 0bcb2e1 May 15, 2025
@codefromthecrypt
Copy link

@making has been making zipkin-otel which you can drop in an image and it can accept the logs as annotations https://github.com/openzipkin-contrib/zipkin-otel?tab=readme-ov-file#docker-images

@tzolov
Copy link
Contributor

tzolov commented May 16, 2025

@iAMSagar44 , I've tried to factor out the handlers and filters (removed in RC1) into a standalone project: https://github.com/tzolov/observability-extensions
One option is to add the project to the spring-ai-community

namsoo2 pushed a commit to namsoo2/spring-ai that referenced this issue Jun 9, 2025
…y-response`

Fixes spring-projectsGH-3151

Follow-up of commit ca843e8,`includeCompletion` is renamed to `logCompletion`.

Signed-off-by: Yanming Zhou <[email protected]>
Signed-off-by: minsoo.nam <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Observability
Projects
None yet
Development

No branches or pull requests

6 participants