somewhat working ebpf bpftrace
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"time"
|
||||
|
||||
"nannyagentv2/internal/auth"
|
||||
"nannyagentv2/internal/logging"
|
||||
"nannyagentv2/internal/metrics"
|
||||
|
||||
"github.com/sashabaranov/go-openai"
|
||||
@@ -62,7 +63,7 @@ func NewInvestigationServer(agent *LinuxDiagnosticAgent, authManager *auth.AuthM
|
||||
agentID = id
|
||||
|
||||
} else {
|
||||
fmt.Printf("❌ Failed to get agent ID from auth manager: %v\n", err)
|
||||
logging.Error("Failed to get agent ID from auth manager: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,9 +118,9 @@ func (s *InvestigationServer) Start() error {
|
||||
// Start realtime polling for backend-initiated investigations
|
||||
if s.supabaseURL != "" && s.authManager != nil {
|
||||
go s.startRealtimePolling()
|
||||
fmt.Printf("🔄 Realtime investigation polling enabled\n")
|
||||
logging.Info("Realtime investigation polling enabled")
|
||||
} else {
|
||||
fmt.Printf("⚠️ Realtime investigation polling disabled (missing Supabase config or auth)\n")
|
||||
logging.Warning("Realtime investigation polling disabled (missing Supabase config or auth)")
|
||||
}
|
||||
|
||||
server := &http.Server{
|
||||
@@ -129,7 +130,7 @@ func (s *InvestigationServer) Start() error {
|
||||
WriteTimeout: 30 * time.Second,
|
||||
}
|
||||
|
||||
fmt.Printf("🔍 Investigation server started on port %s (Agent ID: %s)\n", s.port, s.agentID)
|
||||
logging.Info("Investigation server started on port %s (Agent ID: %s)", s.port, s.agentID)
|
||||
return server.ListenAndServe()
|
||||
}
|
||||
|
||||
@@ -221,7 +222,7 @@ func (s *InvestigationServer) sendCommandResultsToTensorZero(diagnosticResp Diag
|
||||
})
|
||||
|
||||
// Send to TensorZero via application agent's sendRequest method
|
||||
fmt.Printf("🔄 Sending command results to TensorZero for analysis...\n")
|
||||
logging.Debug("Sending command results to TensorZero for analysis")
|
||||
response, err := s.applicationAgent.sendRequest(messages)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to send request to TensorZero: %w", err)
|
||||
@@ -232,7 +233,7 @@ func (s *InvestigationServer) sendCommandResultsToTensorZero(diagnosticResp Diag
|
||||
}
|
||||
|
||||
content := response.Choices[0].Message.Content
|
||||
fmt.Printf("🤖 TensorZero continued analysis:\n%s\n", content)
|
||||
logging.Debug("TensorZero continued analysis: %s", content)
|
||||
|
||||
// Try to parse the response to determine if it's diagnostic or resolution
|
||||
var diagnosticNextResp DiagnosticResponse
|
||||
@@ -240,7 +241,7 @@ func (s *InvestigationServer) sendCommandResultsToTensorZero(diagnosticResp Diag
|
||||
|
||||
// Check if it's another diagnostic response
|
||||
if err := json.Unmarshal([]byte(content), &diagnosticNextResp); err == nil && diagnosticNextResp.ResponseType == "diagnostic" {
|
||||
fmt.Printf("🔄 TensorZero requests %d more commands\n", len(diagnosticNextResp.Commands))
|
||||
logging.Debug("TensorZero requests %d more commands", len(diagnosticNextResp.Commands))
|
||||
return map[string]interface{}{
|
||||
"type": "diagnostic",
|
||||
"response": diagnosticNextResp,
|
||||
@@ -295,7 +296,7 @@ func (s *InvestigationServer) handleInvestigation(w http.ResponseWriter, r *http
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Printf("📋 Received investigation payload with response_type: %s\n", responseType)
|
||||
logging.Debug("Received investigation payload with response_type: %s", responseType)
|
||||
|
||||
switch responseType {
|
||||
case "diagnostic":
|
||||
|
||||
Reference in New Issue
Block a user