MCPcopy Create free account
hub / github.com/github/gh-aw / inferFallbackLogMetrics

Function inferFallbackLogMetrics

pkg/cli/audit_expanded.go:170–190  ·  view source on GitHub ↗
(logsPath string)

Source from the content-addressed store, hash-verified

168}
169
170func inferFallbackLogMetrics(logsPath string) (LogMetrics, string) {
171 if logsPath == "" {
172 return LogMetrics{}, ""
173 }
174
175 if eventsJSONLPath := findEventsJSONLFile(logsPath); eventsJSONLPath != "" {
176 if metrics, err := parseEventsJSONLMetrics(eventsJSONLPath, false); err == nil && hasUsefulFallbackMetrics(metrics) {
177 return metrics, "copilot"
178 }
179 }
180
181 agentLogPath := findAgentStdioLogPath(logsPath)
182 if agentLogPath == "" {
183 return LogMetrics{}, ""
184 }
185 content, err := os.ReadFile(agentLogPath)
186 if err != nil {
187 return LogMetrics{}, ""
188 }
189 return inferBestEngineMetricsFromContent(string(content))
190}
191
192func findAgentStdioLogPath(logsPath string) string {
193 root := filepath.Join(logsPath, "agent-stdio.log")

Calls 5

findEventsJSONLFileFunction · 0.85
parseEventsJSONLMetricsFunction · 0.85
hasUsefulFallbackMetricsFunction · 0.85
findAgentStdioLogPathFunction · 0.85