Skip to content

Commit

Permalink
Post review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusz-sekara committed Oct 13, 2023
1 parent b8ff6fd commit 9957af0
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions core/services/ocr2/plugins/ccip/commit_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ func jobSpecToCommitPluginConfig(lggr logger.Logger, jb job.Job, pr pipeline.Run
}

// Prom wrappers
onRampReader = observability.NewObservedOnRampReader(onRampReader, chainId, CommitPluginLabel)
offRampReader = observability.NewObservedOffRampReader(offRampReader, chainId, CommitPluginLabel)
commitStoreReader = observability.NewObservedCommitStoreReader(commitStoreReader, chainId, CommitPluginLabel)
onRampReader = observability.NewObservedOnRampReader(onRampReader, int64(chainId), CommitPluginLabel)
offRampReader = observability.NewObservedOffRampReader(offRampReader, destChainID, CommitPluginLabel)
commitStoreReader = observability.NewObservedCommitStoreReader(commitStoreReader, destChainID, CommitPluginLabel)

lggr.Infow("NewCommitServices",
"pluginConfig", pluginConfig,
Expand Down
2 changes: 1 addition & 1 deletion core/services/ocr2/plugins/ccip/commit_reporting_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (rf *CommitReportingPluginFactory) UpdateDynamicReaders(newPriceRegAddr com
if err != nil {
return err
}
destPriceRegistryReader = observability.NewPriceRegistryReader(destPriceRegistryReader, rf.config.destClient.ConfiguredChainID().Uint64(), CommitPluginLabel)
destPriceRegistryReader = observability.NewPriceRegistryReader(destPriceRegistryReader, rf.config.destClient.ConfiguredChainID().Int64(), CommitPluginLabel)
rf.destPriceRegReader = destPriceRegistryReader
rf.destPriceRegAddr = newPriceRegAddr
return nil
Expand Down
8 changes: 4 additions & 4 deletions core/services/ocr2/plugins/ccip/execution_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ func jobSpecToExecPluginConfig(lggr logger.Logger, jb job.Job, chainSet evm.Lega
}

// Prom wrappers
commitStoreReader = observability.NewObservedCommitStoreReader(commitStoreReader, chainId, ExecPluginLabel)
onRampReader = observability.NewObservedOnRampReader(onRampReader, chainId, ExecPluginLabel)
offRampReader = observability.NewObservedOffRampReader(offRampReader, chainId, ExecPluginLabel)
sourcePriceRegistry = observability.NewPriceRegistryReader(sourcePriceRegistry, chainId, ExecPluginLabel)
onRampReader = observability.NewObservedOnRampReader(onRampReader, int64(chainId), ExecPluginLabel)
sourcePriceRegistry = observability.NewPriceRegistryReader(sourcePriceRegistry, int64(chainId), ExecPluginLabel)
commitStoreReader = observability.NewObservedCommitStoreReader(commitStoreReader, destChainID, ExecPluginLabel)
offRampReader = observability.NewObservedOffRampReader(offRampReader, destChainID, ExecPluginLabel)

execLggr.Infow("Initialized exec plugin",
"pluginConfig", pluginConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func (rf *ExecutionReportingPluginFactory) UpdateDynamicReaders(newPriceRegAddr
if err != nil {
return err
}
destPriceRegistryReader = observability.NewPriceRegistryReader(destPriceRegistryReader, rf.config.destClient.ConfiguredChainID().Uint64(), ExecPluginLabel)
destPriceRegistryReader = observability.NewPriceRegistryReader(destPriceRegistryReader, rf.config.destClient.ConfiguredChainID().Int64(), ExecPluginLabel)
rf.destPriceRegReader = destPriceRegistryReader
rf.destPriceRegAddr = newPriceRegAddr
return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type ObservedCommitStoreReader struct {
metric metricDetails
}

func NewObservedCommitStoreReader(origin ccipdata.CommitStoreReader, chainID uint64, pluginName string) *ObservedCommitStoreReader {
func NewObservedCommitStoreReader(origin ccipdata.CommitStoreReader, chainID int64, pluginName string) *ObservedCommitStoreReader {
return &ObservedCommitStoreReader{
CommitStoreReader: origin,
metric: metricDetails{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ var (
type metricDetails struct {
histogram *prometheus.HistogramVec
pluginName string
chainId uint64
chainId int64
}

func withObservedContract[T any](metric metricDetails, function string, contract func() (T, error)) (T, error) {
contractExecutionStarted := time.Now()
value, err := contract()
metric.histogram.
WithLabelValues(
strconv.FormatUint(metric.chainId, 10),
strconv.FormatInt(metric.chainId, 10),
metric.pluginName,
function,
strconv.FormatBool(err == nil),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestProperLabelsArePassed(t *testing.T) {
func TestMetricsSendFromContractDirectly(t *testing.T) {
expectedCounter := 4
ctx := testutils.Context(t)
chainId := uint64(420)
chainId := int64(420)

mockedOfframp := ccipdata.NewMockOffRampReader(t)
mockedOfframp.On("GetSupportedTokens", ctx).Return([]common.Address{}, nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type ObservedOffRampReader struct {
metric metricDetails
}

func NewObservedOffRampReader(origin ccipdata.OffRampReader, chainID uint64, pluginName string) *ObservedOffRampReader {
func NewObservedOffRampReader(origin ccipdata.OffRampReader, chainID int64, pluginName string) *ObservedOffRampReader {
return &ObservedOffRampReader{
OffRampReader: origin,
metric: metricDetails{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type ObservedOnRampReader struct {
metric metricDetails
}

func NewObservedOnRampReader(origin ccipdata.OnRampReader, chainID uint64, pluginName string) *ObservedOnRampReader {
func NewObservedOnRampReader(origin ccipdata.OnRampReader, chainID int64, pluginName string) *ObservedOnRampReader {
return &ObservedOnRampReader{
OnRampReader: origin,
metric: metricDetails{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type ObservedPriceRegistryReader struct {
metric metricDetails
}

func NewPriceRegistryReader(origin ccipdata.PriceRegistryReader, chainID uint64, pluginName string) *ObservedPriceRegistryReader {
func NewPriceRegistryReader(origin ccipdata.PriceRegistryReader, chainID int64, pluginName string) *ObservedPriceRegistryReader {
return &ObservedPriceRegistryReader{
PriceRegistryReader: origin,
metric: metricDetails{
Expand Down

0 comments on commit 9957af0

Please sign in to comment.