-
Notifications
You must be signed in to change notification settings - Fork 308
Fix log analyzer path mismatches after artifact download #14660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -311,7 +311,19 @@ func analyzeFirewallLogs(runDir string, verbose bool) (*FirewallAnalysis, error) | |||||||||
| // Look for firewall logs in the run directory | ||||||||||
| // The logs could be in several locations depending on how they were uploaded | ||||||||||
|
|
||||||||||
| // First, check for directories starting with squid-logs or firewall-logs | ||||||||||
| // First, check for sandbox/firewall/logs/ directory (new path after artifact download) | ||||||||||
| // Firewall logs are uploaded from /tmp/gh-aw/sandbox/firewall/logs/ and the common parent | ||||||||||
| // /tmp/gh-aw/ is stripped during artifact upload, resulting in sandbox/firewall/logs/ after download | ||||||||||
| sandboxFirewallLogsDir := filepath.Join(runDir, "sandbox", "firewall", "logs") | ||||||||||
| if _, err := os.Stat(sandboxFirewallLogsDir); err == nil { | ||||||||||
| firewallLogLog.Printf("Found firewall logs directory: sandbox/firewall/logs") | ||||||||||
| if verbose { | ||||||||||
| fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Found firewall logs directory: sandbox/firewall/logs")) | ||||||||||
| } | ||||||||||
| return analyzeMultipleFirewallLogs(sandboxFirewallLogsDir, verbose) | ||||||||||
|
||||||||||
| return analyzeMultipleFirewallLogs(sandboxFirewallLogsDir, verbose) | |
| // Use sandbox/firewall/logs as the run directory so that the existing | |
| // per-file filtering logic below (which excludes access-*.log) is applied. | |
| runDir = sandboxFirewallLogsDir |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,12 +80,21 @@ type GatewayMetrics struct { | |
|
|
||
| // parseGatewayLogs parses a gateway.jsonl file and extracts metrics | ||
| func parseGatewayLogs(logDir string, verbose bool) (*GatewayMetrics, error) { | ||
| // Try root directory first (for older logs where gateway.jsonl was in the root) | ||
| gatewayLogPath := filepath.Join(logDir, "gateway.jsonl") | ||
|
|
||
| // Check if gateway.jsonl exists | ||
| // Check if gateway.jsonl exists in root | ||
| if _, err := os.Stat(gatewayLogPath); os.IsNotExist(err) { | ||
| gatewayLogsLog.Printf("gateway.jsonl not found at: %s", gatewayLogPath) | ||
| return nil, fmt.Errorf("gateway.jsonl not found") | ||
| // Try mcp-logs subdirectory (new path after artifact download) | ||
| // Gateway logs are uploaded from /tmp/gh-aw/mcp-logs/gateway.jsonl and the common parent | ||
| // /tmp/gh-aw/ is stripped during artifact upload, resulting in mcp-logs/gateway.jsonl after download | ||
| mcpLogsPath := filepath.Join(logDir, "mcp-logs", "gateway.jsonl") | ||
| if _, err := os.Stat(mcpLogsPath); os.IsNotExist(err) { | ||
| gatewayLogsLog.Printf("gateway.jsonl not found at: %s or %s", gatewayLogPath, mcpLogsPath) | ||
| return nil, fmt.Errorf("gateway.jsonl not found") | ||
| } | ||
| gatewayLogPath = mcpLogsPath | ||
| gatewayLogsLog.Printf("Found gateway.jsonl in mcp-logs subdirectory") | ||
| } | ||
|
Comment on lines
+83
to
98
|
||
|
|
||
| gatewayLogsLog.Printf("Parsing gateway.jsonl from: %s", gatewayLogPath) | ||
|
|
@@ -399,7 +408,19 @@ func extractMCPToolUsageData(logDir string, verbose bool) (*MCPToolUsageData, er | |
| } | ||
|
|
||
| // Read gateway.jsonl again to get individual tool call records | ||
| // Try root directory first (for older logs where gateway.jsonl was in the root) | ||
| gatewayLogPath := filepath.Join(logDir, "gateway.jsonl") | ||
|
|
||
| // Check if gateway.jsonl exists in root | ||
| if _, err := os.Stat(gatewayLogPath); os.IsNotExist(err) { | ||
| // Try mcp-logs subdirectory (new path after artifact download) | ||
| mcpLogsPath := filepath.Join(logDir, "mcp-logs", "gateway.jsonl") | ||
| if _, err := os.Stat(mcpLogsPath); os.IsNotExist(err) { | ||
| return nil, fmt.Errorf("gateway.jsonl not found") | ||
| } | ||
| gatewayLogPath = mcpLogsPath | ||
| } | ||
|
Comment on lines
410
to
+422
|
||
|
|
||
| file, err := os.Open(gatewayLogPath) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to open gateway.jsonl: %w", err) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function header comment above still says firewall logs are stored under /tmp/gh-aw/squid-logs-{workflow-name}/, but this function now prefers /tmp/gh-aw/sandbox/firewall/logs/ (downloaded as sandbox/firewall/logs/). Update the comment to describe both layouts (legacy squid-logs* and the sandbox/firewall/logs path) so future readers don’t assume only the legacy structure exists.