diff --git a/pkg/agent/agent.go b/pkg/agent/agent.go index 8cf1f33..2239bf0 100644 --- a/pkg/agent/agent.go +++ b/pkg/agent/agent.go @@ -187,12 +187,13 @@ func (a *Agent) heartbeatRoutine() { for { select { case <-ticker.C: - log.Printf("Sending heartbeat to proxy") heartbeat := payloads.AgentHeartbeatJson{ - Type: payloads.AgentHeartbeatJsonTypeClientHeartbeat, - Timestamp: []time.Time{time.Now()}[0], + Type: payloads.AgentHeartbeatJsonTypeAgentHeartbeat, + Timestamp: time.Now().Format(time.RFC3339), } + log.Printf("Sending heartbeat to proxy: %+v", heartbeat) + data, err := json.Marshal(heartbeat) if err != nil { log.Printf("Error marshaling heartbeat: %v", err) diff --git a/pkg/payloads/agent_heartbeat_generated.go b/pkg/payloads/agent_heartbeat_generated.go index 8967816..78cb9c5 100644 --- a/pkg/payloads/agent_heartbeat_generated.go +++ b/pkg/payloads/agent_heartbeat_generated.go @@ -5,19 +5,19 @@ package payloads import "encoding/json" import "fmt" import "reflect" -import "time" + type AgentHeartbeatJson struct { // Timestamp of the heartbeat - Timestamp time.Time `json:"timestamp" yaml:"timestamp" mapstructure:"timestamp"` + Timestamp string `json:"timestamp" yaml:"timestamp" mapstructure:"timestamp"` - // Type of payload - must be client.heartbeat + // Type of payload - must be agent.heartbeat Type AgentHeartbeatJsonType `json:"type" yaml:"type" mapstructure:"type"` } type AgentHeartbeatJsonType string -const AgentHeartbeatJsonTypeClientHeartbeat AgentHeartbeatJsonType = "client.heartbeat" +const AgentHeartbeatJsonTypeAgentHeartbeat AgentHeartbeatJsonType = "agent.heartbeat" var enumValues_AgentHeartbeatJsonType = []interface{}{ "agent.heartbeat",