spring-projects / spring-projects/spring-ai

Provide a way to log the final request before it goes to Model and final request after it is processed by all other Advisors in org.springframework.ai.chat.client.advisor.SimpleLoggerAdvisor

Open
#4,732 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
1d 7h
Merged PRs (30d)
6

Description

This is a feature request. org.springframework.ai.chat.client.advisor.SimpleLoggerAdvisor is great, but ...
Expected Behavior

I should be able to use two instances org.springframework.ai.chat.client.advisor.SimpleLoggerAdvisor to log

  • final request after it is processed by all advisors and just before it is sent to Model
  • final response after it is processed by all other advisors and just before it is returned to the user

Current Behavior

Because of the stack like behavior I cannot get the desired behavior using two instances of org.springframework.ai.chat.client.advisor.SimpleLoggerAdvisor . Instead of getting two logs I get four logs.

May be allow suppressing logRequest and logResponse in each of the instance. Or may be make these methods protected.

Context

I want to log

  • final request after it is processed by all advisors and just before it is sent to Model
  • final response after it is processed by all other advisors and just before it is returned to the user

only.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with org.springframework.ai.chat.client.advisor.SimpleLoggerAdvisor and trace how advisor nesting causes two logger instances to produce four logs. Reproduce the behavior with separate request and response logging configurations, then verify that only the final request before the Model and final response before returning to the user are logged.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend, observability
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.