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

Nexus callbacks, tasks, and incoming service registry #352

Merged
merged 5 commits into from
Jan 31, 2024
Merged

Conversation

bergundy
Copy link
Member

This PR takes the work from the nexus feature branch and merges it into master.

All of this has already been reviewed in previous PRs into the nexus branch but now that we're making progress with the implementation and feel confident in this API, it's time to merge.

@bergundy bergundy requested review from a team as code owners January 29, 2024 23:07
Copy link
Member

Choose a reason for hiding this comment

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

I assume Nexus operation events come later?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, we're not quite there yet in terms of stable implementation.
I plan to open a PR with those that will sit around for a while in a feature branch very soon.

// Callback URL.
// (-- api-linter: core::0140::uri=disabled
// aip.dev/not-precedent: Not following this guideline. --)
string url = 1;
Copy link
Member

Choose a reason for hiding this comment

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

I forget whether this should be a URL or a service name. Aren't URLs configured as part of services and service names used in place of URLs everywhere?

Copy link
Member Author

Choose a reason for hiding this comment

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

Callbacks use URLs.

Copy link
Member

Choose a reason for hiding this comment

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

I know it's limited feature set only for now, but one might expect there to be a lot of config that one would want to set for callback URLs. Is that on the future radar?

Copy link
Member Author

Choose a reason for hiding this comment

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

The config is provided via dynamic config per address.
We may allow setting headers and more customization at callback attachment time, we'll evaluate as needed.

Copy link
Contributor

@MichaelSnowden MichaelSnowden left a comment

Choose a reason for hiding this comment

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

Looks good to me. I mainly think we can benefit from some more documentation. I think most of this stuff could be inferred from the code, but these are the questions that came up for me at a glance.

}

message HandlerError {
// See https://github.com/nexus-rpc/api/blob/main/SPEC.md#predefined-handler-errors.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: should this be on the message instead of the field similar to the Failure message, or is that intentional?

Copy link
Member Author

Choose a reason for hiding this comment

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

The comment is referring to the error type.

}

// A request to start an operation.
message StartOperationRequest {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you have a link to the docs for this one as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know if it's strictly needed. I didn't feel like it was necessary.

// A Nexus request.
message Request {
// Headers extracted from the original request in the Temporal frontend.
// When using Nexus over HTTP, this includes the request's HTTP headers ignoring multiple values.
Copy link
Contributor

@MichaelSnowden MichaelSnowden Jan 30, 2024

Choose a reason for hiding this comment

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

ignoring multiple values.

Which values? I assume something like Temporal-but-not-Nexus-specific headers?

Copy link
Member Author

Choose a reason for hiding this comment

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

HTTP headers can have multiple values, we only take the first one.

@@ -152,3 +153,32 @@ message NewWorkflowExecutionInfo {
temporal.api.common.v1.Header header = 13;
}

message CallbackInfo {
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 a quick note about what this message is could be useful. There's a few different CallbackXXX types, and there should be some disambiguation. Like, how does this differ from temporal.api.common.v1.Callback?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, good point.

Comment on lines 1403 to 1404
// A unique identifier for this task.
bytes task_token = 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this intentionally opaque? If so, I think it'd be nice to state what its purpose is, i.e. is it for idempotency?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's common in all of our APIs. Yes, it's intentionally opaque.
It's for correlating a poll response with a completion request.

I'll add it to the docstring.

Comment on lines +1411 to +1412
// The identity of the client who initiated this request.
string identity = 2;
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this used for? I think it'd be nice to say because there's a lot of different "identity" fields throughout our APIs, and I believe they don't always have the same behavior or purpose.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's always to the caller identity. It's likely useful only for debugging but we don't persist it, log it it or send it back to the caller.

@bergundy bergundy enabled auto-merge (squash) January 31, 2024 00:59
@bergundy bergundy merged commit 822966d into master Jan 31, 2024
4 checks passed
@bergundy bergundy deleted the nexus branch January 31, 2024 10:53
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