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

Add documentation for propagators and how they are executed #1312

Merged
merged 2 commits into from
Mar 20, 2024

Conversation

alshopov
Copy link
Contributor

Clarify behavior on return of error
Document the whole execution sequence

Docs added to both internal package and exposed type alias due to: golang/go#44905

@CLAassistant
Copy link

CLAassistant commented Feb 20, 2024

CLA assistant check
All committers have signed the CLA.

@@ -36,8 +36,25 @@ type HeaderReader interface {
ForEachKey(handler func(string, []byte) error) error
}

// ContextPropagator is an interface that determines what information from
// context to pass along
// ContextPropagator determines what information from context to pass along.
Copy link
Contributor

Choose a reason for hiding this comment

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

thanks for filling in this documentation gap. @shijiesheng can you review please?

// ContextPropagator is an interface that determines what information from
// context to pass along
// ContextPropagator determines what information from context to pass along.
// Returning an error from any of its methods will prevent the normal execution
Copy link
Contributor

Choose a reason for hiding this comment

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

This is actually not true. At least this Inject method will fail open.

Copy link
Contributor

Choose a reason for hiding this comment

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

@alshopov Could you update the doc here? Or should we handle it on our side?

Clarify behavior on return of error
Document the whole execution sequence

Docs added to both internal package and exposed type alias due to:
golang/go#44905

Signed-off-by: Alexander Shopov <[email protected]>
@alshopov
Copy link
Contributor Author

alshopov commented Mar 9, 2024

@shijiesheng, @3vilhamster: I have updated the docs. I have verified the behaviour via fiddling with:
cmd/samples/recipes/ctxpropagation/propagator.go from //github.com/uber-common/cadence-samples.git

Note that I am documenting current behavior - I am not sure whether it is the intended behavior.
Failures to execute on error from Extract and ExtractToWorkflow are different (failing vs time out) but that fact is not important that much and should not constrain future changes. What matters to the user are the problems they will have with their workflow.

I have no idea whether the current silent non-failure on errors from Inject* methods is a good idea - leaving this up to you.

Sorry for the delay - free time is a rare premium

Comment on lines +55 to +56
// -> ExtractToWorkflow -> Start executing a workflow -> InjectFromWorkflow ->
// Cadence -> Go Activity Worker -> Extract -> Execute Activity
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this might make it easier for users to understand

Suggested change
// -> ExtractToWorkflow -> Start executing a workflow -> InjectFromWorkflow ->
// Cadence -> Go Activity Worker -> Extract -> Execute Activity
// -> ExtractToWorkflow -> Start executing a workflow -> Schedule an activity -> InjectFromWorkflow ->
// Cadence -> Go Activity Worker -> Extract -> Execute Activity

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that it is out of the scope of the context propagator, so we might add it if it causes confusion.

// The whole sequence of execution is:
//
// Process initiating the workflow -> Inject -> Cadence -> Go Workflow Worker
// -> ExtractToWorkflow -> Start executing a workflow -> InjectFromWorkflow ->
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

Copy link

codecov bot commented Mar 20, 2024

Codecov Report

Merging #1312 (373ccf8) into master (ba7fa67) will decrease coverage by 0.03%.
The diff coverage is n/a.

Additional details and impacted files
Files Coverage Δ
internal/headers.go 76.47% <ø> (ø)

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ba7fa67...373ccf8. Read the comment docs.

Copy link
Contributor

@3vilhamster 3vilhamster left a comment

Choose a reason for hiding this comment

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

LGTM

@3vilhamster 3vilhamster merged commit f578fed into uber-go:master Mar 20, 2024
12 checks passed
ketsiambaku added a commit that referenced this pull request Mar 22, 2024
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.

6 participants