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

Upgrade to latest Nexus SDK -- v0.0.11 #6714

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions common/nexus/failure.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func ConvertGRPCError(err error, exposeDetails bool) error {
if !exposeDetails {
errMessage = "request timeout"
}
return nexus.HandlerErrorf(nexus.HandlerErrorTypeDownstreamTimeout, errMessage)
return nexus.HandlerErrorf(nexus.HandlerErrorTypeUpstreamTimeout, errMessage)
case codes.OK:
return nil
}
Expand Down Expand Up @@ -219,8 +219,8 @@ func HandlerErrorTypeFromHTTPStatus(statusCode int) nexus.HandlerErrorType {
return nexus.HandlerErrorTypeNotImplemented
case http.StatusServiceUnavailable:
return nexus.HandlerErrorTypeUnavailable
case nexus.StatusDownstreamTimeout:
return nexus.HandlerErrorTypeDownstreamTimeout
case nexus.StatusUpstreamTimeout:
return nexus.HandlerErrorTypeUpstreamTimeout
default:
return nexus.HandlerErrorTypeInternal
}
Expand Down
2 changes: 1 addition & 1 deletion components/callbacks/executors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ func TestProcessBackoffTask(t *testing.T) {
}

func newMutableState(t *testing.T) mutableState {
completionNexus, err := nexus.NewOperationCompletionSuccessful(nil, nexus.OperationCompletionSuccesfulOptions{})
completionNexus, err := nexus.NewOperationCompletionSuccessful(nil, nexus.OperationCompletionSuccessfulOptions{})
require.NoError(t, err)
hsmCallbackArg := &persistencespb.HSMCompletionCallbackArg{
NamespaceId: "mynsid",
Expand Down
16 changes: 8 additions & 8 deletions components/nexusoperations/executors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,11 @@ func TestProcessInvocationTask(t *testing.T) {
onStartOperation: func(ctx context.Context, service, operation string, input *nexus.LazyValue, options nexus.StartOperationOptions) (nexus.HandlerStartOperationResult[any], error) {
return nil, nexus.HandlerErrorf(nexus.HandlerErrorTypeInternal, "internal server error")
},
expectedMetricOutcome: "request-error:500",
expectedMetricOutcome: "unknown-error",
checkOutcome: func(t *testing.T, op nexusoperations.Operation, events []*historypb.HistoryEvent) {
require.Equal(t, enumsspb.NEXUS_OPERATION_STATE_BACKING_OFF, op.State())
require.NotNil(t, op.LastAttemptFailure.GetApplicationFailureInfo())
require.Equal(t, "unexpected response status: \"500 Internal Server Error\": internal server error", op.LastAttemptFailure.Message)
require.Equal(t, "handler error (INTERNAL): internal server error", op.LastAttemptFailure.Message)
require.Equal(t, 0, len(events))
},
},
Expand Down Expand Up @@ -574,15 +574,15 @@ func TestProcessCancelationTask(t *testing.T) {
{
name: "failure",
requestTimeout: time.Hour,
destinationDown: false,
destinationDown: true,
onCancelOperation: func(ctx context.Context, service, operation, operationID string, options nexus.CancelOperationOptions) error {
return nexus.HandlerErrorf(nexus.HandlerErrorTypeNotFound, "operation not found")
},
expectedMetricOutcome: "request-error:404",
expectedMetricOutcome: "unknown-error",
checkOutcome: func(t *testing.T, c nexusoperations.Cancelation) {
require.Equal(t, enumspb.NEXUS_OPERATION_CANCELLATION_STATE_FAILED, c.State())
require.Equal(t, enumspb.NEXUS_OPERATION_CANCELLATION_STATE_BACKING_OFF, c.State())
require.NotNil(t, c.LastAttemptFailure.GetApplicationFailureInfo())
require.Equal(t, "unexpected response status: \"404 Not Found\": operation not found", c.LastAttemptFailure.Message)
require.Equal(t, "handler error (NOT_FOUND): operation not found", c.LastAttemptFailure.Message)
},
},
{
Expand All @@ -605,11 +605,11 @@ func TestProcessCancelationTask(t *testing.T) {
onCancelOperation: func(ctx context.Context, service, operation, operationID string, options nexus.CancelOperationOptions) error {
return nexus.HandlerErrorf(nexus.HandlerErrorTypeInternal, "internal server error")
},
expectedMetricOutcome: "request-error:500",
expectedMetricOutcome: "unknown-error",
checkOutcome: func(t *testing.T, c nexusoperations.Cancelation) {
require.Equal(t, enumspb.NEXUS_OPERATION_CANCELLATION_STATE_BACKING_OFF, c.State())
require.NotNil(t, c.LastAttemptFailure.GetApplicationFailureInfo())
require.Equal(t, "unexpected response status: \"500 Internal Server Error\": internal server error", c.LastAttemptFailure.Message)
require.Equal(t, "handler error (INTERNAL): internal server error", c.LastAttemptFailure.Message)
},
},
{
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ require (
github.com/jmoiron/sqlx v1.3.4
github.com/lib/pq v1.10.9
github.com/mitchellh/mapstructure v1.5.0
github.com/nexus-rpc/sdk-go v0.0.10
github.com/nexus-rpc/sdk-go v0.0.11
github.com/olekukonko/tablewriter v0.0.5
github.com/olivere/elastic/v7 v7.0.32
github.com/pborman/uuid v1.2.1
Expand Down Expand Up @@ -56,7 +56,7 @@ require (
go.opentelemetry.io/otel/sdk/metric v1.27.0
go.opentelemetry.io/otel/trace v1.27.0
go.temporal.io/api v1.39.1-0.20241009135124-c02089051a35
go.temporal.io/sdk v1.29.2-0.20241008230001-c82a8ac11cc6
go.temporal.io/sdk v1.29.2-0.20241024205028-5505d0467f79
go.temporal.io/version v0.3.0
go.uber.org/atomic v1.11.0
go.uber.org/automaxprocs v1.5.3
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
github.com/nexus-rpc/sdk-go v0.0.10 h1:7jEPUlsghxoD4OJ2H8YbFJ1t4wbxsUef7yZgBfyY3uA=
github.com/nexus-rpc/sdk-go v0.0.10/go.mod h1:TpfkM2Cw0Rlk9drGkoiSMpFqflKTiQLWUNyKJjF8mKQ=
github.com/nexus-rpc/sdk-go v0.0.11 h1:qH3Us3spfp50t5ca775V1va2eE6z1zMQDZY4mvbw0CI=
github.com/nexus-rpc/sdk-go v0.0.11/go.mod h1:TpfkM2Cw0Rlk9drGkoiSMpFqflKTiQLWUNyKJjF8mKQ=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
Expand Down Expand Up @@ -323,8 +323,8 @@ go.opentelemetry.io/proto/otlp v1.2.0 h1:pVeZGk7nXDC9O2hncA6nHldxEjm6LByfA2aN8IO
go.opentelemetry.io/proto/otlp v1.2.0/go.mod h1:gGpR8txAl5M03pDhMC79G6SdqNV26naRm/KDsgaHD8A=
go.temporal.io/api v1.39.1-0.20241009135124-c02089051a35 h1:yw1owD51GPY2mE3+9Y4HITNtvtncQ34uRRv3g2wJ+8I=
go.temporal.io/api v1.39.1-0.20241009135124-c02089051a35/go.mod h1:1WwYUMo6lao8yl0371xWUm13paHExN5ATYT/B7QtFis=
go.temporal.io/sdk v1.29.2-0.20241008230001-c82a8ac11cc6 h1:SlZapy1jTeSDEL/0WxKyp2Jw7i/GxdFtqVm1YeQ2tzY=
go.temporal.io/sdk v1.29.2-0.20241008230001-c82a8ac11cc6/go.mod h1:R52PRhHZMkHJqrWRPBom0UAqcexPUvDpcf0qbAGwLos=
go.temporal.io/sdk v1.29.2-0.20241024205028-5505d0467f79 h1:Ix3EZD94Uu5uQFOI6iGzvsXpwAGKD9u2l7MWMnV811I=
go.temporal.io/sdk v1.29.2-0.20241024205028-5505d0467f79/go.mod h1:wLK9oFZTW9hUaktDPKjaNY9bspVzgz10tChQzWbElYw=
go.temporal.io/version v0.3.0 h1:dMrei9l9NyHt8nG6EB8vAwDLLTwx2SvRyucCSumAiig=
go.temporal.io/version v0.3.0/go.mod h1:UA9S8/1LaKYae6TyD9NaPMJTZb911JcbqghI2CBSP78=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
Expand Down
6 changes: 3 additions & 3 deletions service/frontend/nexus_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ func (h *nexusHandler) StartOperation(
if err != nil {
if common.IsContextDeadlineExceededErr(err) {
oc.metricsHandler = oc.metricsHandler.WithTags(metrics.OutcomeTag("handler_timeout"))
return nil, nexus.HandlerErrorf(nexus.HandlerErrorTypeDownstreamTimeout, "downstream timeout")
return nil, nexus.HandlerErrorf(nexus.HandlerErrorTypeUpstreamTimeout, "upstream timeout")
}
return nil, commonnexus.ConvertGRPCError(err, false)
}
Expand Down Expand Up @@ -490,7 +490,7 @@ func (h *nexusHandler) CancelOperation(ctx context.Context, service, operation,
if err != nil {
if common.IsContextDeadlineExceededErr(err) {
oc.metricsHandler = oc.metricsHandler.WithTags(metrics.OutcomeTag("handler_timeout"))
return nexus.HandlerErrorf(nexus.HandlerErrorTypeDownstreamTimeout, "downstream timeout")
return nexus.HandlerErrorf(nexus.HandlerErrorTypeUpstreamTimeout, "upstream timeout")
}
return commonnexus.ConvertGRPCError(err, false)
}
Expand Down Expand Up @@ -577,7 +577,7 @@ func (h *nexusHandler) convertOutcomeToNexusHandlerError(resp *matchingservice.D
}

switch handlerError.Type {
case nexus.HandlerErrorTypeDownstreamTimeout,
case nexus.HandlerErrorTypeUpstreamTimeout,
nexus.HandlerErrorTypeUnauthenticated,
nexus.HandlerErrorTypeUnauthorized,
nexus.HandlerErrorTypeBadRequest,
Expand Down
2 changes: 1 addition & 1 deletion service/history/workflow/mutable_state_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ func (ms *MutableStateImpl) GetNexusCompletion(ctx context.Context) (nexus.Opera
// Nexus does not support it.
p = payloads[0]
}
completion, err := nexus.NewOperationCompletionSuccessful(p, nexus.OperationCompletionSuccesfulOptions{
completion, err := nexus.NewOperationCompletionSuccessful(p, nexus.OperationCompletionSuccessfulOptions{
Serializer: commonnexus.PayloadSerializer,
})
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions tests/nexus_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ func (s *NexusApiTestSuite) TestNexusStartOperation_Outcomes() {
assertion: func(t *testing.T, res *nexus.ClientStartOperationResult[string], err error) {
var unexpectedError *nexus.UnexpectedResponseError
require.ErrorAs(t, err, &unexpectedError)
require.Equal(t, nexus.StatusDownstreamTimeout, unexpectedError.Response.StatusCode)
require.Equal(t, "downstream timeout", unexpectedError.Failure.Message)
require.Equal(t, nexus.StatusUpstreamTimeout, unexpectedError.Response.StatusCode)
require.Equal(t, "upstream timeout", unexpectedError.Failure.Message)
},
},
}
Expand Down Expand Up @@ -654,8 +654,8 @@ func (s *NexusApiTestSuite) TestNexusCancelOperation_Outcomes() {
assertion: func(t *testing.T, err error) {
var unexpectedError *nexus.UnexpectedResponseError
require.ErrorAs(t, err, &unexpectedError)
require.Equal(t, nexus.StatusDownstreamTimeout, unexpectedError.Response.StatusCode)
require.Equal(t, "downstream timeout", unexpectedError.Failure.Message)
require.Equal(t, nexus.StatusUpstreamTimeout, unexpectedError.Response.StatusCode)
require.Equal(t, "upstream timeout", unexpectedError.Failure.Message)
},
},
}
Expand Down
12 changes: 6 additions & 6 deletions tests/nexus_workflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -564,15 +564,15 @@ func (s *NexusWorkflowTestSuite) TestNexusOperationAsyncCompletion() {
// Use -10 to avoid hitting MaxNexusAPIRequestBodyBytes. Actual payload will still exceed limit because of
// additional Content headers. See common/rpc/grpc.go:66
s.mustToPayload(strings.Repeat("a", (2*1024*1024)-10)),
nexus.OperationCompletionSuccesfulOptions{Serializer: commonnexus.PayloadSerializer},
nexus.OperationCompletionSuccessfulOptions{Serializer: commonnexus.PayloadSerializer},
)
s.NoError(err)
res, snap := s.sendNexusCompletionRequest(ctx, s.T(), publicCallbackUrl, largeCompletion, callbackToken)
s.Equal(http.StatusBadRequest, res.StatusCode)
s.Equal(1, len(snap["nexus_completion_requests"]))
s.Subset(snap["nexus_completion_requests"][0].Tags, map[string]string{"namespace": s.Namespace(), "outcome": "error_bad_request"})

completion, err := nexus.NewOperationCompletionSuccessful(s.mustToPayload(nil), nexus.OperationCompletionSuccesfulOptions{
completion, err := nexus.NewOperationCompletionSuccessful(s.mustToPayload(nil), nexus.OperationCompletionSuccessfulOptions{
Serializer: commonnexus.PayloadSerializer,
})
s.NoError(err)
Expand Down Expand Up @@ -621,7 +621,7 @@ func (s *NexusWorkflowTestSuite) TestNexusOperationAsyncCompletion() {
s.Subset(snap["nexus_completion_requests"][0].Tags, map[string]string{"namespace": s.Namespace(), "outcome": "error_not_found"})

// Send a valid - successful completion request.
completion, err = nexus.NewOperationCompletionSuccessful(s.mustToPayload("result"), nexus.OperationCompletionSuccesfulOptions{
completion, err = nexus.NewOperationCompletionSuccessful(s.mustToPayload("result"), nexus.OperationCompletionSuccessfulOptions{
Serializer: commonnexus.PayloadSerializer,
})
s.NoError(err)
Expand Down Expand Up @@ -876,7 +876,7 @@ func (s *NexusWorkflowTestSuite) TestNexusOperationAsyncFailure() {
func (s *NexusWorkflowTestSuite) TestNexusOperationAsyncCompletionErrors() {
ctx := testcore.NewContext()

completion, err := nexus.NewOperationCompletionSuccessful(s.mustToPayload("result"), nexus.OperationCompletionSuccesfulOptions{
completion, err := nexus.NewOperationCompletionSuccessful(s.mustToPayload("result"), nexus.OperationCompletionSuccessfulOptions{
Serializer: commonnexus.PayloadSerializer,
})
s.NoError(err)
Expand Down Expand Up @@ -939,7 +939,7 @@ func (s *NexusWorkflowTestSuite) TestNexusOperationAsyncCompletionAuthErrors() {
s.GetTestCluster().Host().SetOnAuthorize(onAuthorize)
defer s.GetTestCluster().Host().SetOnAuthorize(nil)

completion, err := nexus.NewOperationCompletionSuccessful(s.mustToPayload("result"), nexus.OperationCompletionSuccesfulOptions{
completion, err := nexus.NewOperationCompletionSuccessful(s.mustToPayload("result"), nexus.OperationCompletionSuccessfulOptions{
Serializer: commonnexus.PayloadSerializer,
})
s.NoError(err)
Expand Down Expand Up @@ -1377,7 +1377,7 @@ func (s *NexusWorkflowTestSuite) TestNexusOperationAsyncCompletionAfterReset() {
}
}
s.True(seenStartedEvent)
completion, err := nexus.NewOperationCompletionSuccessful(s.mustToPayload("result"), nexus.OperationCompletionSuccesfulOptions{
completion, err := nexus.NewOperationCompletionSuccessful(s.mustToPayload("result"), nexus.OperationCompletionSuccessfulOptions{
Serializer: commonnexus.PayloadSerializer,
})
s.NoError(err)
Expand Down
Loading