Skip to content

Commit

Permalink
feat: Agent Ping
Browse files Browse the repository at this point in the history
  • Loading branch information
xoscar committed Sep 13, 2023
1 parent 3957e6e commit a3cb68b
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 16 deletions.
2 changes: 2 additions & 0 deletions agent/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ func (c *Client) Start(ctx context.Context) error {
return err
}

c.startHearthBeat(ctx)

return nil
}

Expand Down
23 changes: 23 additions & 0 deletions agent/client/workflow_ping.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package client

import (
"context"
"fmt"
"time"

"github.com/kubeshop/tracetest/agent/proto"
)

func (c *Client) startHearthBeat(ctx context.Context) error {
client := proto.NewOrchestratorClient(c.conn)
ticker := time.NewTicker(2 * time.Second)

go func() {
for range ticker.C {
fmt.Println("@@PING")
client.Ping(ctx, c.sessionConfig.AgentIdentification)
}
}()

return nil
}
36 changes: 21 additions & 15 deletions agent/proto/orchestrator.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions agent/proto/orchestrator.proto
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ service Orchestrator {

// Register an agent to listen for shutdown commands
rpc RegisterShutdownListener(AgentIdentification) returns (stream ShutdownRequest) {}

// Ping is used to check if the agent is still connected
rpc Ping(AgentIdentification) returns (Empty) {}
}

// Empty message for endpoints that don't return anything
Expand Down
41 changes: 40 additions & 1 deletion agent/proto/orchestrator_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a3cb68b

Please sign in to comment.