Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allAr
String query = request.getQuery();
if (StringUtils.hasText(query) && SpringAiPluginConfig.Plugin.SpringAi.COLLECT_RETRIEVAL_QUERY) {
int limit = SpringAiPluginConfig.Plugin.SpringAi.RETRIEVAL_QUERY_LENGTH_LIMIT;
if (limit > 0 && query.length() > limit) {
if (limit >= 0 && query.length() > limit) {
query = query.substring(0, limit);
}
Tags.GEN_AI_RETRIEVAL_QUERY_TEXT.set(span, query);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ private void collectPrompt(AbstractSpan span, Object[] allArguments) {
InputMessages inputMessages = InputMessages.fromPrompt(prompt);
String inputMessagesJson = inputMessages.toJson();
int limit = SpringAiPluginConfig.Plugin.SpringAi.INPUT_MESSAGES_LENGTH_LIMIT;
if (limit > 0 && inputMessagesJson.length() > limit) {
if (limit >= 0 && inputMessagesJson.length() > limit) {
inputMessagesJson = inputMessagesJson.substring(0, limit);
}

Expand All @@ -174,7 +174,7 @@ private void collectCompletion(AbstractSpan span, ChatResponse response) {
String outputMessagesJson = outputMessages.toJson();
int limit = SpringAiPluginConfig.Plugin.SpringAi.OUTPUT_MESSAGES_LENGTH_LIMIT;

if (limit > 0 && outputMessagesJson.length() > limit) {
if (limit >= 0 && outputMessagesJson.length() > limit) {
outputMessagesJson = outputMessagesJson.substring(0, limit);
}
Tags.GEN_AI_OUTPUT_MESSAGES.set(span, outputMessagesJson);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ private void collectPrompt(AbstractSpan span, Object[] allArguments) {
String inputMessagesJson = inputMessages.toJson();

int limit = SpringAiPluginConfig.Plugin.SpringAi.INPUT_MESSAGES_LENGTH_LIMIT;
if (limit > 0 && inputMessagesJson.length() > limit) {
if (limit >= 0 && inputMessagesJson.length() > limit) {
inputMessagesJson = inputMessagesJson.substring(0, limit);
}

Expand All @@ -238,7 +238,7 @@ private void collectCompletion(AbstractSpan span, StreamState state) {
String outputMessagesJson = outputMessages.toJson();

int limit = SpringAiPluginConfig.Plugin.SpringAi.OUTPUT_MESSAGES_LENGTH_LIMIT;
if (limit > 0 && outputMessagesJson.length() > limit) {
if (limit >= 0 && outputMessagesJson.length() > limit) {
outputMessagesJson = outputMessagesJson.substring(0, limit);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public static class SpringAi {
/**
* Whether to collect the documents of the rag call.
*/
public static boolean COLLECT_RETRIEVAL_DOCUMENTS = false;
public static boolean COLLECT_RETRIEVAL_DOCUMENTS = false;
}
}
}
2 changes: 1 addition & 1 deletion apm-sniffer/config/agent.config
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,6 @@ plugin.springai.collect_retrieval_query=${SW_PLUGIN_SPRINGAI_COLLECT_RETRIEVAL_Q
# The maximum characters of the collected rag query.
# If the content exceeds this limit, it will be truncated.
# Use a negative value to represent no limit, but be aware this could cause OOM.
plugin.springai.retrieval_query=${SW_PLUGIN_SPRINGAI_RETRIEVAL_QUERY_LENGTH_LIMIT:1024}
plugin.springai.retrieval_query_length_limit=${SW_PLUGIN_SPRINGAI_RETRIEVAL_QUERY_LENGTH_LIMIT:1024}
# Whether to collect the documents of the rag call.
plugin.springai.collect_retrieval_documents=${SW_PLUGIN_SPRINGAI_COLLECT_RETRIEVAL_DOCUMENTS:false}
Loading