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

Function findAPIProxyEventsFile

pkg/cli/token_usage.go:778–803  ·  view source on GitHub ↗
(runDir string)

Source from the content-addressed store, hash-verified

776}
777
778func findAPIProxyEventsFile(runDir string) string {
779 primary := filepath.Join(runDir, "sandbox", "firewall", "logs", proxyEventsJSONLPath)
780 if fileutil.FileExists(primary) {
781 return primary
782 }
783
784 entries, err := os.ReadDir(runDir)
785 if err != nil {
786 return ""
787 }
788
789 for _, entry := range entries {
790 if !entry.IsDir() {
791 continue
792 }
793 name := entry.Name()
794 if strings.HasPrefix(name, "firewall-audit-logs") || strings.HasPrefix(name, "firewall-logs") {
795 candidate := filepath.Join(runDir, name, proxyEventsJSONLPath)
796 if fileutil.FileExists(candidate) {
797 return candidate
798 }
799 }
800 }
801
802 return ""
803}
804
805// proxyEventsEntry is a JSONL record from api-proxy-logs/events.jsonl.
806// The event name appears under one of four field names depending on the proxy version;

Callers 2

Calls 1

FileExistsFunction · 0.92

Tested by

no test coverage detected