spring-cloud / spring-cloud/spring-cloud-bus

TraceListener not work

Open
#278 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

waiting-for-triage
Dominant language
Java
Stars
445
Forks
246
Avg merge
16h 25m
Merged PRs (30d)
5

Description

Version: 4.1.2
configure:

spring:
  cloud:
    bus:
      enabled: true
      id: MSGSMS:OMP:AMService:${VM_IP:${random.uuid}}
      trace:
        enabled: true
      ack:
        enabled: true

HttpExchangeRepository:

@Component
public class LogEventTraceRepository implements HttpExchangeRepository {
    private static final Logger log = LoggerFactory.getLogger(LogEventTraceRepository.class);

    private List<HttpExchange> traces = new ArrayList<>();


    @Override
    public List<HttpExchange> findAll() {
        return new ArrayList<>(traces);
    }

    @Override
    public void add(HttpExchange httpExchange) {
        traces.add(httpExchange);
        log.info("traces is {}", httpExchange);
    }

}

but when i define a AckRemoteApplicationEvent listener,it works well:

@Component
public class AckListener {

    @EventListener
    public void onApplicationEvent(AckRemoteApplicationEvent event) {
        System.out.println("get ack event " + event.getOriginService());
    }
}

how can i make trace listener works well

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 by examining the Spring Cloud Bus 4.1.2 trace configuration and how HttpExchangeRepository beans are registered, then compare that path with the working AckRemoteApplicationEvent listener. Reproduce the configuration and verify that LogEventTraceRepository.add receives HTTP exchanges and that findAll returns them.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
backend, observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.