fix(policy-engine): scope loopback suppression per publisher - #3107
fix(policy-engine): scope loopback suppression per publisher#3107sanjulaonline wants to merge 1 commit into
Conversation
The internal provider hop of an LLM proxy call was returned before publisher fan-out, dropping it for both Moesif and traffic logging. Only Moesif needs that hop suppressed to avoid counting one client call twice; traffic logging needs it to record the vendor round-trip. Register each publisher with its delivery rule and skip only consumers that opt into loopback suppression. Keep the suppression debug trace single-shot and emit it only when a publisher is actually skipped. Fixes wso2#2992
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughChangesAnalytics delivery
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant AnalyticsProcess
participant MoesifPublisher
participant TrafficLogPublisher
AnalyticsProcess->>MoesifPublisher: suppress internal loopback provider event
AnalyticsProcess->>TrafficLogPublisher: publish internal loopback provider event
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain modules listed in go.work or their selected dependencies" Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Purpose
PR #2879 suppressed the internal loopback
LlmProviderhop before publisherfan-out to prevent duplicate Moesif analytics events. Because the suppression
was a global early return, the same hop was also removed from traffic logging.
That provider hop is the record that isolates the real vendor round-trip, so
dropping it prevents operators from distinguishing vendor latency from gateway
mediation latency.
Fixes #2992
Goals
Suppress the internal loopback provider hop for Moesif while continuing to
deliver it to traffic logging.
Approach
loopback-delivery rule without changing the
Publisherinterface.suppression explicitly disabled.
publisher is actually skipped.
No new dependencies or configuration changes.
User stories
As an operator investigating a proxied LLM request, I can use the traffic log to
separate vendor latency from gateway mediation while Moesif continues to count
the client request exactly once.
Documentation
N/A — this restores intended traffic-log output without changing configuration
or public APIs.
Automation tests
Unit tests
Integration tests
Security checks
Samples
N/A
Related PRs
Test environment