NE-2636: Add truncation and filtering to router tools#304
Conversation
|
@Thealisyed: This pull request references NE-2636 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe PR extends NetEdge router tools ( ChangesRouter Output Filtering and Truncation
Sequence DiagramsequenceDiagram
participant Client
participant ConfigHandler as getRouterConfig
participant SessionsHandler as getRouterSessions
participant WrapParams
participant PodResolver
participant Executor as Pod Executor
participant ConfigProcessor as truncateConfigOutput
participant SessionProcessor as truncateSessionsOutput
Client->>ConfigHandler: Call with pod?, tail_lines, section?, filter?
ConfigHandler->>WrapParams: Validate parameters
WrapParams-->>ConfigHandler: Validated params
ConfigHandler->>PodResolver: Resolve router pod if unset
PodResolver-->>ConfigHandler: Pod reference
ConfigHandler->>Executor: Exec pod for haproxy.config
Executor-->>ConfigHandler: Raw config
ConfigHandler->>ConfigProcessor: Filter by section/substring, truncate to tail_lines
ConfigProcessor-->>ConfigHandler: Filtered output + metadata
Client->>SessionsHandler: Call with pod?, limit, filter?
SessionsHandler->>WrapParams: Validate parameters
WrapParams-->>SessionsHandler: Validated params
SessionsHandler->>PodResolver: Resolve router pod if unset
PodResolver-->>SessionsHandler: Pod reference
SessionsHandler->>Executor: Exec pod for session data
Executor-->>SessionsHandler: Raw sessions
SessionsHandler->>SessionProcessor: Split blocks, filter, truncate to limit
SessionProcessor-->>SessionsHandler: Filtered blocks + metadata
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Thealisyed The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@Thealisyed: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
/assign |
|
/assign |
|
|
||
| func configSectionType(line string) string { | ||
| for _, kw := range haproxySectionKeywords { | ||
| if strings.HasPrefix(line, kw) && (len(line) == len(kw) || line[len(kw)] == ' ' || line[len(kw)] == '\t') { |
There was a problem hiding this comment.
This is a smart default for HAProxy where dynamic backends often appear at the end.
| var current []string | ||
|
|
||
| for _, line := range lines { | ||
| if strings.HasPrefix(line, "0x") { |
There was a problem hiding this comment.
This should help group into logical blocks so the pagination breaks things less awkwardly
| // getRouterSessions requires a live cluster as it queries the HAProxy admin socket | ||
| // via exec on a running router pod. It cannot work against offline data (must-gather). | ||
| func getRouterSessions(params api.ToolHandlerParams) (*api.ToolCallResult, error) { | ||
| p := api.WrapParams(params) |
There was a problem hiding this comment.
I think getRouterInfo needs this same help with WrapParams
|
|
|
/assign @bentito @jcmoraisjr |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
01e7043 to
8d07428
Compare
Summary
tail_lines,section, andfilterparameters toget_router_configto limit and filter HAProxy config outputlimitandfilterparameters toget_router_sessionsto cap and filter session outputSummary by CodeRabbit
Summary by CodeRabbit