Add context.Context to methods defined in chain, prover, and signer module interfaces #153
+85
−80
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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