-
Notifications
You must be signed in to change notification settings - Fork 34
Add context.Context to methods defined in chain, prover, and signer module interfaces #153
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
Conversation
Signed-off-by: Takeshi Arabiki <[email protected]>
Signed-off-by: Takeshi Arabiki <[email protected]>
Signed-off-by: Takeshi Arabiki <[email protected]>
Signed-off-by: Takeshi Arabiki <[email protected]>
Signed-off-by: Takeshi Arabiki <[email protected]>
Signed-off-by: Takeshi Arabiki <[email protected]>
@abicky Thank you for your careful consideration. Basically OK, but I noticed that |
@siburu Thank you for your feedback!
If I'm correct, it is not appropriate to use Here are also some example methods that take both of a context and a height as their arguments:
|
For more details, see hyperledger-labs/yui-relayer#153
For more details, see hyperledger-labs/yui-relayer#153 Signed-off-by: abicky <[email protected]>
For more details, see hyperledger-labs/yui-relayer#153 Signed-off-by: abicky <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late review. LGTM. Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Although SyncHeaders
and StrategyI
support for contexts is important for trace implementation, I understand it's a different PR.
For more details, see hyperledger-labs/yui-relayer#153 Signed-off-by: abicky <[email protected]>
Description
This PR is the first step to integrate with OpenTelemetry to improve the observability of yui-relayer.
I will divide the whole integration process into the following phases:
context.Context
argument to the methods defined in chain module interfaces, prover module interfaces, and signer module interfacescontext.Context
argument to appropriate methods that are unlikely to be used from other repositoriescore.StrategyI
,core.SyncHeaders
, and so oncontext.TODO()
with an appropriate contextThis PR includes the changes in the first phase and I have added a
context.Context
argument to the methods likely to access external services or create a goroutine, andcontext.TODO()
to the method calls in a mechanical manner.Although the main purpose is to improve the observability, I think it is common to add a
context.Context
argument to such methods, whose process we need to cancel in some occasions.Note that I don't add a
context.Context
argument to the methods that are likely to be a mere getter.Considerations
This PR includes breaking changes, but they are acceptable according to Module version numbering:
Note
I have examined the following interfaces:
And here is my note on whether to add a context argument:
ChainInfo
,IBCQuerier
, andICS20Querier
github.com/datachainlab/ethereum-ibc-relay-chain/pkg/relay/ethereum.Chain
github.com/hyperledger-labs/yui-relayer/chains/tendermint.Chain
IBCQuerier
andICS20Querier
haveQueryContext
containingcontext.Context
as the first argument, so we don't need to change the signatureSendMsgs
,GetMsgResult
,LatestHeight
, andTimestamp
are expected to be simple getters, setters, or fixed values, so we don't need a contextcontext.Context
argumentUpdatePahtConfig
is unlikely to access external services or create a goroutine, so we don't need to change the signatureBuild
andValidate
are likely to be so simple that we don't need a contextIs_MsgID
is just used for an annotation to indicate that the struct is a kind ofMsgID
is_MsgEventLog
is just used for an annotation to indicate that the struct is a kind ofMsgEventLog
context.Context
argumentSyncHeaders