Skip to content

Commit

Permalink
More logging
Browse files Browse the repository at this point in the history
  • Loading branch information
samsondav committed Nov 13, 2024
1 parent 9a09b83 commit c005634
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion core/services/llo/delegate.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func (d *delegate) Start(ctx context.Context) error {
OffchainKeyring: d.cfg.OffchainKeyring,
OnchainKeyring: d.cfg.OnchainKeyring,
ReportingPluginFactory: datastreamsllo.NewPluginFactory(
d.cfg.ReportingPluginConfig, psrrc, d.src, d.cfg.RetirementReportCodec, d.cfg.ChannelDefinitionCache, d.ds, logger.Named(lggr, "LLOReportingPlugin"), llo.EVMOnchainConfigCodec{}, d.reportCodecs,
d.cfg.ReportingPluginConfig, psrrc, d.src, d.cfg.RetirementReportCodec, d.cfg.ChannelDefinitionCache, d.ds, logger.Named(lggr, "ReportingPlugin"), llo.EVMOnchainConfigCodec{}, d.reportCodecs,
),
MetricsRegisterer: prometheus.WrapRegistererWith(map[string]string{"job_name": d.cfg.JobName.ValueOrZero()}, prometheus.DefaultRegisterer),
})
Expand Down
3 changes: 3 additions & 0 deletions core/services/llo/evm/report_codec_premium_legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ func (r ReportCodecPremiumLegacy) Encode(ctx context.Context, report llo.Report,
multiplier = decimal.NewFromBigInt(opts.Multiplier.ToInt(), 0)
}

// TODO: Hide behind VerboseLogging flag (or remove entirely)
r.Logger.Debugw("Encoding report", "report", report, "opts", opts, "nativePrice", nativePrice, "linkPrice", linkPrice, "quote", quote, "multiplier", multiplier)

codec := reportcodecv3.NewReportCodec(opts.FeedID, r.Logger)

rf := v3.ReportFields{
Expand Down
3 changes: 2 additions & 1 deletion core/services/llo/evm/report_codec_premium_legacy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/smartcontractkit/libocr/offchainreporting2plus/types"

"github.com/smartcontractkit/chainlink-common/pkg/utils/tests"
"github.com/smartcontractkit/chainlink/v2/core/logger"
reporttypes "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury/v3/types"

llotypes "github.com/smartcontractkit/chainlink-common/pkg/types/llo"
Expand All @@ -32,7 +33,7 @@ func newValidPremiumLegacyReport() llo.Report {
}

func Test_ReportCodecPremiumLegacy(t *testing.T) {
rc := ReportCodecPremiumLegacy{}
rc := ReportCodecPremiumLegacy{logger.TestLogger(t)}

feedID := [32]uint8{0x1, 0x2, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}
cd := llotypes.ChannelDefinition{Opts: llotypes.ChannelOpts(fmt.Sprintf(`{"baseUSDFee":"10.50","expirationWindow":60,"feedId":"0x%x","multiplier":10}`, feedID))}
Expand Down
6 changes: 3 additions & 3 deletions core/services/llo/mercurytransmitter/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func (s *server) runQueueLoop(stopCh services.StopChan, wg *sync.WaitGroup, donI
if res.Error == "" {
s.transmitSuccessCount.Inc()
// TODO: This should be behind a "VerboseLogging" flag
s.lggr.Debugw("Transmit report success", "req", req, "transmission", t, "response", res)
s.lggr.Debugw("Transmit report success", "req", fmt.Sprintf("0x%x", req), "transmission", t, "response", res)
} else {
// We don't need to retry here because the mercury server
// has confirmed it received the report. We only need to retry
Expand All @@ -200,10 +200,10 @@ func (s *server) runQueueLoop(stopCh services.StopChan, wg *sync.WaitGroup, donI
case DuplicateReport:
s.transmitSuccessCount.Inc()
s.transmitDuplicateCount.Inc()
s.lggr.Debugw("Transmit report success; duplicate report", "req", req, "transmission", t, "response", res)
s.lggr.Debugw("Transmit report success; duplicate report", "req.ReportFormat", req.ReportFormat, "req.Payload", fmt.Sprintf("0x%x", req.Payload), "transmission", t, "response", res)
default:
transmitServerErrorCount.WithLabelValues(donIDStr, s.url, fmt.Sprintf("%d", res.Code)).Inc()
s.lggr.Errorw("Transmit report failed; mercury server returned error", "req", req, "response", res, "transmission", t, "err", res.Error, "code", res.Code)
s.lggr.Errorw("Transmit report failed; mercury server returned error", "req.ReportFormat", req.ReportFormat, "req.Payload", fmt.Sprintf("0x%x", req.Payload), "response", res, "transmission", t, "err", res.Error, "code", res.Code)
}
}

Expand Down

0 comments on commit c005634

Please sign in to comment.