wso2 / wso2/api-platform

[Improvement]: Loopback provider-event suppression also drops traffic-log events for the internal LLM proxy hop

Open
#2,992 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area/AIGateway Area/Gateway Aspect/Logging Type/Improvement
Dominant language
Go
Stars
71
Forks
111
Avg merge
1d 14h
Merged PRs (30d)
110

Description

Please select the area the issue is related to

Gateway

Please select the aspect the issue is related to

Aspect/Logging (Log formats, instrumentation, improvements)

Suggested Improvement

The fix for duplicate LLM proxy analytics events[1] suppresses the internal loopback LlmProvider hop in Analytics.Process (gateway/gateway-runtime/policy-engine/internal/analytics/analytics.go). That correctly removes the Moesif double-count. However, the suppression is implemented as an early return placed above the publisher fan-out, so it applies to every registered publisher not just the one with the double-count problem.

For every LLM proxy invocation, the provider hop disappears from the traffic log. That is the only record that measures the real vendor round-trip in isolation:

Hop Measures After the fix
LlmProxy (client → gateway) Whole chain, including the loopback re-entry Logged
LlmProvider (gateway → vendor) Actual vendor latency / response Dropped

Consequences:

  • "Was the call slow because of the LLM vendor or because of our own mediation?" is no longer
    answerable from the traffic log for proxied APIs.
  • Any debugging, audit, or SIEM pipeline consuming the traffic log silently loses the upstream
    hop for all proxied LLM traffic.

Expected behaviour

Suppression should be scoped to the consumer that requires it (Moesif). The traffic-log publisher
should continue to receive both hops.


Related Issues

https://github.com/wso2/api-platform/issues/2441

Contributor guide

No contributing guide indexed for this repository

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 in gateway/gateway-runtime/policy-engine/internal/analytics/analytics.go at Analytics.Process and inspect the early return before publisher fan-out. Trace the registered publishers to scope suppression to Moesif while preserving the LlmProvider event for traffic logging; verify both LlmProxy and LlmProvider hops remain in traffic logs and Moesif does not double-count.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
observability-sre
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.