From 92b23400ce8162215a33d73730b6de08bc3757e1 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 19 Dec 2024 09:23:49 -0500 Subject: [PATCH 1/3] Disable debug+info logs by default for legacy mercury jobs (#15771) --- core/services/ocr2/delegate.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/services/ocr2/delegate.go b/core/services/ocr2/delegate.go index edcc816bf04..98f56d2a724 100644 --- a/core/services/ocr2/delegate.go +++ b/core/services/ocr2/delegate.go @@ -885,7 +885,8 @@ func (d *Delegate) newServicesMercury( lc.ContractConfigTrackerPollInterval = 1 * time.Second // This is the fastest that libocr supports. See: https://github.com/smartcontractkit/offchain-reporting/pull/520 - ocrLogger := ocrcommon.NewOCRWrapper(lggr, d.cfg.OCR2().TraceLogging(), func(ctx context.Context, msg string) { + // Disable OCR debug+info logging for legacy mercury jobs unless tracelogging is enabled, because its simply too verbose (150 jobs => ~50k logs per second) + ocrLogger := ocrcommon.NewOCRWrapper(llo.NewSuppressedLogger(lggr, d.cfg.OCR2().TraceLogging()), d.cfg.OCR2().TraceLogging(), func(ctx context.Context, msg string) { lggr.ErrorIf(d.jobORM.RecordError(ctx, jb.ID, msg), "unable to record error") }) From e716f6c50176c765704ea04b4b3771dd0539e4a8 Mon Sep 17 00:00:00 2001 From: Sam Davies Date: Thu, 19 Dec 2024 13:03:15 -0500 Subject: [PATCH 2/3] Fix restore of config in blue-green mode The OCR3 database must be scoped to each instance, not to the job, otherwise we can restore the wrong config on node restart. --- core/services/llo/delegate.go | 4 ++-- core/services/ocr2/delegate.go | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/core/services/llo/delegate.go b/core/services/llo/delegate.go index ba4ddbb8fb0..c5c44761ada 100644 --- a/core/services/llo/delegate.go +++ b/core/services/llo/delegate.go @@ -69,12 +69,12 @@ type DelegateConfig struct { // One Oracle will be started for each ContractConfigTracker ContractConfigTrackers []ocr2types.ContractConfigTracker ContractTransmitter ocr3types.ContractTransmitter[llotypes.ReportInfo] - Database ocr3types.Database OCR3MonitoringEndpoint ocrcommontypes.MonitoringEndpoint OffchainConfigDigester ocr2types.OffchainConfigDigester OffchainKeyring ocr2types.OffchainKeyring OnchainKeyring ocr3types.OnchainKeyring[llotypes.ReportInfo] LocalConfig ocr2types.LocalConfig + NewOCR3DB func(pluginID int32) ocr3types.Database } func NewDelegate(cfg DelegateConfig) (job.ServiceCtx, error) { @@ -146,7 +146,7 @@ func (d *delegate) Start(ctx context.Context) error { V2Bootstrappers: d.cfg.V2Bootstrappers, ContractConfigTracker: configTracker, ContractTransmitter: d.cfg.ContractTransmitter, - Database: d.cfg.Database, + Database: d.cfg.NewOCR3DB(int32(i)), LocalConfig: d.cfg.LocalConfig, Logger: ocrLogger, MonitoringEndpoint: d.cfg.OCR3MonitoringEndpoint, diff --git a/core/services/ocr2/delegate.go b/core/services/ocr2/delegate.go index 98f56d2a724..5e1f0534a91 100644 --- a/core/services/ocr2/delegate.go +++ b/core/services/ocr2/delegate.go @@ -1056,7 +1056,6 @@ func (d *Delegate) newServicesLLO( V2Bootstrappers: bootstrapPeers, ContractTransmitter: provider.ContractTransmitter(), ContractConfigTrackers: provider.ContractConfigTrackers(), - Database: ocrDB, LocalConfig: lc, OCR3MonitoringEndpoint: d.monitoringEndpointGen.GenMonitoringEndpoint(rid.Network, rid.ChainID, telemetryContractID, synchronization.OCR3Mercury), OffchainConfigDigester: provider.OffchainConfigDigester(), @@ -1065,6 +1064,9 @@ func (d *Delegate) newServicesLLO( // Enable verbose logging if either Mercury.VerboseLogging is on or OCR2.TraceLogging is on ReportingPluginConfig: datastreamsllo.Config{VerboseLogging: d.cfg.Mercury().VerboseLogging() || d.cfg.OCR2().TraceLogging()}, + NewOCR3DB: func(pluginID int32) ocr3types.Database { + return NewDB(d.ds, spec.ID, pluginID, lggr) + }, } oracle, err := llo.NewDelegate(cfg) if err != nil { From 40c7af28b0e04fa93f65757aa3fdd4b24f9b04b6 Mon Sep 17 00:00:00 2001 From: Sam Davies Date: Thu, 19 Dec 2024 13:03:15 -0500 Subject: [PATCH 3/3] disabling linter on database parameter --- core/services/llo/delegate.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/services/llo/delegate.go b/core/services/llo/delegate.go index c5c44761ada..0c7d539427e 100644 --- a/core/services/llo/delegate.go +++ b/core/services/llo/delegate.go @@ -146,7 +146,7 @@ func (d *delegate) Start(ctx context.Context) error { V2Bootstrappers: d.cfg.V2Bootstrappers, ContractConfigTracker: configTracker, ContractTransmitter: d.cfg.ContractTransmitter, - Database: d.cfg.NewOCR3DB(int32(i)), + Database: d.cfg.NewOCR3DB(int32(i)), // //nolint:gosec // G115 // impossible due to check on line 119 LocalConfig: d.cfg.LocalConfig, Logger: ocrLogger, MonitoringEndpoint: d.cfg.OCR3MonitoringEndpoint,