mirror of
https://github.com/Pythagora-io/gpt-pilot.git
synced 2026-01-08 12:53:50 -05:00
add more telemetry data
This commit is contained in:
@@ -196,7 +196,14 @@ class Developer(BaseAgent):
|
||||
self.next_state.modified_files = {}
|
||||
self.set_next_steps(response, source)
|
||||
self.next_state.action = f"Task #{current_task_index + 1} start"
|
||||
await telemetry.trace_code_event("task-start", {"task-num": current_task_index + 1})
|
||||
await telemetry.trace_code_event(
|
||||
"task-start",
|
||||
{
|
||||
"task_index": current_task_index + 1,
|
||||
"num_tasks": len(self.current_state.tasks),
|
||||
"num_epics": len(self.current_state.epics),
|
||||
},
|
||||
)
|
||||
return AgentResponse.done(self)
|
||||
|
||||
async def get_relevant_files(
|
||||
|
||||
@@ -27,7 +27,13 @@ class TaskCompleter(BaseAgent):
|
||||
tasks,
|
||||
)
|
||||
await telemetry.trace_code_event(
|
||||
"task-end", {"task-num": current_task_index1, "num-iterations": len(self.current_state.iterations)}
|
||||
"task-end",
|
||||
{
|
||||
"task_index": current_task_index1,
|
||||
"num_tasks": len(self.current_state.tasks),
|
||||
"num_epics": len(self.current_state.epics),
|
||||
"num_iterations": len(self.current_state.iterations),
|
||||
},
|
||||
)
|
||||
|
||||
return AgentResponse.done(self)
|
||||
|
||||
@@ -155,7 +155,13 @@ class TechLead(BaseAgent):
|
||||
}
|
||||
for task in response.plan
|
||||
]
|
||||
await telemetry.trace_code_event("development-plan", {"num-tasks": len(response.plan)})
|
||||
await telemetry.trace_code_event(
|
||||
"development-plan",
|
||||
{
|
||||
"num_tasks": len(self.current_state.tasks),
|
||||
"num_epics": len(self.current_state.epics),
|
||||
},
|
||||
)
|
||||
return AgentResponse.done(self)
|
||||
|
||||
async def update_epic(self) -> AgentResponse:
|
||||
|
||||
@@ -182,7 +182,21 @@ class Troubleshooter(IterationPromptMixin, BaseAgent):
|
||||
return False, False, ""
|
||||
|
||||
if user_response.button == "loop":
|
||||
await telemetry.trace_code_event("stuck-in-loop", {"clicked": True})
|
||||
await telemetry.trace_code_event(
|
||||
"stuck-in-loop",
|
||||
{
|
||||
"clicked": True,
|
||||
"task_index": self.current_state.tasks.index(self.current_state.current_task) + 1,
|
||||
"num_tasks": len(self.current_state.tasks),
|
||||
"num_epics": len(self.current_state.epics),
|
||||
"num_iterations": len(self.current_state.iterations),
|
||||
"num_steps": len(self.current_state.steps),
|
||||
"architecture": {
|
||||
"system_dependencies": self.current_state.specification.system_dependencies,
|
||||
"app_dependencies": self.current_state.specification.package_dependencies,
|
||||
},
|
||||
},
|
||||
)
|
||||
return True, True, ""
|
||||
|
||||
return True, False, user_response.text
|
||||
|
||||
@@ -368,8 +368,9 @@ class Telemetry:
|
||||
if not self.enabled or getenv("DISABLE_TELEMETRY"):
|
||||
return
|
||||
|
||||
if not data.get("app_id") and self.data["app_id"]:
|
||||
data = {**data, "app_id": self.data["app_id"]}
|
||||
data = deepcopy(data)
|
||||
for item in ["app_id", "user_contact", "platform", "pilot_version", "model"]:
|
||||
data[item] = self.data[item]
|
||||
|
||||
payload = {
|
||||
"pathId": self.telemetry_id,
|
||||
@@ -377,13 +378,13 @@ class Telemetry:
|
||||
"data": data,
|
||||
}
|
||||
|
||||
log.debug(f"Sending trace event {name} to {self.endpoint}")
|
||||
log.debug(f"Sending trace event {name} to {self.endpoint}: {repr(payload)}")
|
||||
|
||||
try:
|
||||
async with httpx.AsyncClient() as client:
|
||||
await client.post(self.endpoint, json=payload)
|
||||
except httpx.RequestError:
|
||||
pass
|
||||
except httpx.RequestError as e:
|
||||
log.error(f"Failed to send trace event {name}: {e}", exc_info=True)
|
||||
|
||||
async def trace_loop(self, name: str, task_with_loop: dict):
|
||||
payload = deepcopy(self.data)
|
||||
|
||||
Reference in New Issue
Block a user