Skip to content

Commit

Permalink
Feat(agent): Ping Method (#3154)
Browse files Browse the repository at this point in the history
* feat(cli): using the UIs version endpoint

* feat(cli): adding support for org and env id as flags

* feat: Agent Ping

* cleanup
  • Loading branch information
xoscar committed Sep 15, 2023
1 parent b957a39 commit 05bd2df
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 16 deletions.
2 changes: 2 additions & 0 deletions agent/client/client.go
Expand Up @@ -61,6 +61,8 @@ func (c *Client) Start(ctx context.Context) error {
return err
}

c.startHearthBeat(ctx)

return nil
}

Expand Down
21 changes: 21 additions & 0 deletions agent/client/workflow_ping.go
@@ -0,0 +1,21 @@
package client

import (
"context"
"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.Minute)

go func() {
for range ticker.C {
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
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 05bd2df

Please sign in to comment.