Skip to content

Commit

Permalink
core/services: log ocr2 job type (#16004)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmank88 authored Jan 21, 2025
1 parent f367549 commit 8a4355c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 23 deletions.
6 changes: 1 addition & 5 deletions core/services/job/kv_orm.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"time"

"github.com/smartcontractkit/chainlink-common/pkg/sqlutil"
"github.com/smartcontractkit/chainlink/v2/core/logger"
)

// KVStore is a simple KV store that can store and retrieve serializable data.
Expand All @@ -18,17 +17,14 @@ type KVStore interface {
type kVStore struct {
jobID int32
ds sqlutil.DataSource
lggr logger.SugaredLogger
}

var _ KVStore = (*kVStore)(nil)

func NewKVStore(jobID int32, ds sqlutil.DataSource, lggr logger.Logger) kVStore {
namedLogger := logger.Sugared(lggr.Named("JobORM"))
func NewKVStore(jobID int32, ds sqlutil.DataSource) kVStore {
return kVStore{
jobID: jobID,
ds: ds,
lggr: namedLogger,
}
}

Expand Down
4 changes: 1 addition & 3 deletions core/services/job/kv_orm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@ func TestJobKVStore(t *testing.T) {
config := configtest.NewTestGeneralConfig(t)
db := pgtest.NewSqlxDB(t)

lggr := logger.TestLogger(t)

pipelineORM := pipeline.NewORM(db, logger.TestLogger(t), config.JobPipeline().MaxSuccessfulRuns())
bridgesORM := bridges.NewORM(db)

jobID := int32(1337)
kvStore := job.NewKVStore(jobID, db, lggr)
kvStore := job.NewKVStore(jobID, db)
jobORM := NewTestORM(t, db, pipelineORM, bridgesORM, cltest.NewKeyStore(t, db))

jb, err := directrequest.ValidatedDirectRequestSpec(testspecs.GetDirectRequestSpec())
Expand Down
26 changes: 12 additions & 14 deletions core/services/ocr2/delegate.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,17 @@ import (
"strings"
"time"

"gopkg.in/guregu/null.v4"

cciptypes "github.com/smartcontractkit/chainlink-common/pkg/types/ccip"
"github.com/smartcontractkit/chainlink-common/pkg/types/core"

"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/config"

"github.com/ethereum/go-ethereum/common"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"google.golang.org/grpc"
"gopkg.in/guregu/null.v4"

chainselectors "github.com/smartcontractkit/chain-selectors"
"github.com/smartcontractkit/libocr/commontypes"
libocr2 "github.com/smartcontractkit/libocr/offchainreporting2plus"
"github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types"
ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types"
"google.golang.org/grpc"

ocr2keepers20 "github.com/smartcontractkit/chainlink-automation/pkg/v2"
ocr2keepers20config "github.com/smartcontractkit/chainlink-automation/pkg/v2/config"
Expand All @@ -35,14 +29,18 @@ import (
ocr2keepers20runner "github.com/smartcontractkit/chainlink-automation/pkg/v2/runner"
ocr2keepers21config "github.com/smartcontractkit/chainlink-automation/pkg/v3/config"
ocr2keepers21 "github.com/smartcontractkit/chainlink-automation/pkg/v3/plugin"

"github.com/smartcontractkit/chainlink-common/pkg/loop"
"github.com/smartcontractkit/chainlink-common/pkg/loop/reportingplugins"
"github.com/smartcontractkit/chainlink-common/pkg/loop/reportingplugins/ocr3"
"github.com/smartcontractkit/chainlink-common/pkg/sqlutil"
"github.com/smartcontractkit/chainlink-common/pkg/types"
cciptypes "github.com/smartcontractkit/chainlink-common/pkg/types/ccip"
"github.com/smartcontractkit/chainlink-common/pkg/types/core"
llotypes "github.com/smartcontractkit/chainlink-common/pkg/types/llo"
"github.com/smartcontractkit/chainlink-common/pkg/utils/mailbox"
datastreamsllo "github.com/smartcontractkit/chainlink-data-streams/llo"

"github.com/smartcontractkit/chainlink/v2/core/bridges"
"github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm"
coreconfig "github.com/smartcontractkit/chainlink/v2/core/config"
Expand All @@ -52,15 +50,17 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/services/keystore"
"github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ocr2key"
"github.com/smartcontractkit/chainlink/v2/core/services/llo"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/ccipcommit"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/ccipexec"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/config"
ccipconfig "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/config"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/functions"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/generic"
lloconfig "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/llo/config"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/median"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/mercury"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2keeper"

"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/autotelemetry21"
ocr2keeper21core "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/core"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/validate"
Expand All @@ -76,8 +76,6 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/services/synchronization"
"github.com/smartcontractkit/chainlink/v2/core/services/telemetry"
"github.com/smartcontractkit/chainlink/v2/plugins"

ccipconfig "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/config"
)

type ErrJobSpecNoRelayer struct {
Expand Down Expand Up @@ -430,9 +428,9 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, jb job.Job) ([]job.Servi
lggrCtx.FeedID = *spec.FeedID
spec.RelayConfig["feedID"] = spec.FeedID
}
lggr := logger.Sugared(d.lggr.Named(jb.ExternalJobID.String()).With(lggrCtx.Args()...))
lggr := logger.Sugared(d.lggr.Named(string(jb.Type)).Named(jb.ExternalJobID.String()).With(lggrCtx.Args()...))

kvStore := job.NewKVStore(jb.ID, d.ds, lggr)
kvStore := job.NewKVStore(jb.ID, d.ds)

rid, err := spec.RelayID()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion core/services/standardcapabilities/delegate.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (d *Delegate) BeforeJobCreated(job job.Job) {
func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) ([]job.ServiceCtx, error) {
log := d.logger.Named("StandardCapabilities").Named(spec.StandardCapabilitiesSpec.GetID())

kvStore := job.NewKVStore(spec.ID, d.ds, log)
kvStore := job.NewKVStore(spec.ID, d.ds)
telemetryService := generic.NewTelemetryAdapter(d.monitoringEndpointGen)
errorLog := &ErrorLog{jobID: spec.ID, recordError: d.jobORM.RecordError}
pr := generic.NewPipelineRunnerAdapter(log, spec, d.pipelineRunner)
Expand Down

0 comments on commit 8a4355c

Please sign in to comment.