Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use services.Config.NewService/Engine (part 2) #14117

Merged
merged 1 commit into from
Aug 20, 2024
Merged

Conversation

jmank88
Copy link
Contributor

@jmank88 jmank88 commented Aug 14, 2024

https://smartcontract-it.atlassian.net/browse/BCF-3337

This PR upgrades just a few more types to use services.Engine. This also triggered many cascading logger use changes from core to common. This was pre-existing technical debt that needed to be done anyways.

Follow up from part one:

@jmank88 jmank88 marked this pull request as ready for review August 14, 2024 15:04
@jmank88 jmank88 requested review from a team as code owners August 14, 2024 15:04
@jmank88 jmank88 requested a review from a team August 14, 2024 15:04
@jmank88 jmank88 requested a review from a team as a code owner August 14, 2024 15:04
@jmank88 jmank88 enabled auto-merge August 16, 2024 12:01
@@ -56,15 +56,13 @@ func NewWriteTarget(lggr logger.Logger, id string, cr commontypes.ContractReader
"Write target.",
)

logger := lggr.Named("WriteTarget")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did the methods on the instance disappear? the new convention is less intuitive to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The common package logger interface captures only the simple methods implemented by zap. A Sugared logger can still be constructed from any instance to provide these operations as methods, but making one is messier than just calling the helper when there is just one thing to do.

commontypes "github.com/smartcontractkit/chainlink-common/pkg/types"
"github.com/smartcontractkit/chainlink-common/pkg/types/query/primitives"
"github.com/smartcontractkit/chainlink/v2/core/logger"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we delete this pkg entirely? confusing to have multiple ways to do the same thing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it serves a different extended purpose, but it can be reduced later if we convert everything to use the simpler interface from common.

@@ -39,7 +38,7 @@ type transmitter struct {

func NewTransmitter(lggr logger.Logger, fromAccount string) Transmitter {
return &transmitter{
lggr.Named("DummyTransmitter"),
logger.Named(lggr, "DummyTransmitter"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why has this cascaded to so many places? i only see a handful of NewEngine calls in this PR. does this PR intermix disparate concerns - are all these logger chains strictly necessary in this specific change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I followed the compiler errors, so all are necessary, unless we have cases where unrelated things are in the same file I suppose - but that seems like a separate issue.

@jmank88 jmank88 requested review from patrickhuie19, a team, reductionista and bolekk August 20, 2024 14:08
@jmank88 jmank88 added this pull request to the merge queue Aug 20, 2024
Merged via the queue into develop with commit c6d1d45 Aug 20, 2024
138 of 140 checks passed
@jmank88 jmank88 deleted the service-engine-2 branch August 20, 2024 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants