11import json
2+ import os
23from pathlib import Path
34
45import yaml
1516class LogAnalysis (Step ):
1617 def __init__ (self , inputs : dict ):
1718 PatchflowProgressBar (self ).register_steps (
18- # CallSQL,
1919 AgenticLLMV2 ,
2020 )
2121 final_inputs = yaml .safe_load (_DEFAULT_INPUT_FILE .read_text ()) or dict ()
2222 final_inputs .update (inputs )
2323
2424 validate_steps_with_inputs (
2525 set (final_inputs .keys ()).union ({"" }),
26- # CallSQL,
2726 AgenticLLMV2 ,
2827 )
2928
3029 self .inputs = final_inputs
3130
3231 def run (self ) -> dict :
33- # output = CallSQL(self.inputs).run()
34- # self.inputs.update(output)
35-
36- log_filename = "gcp_logs.log"
37- sentry_filename = "sentry_issues.json"
3832 for i in range (self .inputs .get ("analysis_limit" ) or 5 ):
3933 # for i in range(self.inputs.get("log_finding_limit") or sys.maxsize):
4034 logs_detection_output = AgenticLLMV2 (
@@ -46,12 +40,9 @@ def run(self) -> dict:
4640Explore the logs and reply with the relevant logs position, the file path and line number.
4741""" ,
4842 user_prompt = f"""\
49- The log file { log_filename } from GCP and the sentry logs can be found at { sentry_filename } .
43+ Logs are uploaded to the current working directory at { os . getcwd () } .
5044
51- Here are some relevant information:
52- Custom Patchflow Id: 5826
53- Organisation Id: 301
54- Repository Id: 456
45+ { self .inputs .get ('query' )}
5546""" ,
5647 example_json = """
5748{
@@ -94,6 +85,7 @@ def run(self) -> dict:
9485 if analysis_output .get ("is_log_analysis_done" , False ):
9586 break
9687
97- logger .info (json .dumps (logs_detection_output ))
98- logger .info (json .dumps (analysis_output ))
88+ logger .info ("Log Analysis Complete" )
89+ logger .info ("Message:" )
90+ logger .info (json .dumps (analysis_output .get ("message" )))
9991 return dict ()
0 commit comments