From 59009f128223b172783dca2cd4bf683a39c717e1 Mon Sep 17 00:00:00 2001 From: Connor Stein Date: Mon, 22 Jan 2024 13:00:03 -0500 Subject: [PATCH] Log observations in report (#454) --- core/services/ocr2/plugins/ccip/observations.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/services/ocr2/plugins/ccip/observations.go b/core/services/ocr2/plugins/ccip/observations.go index 7c1381e1ed..f7a298469b 100644 --- a/core/services/ocr2/plugins/ccip/observations.go +++ b/core/services/ocr2/plugins/ccip/observations.go @@ -4,6 +4,8 @@ import ( "encoding/json" "math/big" + "github.com/smartcontractkit/libocr/commontypes" + "github.com/ethereum/go-ethereum/common" "github.com/smartcontractkit/libocr/offchainreporting2plus/types" @@ -71,19 +73,22 @@ func (o ExecutionObservation) Marshal() ([]byte, error) { // malformed observations but never error. func GetParsableObservations[O CommitObservation | ExecutionObservation](l logger.Logger, observations []types.AttributedObservation) []O { var parseableObservations []O + var observers []commontypes.OracleID for _, ao := range observations { if len(ao.Observation) == 0 { // Empty observation - l.Infow("Discarded empty observation %+v", ao) + l.Infow("Discarded empty observation", "observer", ao.Observer) continue } var ob O err := json.Unmarshal(ao.Observation, &ob) if err != nil { - l.Errorw("Received unmarshallable observation", "err", err, "observation", string(ao.Observation)) + l.Errorw("Received unmarshallable observation", "err", err, "observation", string(ao.Observation), "observer", ao.Observer) continue } parseableObservations = append(parseableObservations, ob) + observers = append(observers, ao.Observer) } + l.Infow("Parsed observations", "observers", observers, "observations", parseableObservations) return parseableObservations }