Skip to content

Commit

Permalink
Code review rework
Browse files Browse the repository at this point in the history
  • Loading branch information
bruce-riley committed Aug 22, 2024
1 parent 59d9801 commit b354228
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
6 changes: 5 additions & 1 deletion fly/cmd/heartbeats/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,11 @@ func main() {
if handleObsv(uint(idx)) {
obsvRateTable.ResetRows()
for i := 0; i < numGuardians; i++ {
obsvRateTable.AppendRow(table.Row{i, obsvRateRows[int(i)].guardianName, obsvRateRows[int(i)].obsvCount, obsvRateRows[uint(i)].percents[0], obsvRateRows[uint(i)].percents[1], obsvRateRows[uint(i)].percents[2], obsvRateRows[uint(i)].percents[3], obsvRateRows[uint(i)].percents[4], obsvRateRows[uint(i)].percents[5], obsvRateRows[uint(i)].percents[6], obsvRateRows[uint(i)].percents[7], obsvRateRows[uint(i)].percents[8], obsvRateRows[uint(i)].percents[9]})
obsvRateTable.AppendRow(table.Row{i, obsvRateRows[int(i)].guardianName, obsvRateRows[int(i)].obsvCount,
obsvRateRows[uint(i)].percents[0], obsvRateRows[uint(i)].percents[1], obsvRateRows[uint(i)].percents[2],
obsvRateRows[uint(i)].percents[3], obsvRateRows[uint(i)].percents[4], obsvRateRows[uint(i)].percents[5],
obsvRateRows[uint(i)].percents[6], obsvRateRows[uint(i)].percents[7], obsvRateRows[uint(i)].percents[8],
obsvRateRows[uint(i)].percents[9]})
}
}
gossipCounter[idx][GSM_signedObservation]++
Expand Down
2 changes: 0 additions & 2 deletions fly/cmd/observation_stats/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ func main() {
case o := <-obsvC: // TODO: Rip out this code once we cut over to batching.
if o.Msg.MessageId[:3] != "26/" && o.Msg.MessageId[:2] != "7/" {
ga := eth_common.BytesToAddress(o.Msg.Addr).String()
// logger.Warn("observation", zap.String("id",o.MessageId), zap.String("addr",ga))
if _, ok := obsvByHash[o.Msg.MessageId]; !ok {
obsvByHash[o.Msg.MessageId] = map[string]time.Time{}
}
Expand All @@ -109,7 +108,6 @@ func main() {
for _, o := range batch.Msg.Observations {
if o.MessageId[:3] != "26/" && o.MessageId[:2] != "7/" {
ga := eth_common.BytesToAddress(batch.Msg.Addr).String()
// logger.Warn("observation", zap.String("id",o.MessageId), zap.String("addr",ga))
if _, ok := obsvByHash[o.MessageId]; !ok {
obsvByHash[o.MessageId] = map[string]time.Time{}
}
Expand Down
11 changes: 7 additions & 4 deletions fly/cmd/prom_gossip/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,17 +272,20 @@ func main() {
}
uniqueObs[hash] = time.Now()
case batch := <-batchObsvC:
gossipByType.WithLabelValues("batch_observation").Inc()
addr := "0x" + string(hex.EncodeToString(batch.Msg.Addr))
name := addr
idx, found := guardianIndexMap[strings.ToLower(addr)]
if found {
name = guardianIndexToNameMap[idx]
}
for _, o := range batch.Msg.Observations {
gossipByType.WithLabelValues("observation").Inc()
spl := strings.Split(o.MessageId, "/")
chain, err := parseChainID(spl[0])
if err != nil {
chain = vaa.ChainIDUnset
}
emitter := strings.ToLower(spl[1])
addr := "0x" + string(hex.EncodeToString(batch.Msg.Addr))
idx := guardianIndexMap[strings.ToLower(addr)]
name := guardianIndexToNameMap[idx]
observationsByGuardianPerChain.WithLabelValues(name, chain.String()).Inc()
if knownEmitters[emitter] {
tbObservationsByGuardianPerChain.WithLabelValues(name, chain.String()).Inc()
Expand Down

0 comments on commit b354228

Please sign in to comment.