88 "github.com/ethpandaops/assertoor/pkg/coordinator/clients"
99 "github.com/ethpandaops/assertoor/pkg/coordinator/clients/consensus/rpc"
1010 "github.com/ethpandaops/assertoor/pkg/coordinator/types"
11+ "github.com/ethpandaops/assertoor/pkg/coordinator/vars"
1112 "github.com/sirupsen/logrus"
1213)
1314
@@ -29,6 +30,14 @@ type Task struct {
2930 firstHeight map [uint16 ]uint64
3031}
3132
33+ type ClientInfo struct {
34+ Name string `json:"name"`
35+ Optimistic bool `json:"optimistic"`
36+ Synchronizing bool `json:"synchronizing"`
37+ SyncHead uint64 `json:"syncHead"`
38+ SyncDistance uint64 `json:"syncDistance"`
39+ }
40+
3241func NewTask (ctx * types.TaskContext , options * types.TaskOptions ) (types.Task , error ) {
3342 return & Task {
3443 ctx : ctx ,
@@ -87,7 +96,9 @@ func (t *Task) Execute(ctx context.Context) error {
8796
8897func (t * Task ) processCheck (ctx context.Context ) {
8998 allResultsPass := true
90- failedClients := []string {}
99+ goodClients := []* ClientInfo {}
100+ failedClients := []* ClientInfo {}
101+ failedClientNames := []string {}
91102
92103 for _ , client := range t .ctx .Scheduler .GetServices ().ClientPool ().GetClientsByNamePatterns (t .config .ClientPattern , "" ) {
93104 var checkResult bool
@@ -110,11 +121,26 @@ func (t *Task) processCheck(ctx context.Context) {
110121 if ! checkResult {
111122 allResultsPass = false
112123
113- failedClients = append (failedClients , client .Config .Name )
124+ failedClients = append (failedClients , t .getClientInfo (client , syncStatus ))
125+ failedClientNames = append (failedClientNames , client .Config .Name )
126+ } else {
127+ goodClients = append (goodClients , t .getClientInfo (client , syncStatus ))
114128 }
115129 }
116130
117- t .logger .Infof ("Check result: %v, Failed Clients: %v" , allResultsPass , failedClients )
131+ t .logger .Infof ("Check result: %v, Failed Clients: %v" , allResultsPass , failedClientNames )
132+
133+ if goodClientsData , err := vars .GeneralizeData (goodClients ); err == nil {
134+ t .ctx .Outputs .SetVar ("goodClients" , goodClientsData )
135+ } else {
136+ t .logger .Warnf ("Failed setting `goodClients` output: %v" , err )
137+ }
138+
139+ if failedClientsData , err := vars .GeneralizeData (failedClients ); err == nil {
140+ t .ctx .Outputs .SetVar ("failedClients" , failedClientsData )
141+ } else {
142+ t .logger .Warnf ("Failed setting `failedClients` output: %v" , err )
143+ }
118144
119145 if allResultsPass {
120146 t .ctx .SetResult (types .TaskResultSuccess )
@@ -162,3 +188,15 @@ func (t *Task) processClientCheck(client *clients.PoolClient, syncStatus *rpc.Sy
162188
163189 return true
164190}
191+
192+ func (t * Task ) getClientInfo (client * clients.PoolClient , syncStatus * rpc.SyncStatus ) * ClientInfo {
193+ clientInfo := & ClientInfo {
194+ Name : client .Config .Name ,
195+ Synchronizing : syncStatus .IsSyncing ,
196+ Optimistic : syncStatus .IsOptimistic ,
197+ SyncHead : syncStatus .HeadSlot ,
198+ SyncDistance : syncStatus .SyncDistance ,
199+ }
200+
201+ return clientInfo
202+ }
0 commit comments