You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(observability): refactor content observation to use logging instead of tracing
This removes the possible large amount of data that was attached
to spans and it logs the data out. This change also removes the direct
dependency on the OTel SDK. approach for content in Spring AI.
Refactors the observability approach for content in Spring AI:
- Replace content observation filters with logging handlers
- Rename configuration properties to better reflect their purpose:
- `include-prompt` → `log-prompt`
- `include-completion` → `log-completion`
- `include-query-response` → `log-query-response`
- Add TracingAwareLoggingObservationHandler for trace-aware logging
- Replace micrometer-tracing-bridge-otel with micrometer-tracing
- Remove event-based tracing in favor of direct logging
- Update documentation to reflect these changes (add breaking-changes section)
- Rename includePrompt to logPrompt in observation properties. Updated in ChatClientBuilderProperties, ChatObservationProperties, and ImageObservationProperties.
Signed-off-by: Christian Tzolov <[email protected]>
Copy file name to clipboardExpand all lines: auto-configurations/models/chat/client/spring-ai-autoconfigure-model-chat-client/src/main/java/org/springframework/ai/model/chat/client/autoconfigure/ChatClientAutoConfiguration.java
"You have enabled the inclusion of the ChatClient prompt content in the observations, with the risk of exposing sensitive or private information. Please, be careful!");
Copy file name to clipboardExpand all lines: auto-configurations/models/chat/client/spring-ai-autoconfigure-model-chat-client/src/main/java/org/springframework/ai/model/chat/client/autoconfigure/ChatClientBuilderProperties.java
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -55,16 +55,16 @@ public void setEnabled(boolean enabled) {
55
55
publicstaticclassObservations {
56
56
57
57
/**
58
-
* Whether to include the prompt content in the observations.
58
+
* Whether to log the prompt content in the observations.
Copy file name to clipboardExpand all lines: auto-configurations/models/chat/client/spring-ai-autoconfigure-model-chat-client/src/test/java/org/springframework/ai/model/chat/client/autoconfigure/ChatClientObservationAutoConfigurationTests.java
Copy file name to clipboardExpand all lines: auto-configurations/models/chat/observation/spring-ai-autoconfigure-model-chat-observation/src/main/java/org/springframework/ai/model/chat/observation/autoconfigure/ChatObservationAutoConfiguration.java
+42-58Lines changed: 42 additions & 58 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
/*
2
-
* Copyright 2023-2024 the original author or authors.
2
+
* Copyright 2023-2025 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
* Auto-configuration for Spring AI chat model observations.
52
45
*
53
46
* @author Thomas Vitale
47
+
* @author Jonatan Ivanov
54
48
* @since 1.0.0
55
49
*/
56
50
@AutoConfiguration(
@@ -63,12 +57,12 @@ public class ChatObservationAutoConfiguration {
63
57
64
58
privatestaticvoidlogPromptContentWarning() {
65
59
logger.warn(
66
-
"You have enabled the inclusion of the prompt content in the observations, with the risk of exposing sensitive or private information. Please, be careful!");
60
+
"You have enabled logging out the prompt content with the risk of exposing sensitive or private information. Please, be careful!");
67
61
}
68
62
69
63
privatestaticvoidlogCompletionWarning() {
70
64
logger.warn(
71
-
"You have enabled the inclusion of the completion content in the observations, with the risk of exposing sensitive or private information. Please, be careful!");
65
+
"You have enabled logging out the completion content with the risk of exposing sensitive or private information. Please, be careful!");
0 commit comments