@@ -782,8 +782,21 @@ func (api *API) workspaceAgentReportStats(rw http.ResponseWriter, r *http.Reques
782
782
return
783
783
}
784
784
785
+ api .Logger .Debug (ctx , "read stats report" ,
786
+ slog .F ("interval" , api .AgentStatsRefreshInterval ),
787
+ slog .F ("agent" , workspaceAgent .ID ),
788
+ slog .F ("workspace" , workspace .ID ),
789
+ slog .F ("payload" , req ),
790
+ )
791
+
785
792
activityBumpWorkspace (api .Logger .Named ("activity_bump" ), api .Database , workspace .ID )
786
793
794
+ payload , err := json .Marshal (req )
795
+ if err != nil {
796
+ api .Logger .Error (ctx , "marshal agent stats report" , slog .Error (err ))
797
+ payload = json .RawMessage ("{}" )
798
+ }
799
+
787
800
now := database .Now ()
788
801
_ , err = api .Database .InsertAgentStat (ctx , database.InsertAgentStatParams {
789
802
ID : uuid .New (),
@@ -792,7 +805,7 @@ func (api *API) workspaceAgentReportStats(rw http.ResponseWriter, r *http.Reques
792
805
WorkspaceID : workspace .ID ,
793
806
UserID : workspace .OwnerID ,
794
807
TemplateID : workspace .TemplateID ,
795
- Payload : json . RawMessage ( "{}" ) ,
808
+ Payload : payload ,
796
809
})
797
810
if err != nil {
798
811
httpapi .InternalServerError (rw , err )
0 commit comments