diff --git a/src/Temporalio.Extensions.OpenTelemetry/TracingInterceptor.cs b/src/Temporalio.Extensions.OpenTelemetry/TracingInterceptor.cs index a0e698c1..72eeb8c2 100644 --- a/src/Temporalio.Extensions.OpenTelemetry/TracingInterceptor.cs +++ b/src/Temporalio.Extensions.OpenTelemetry/TracingInterceptor.cs @@ -196,7 +196,15 @@ internal ClientOutbound(TracingInterceptor root, ClientOutboundInterceptor next) { input = input with { Headers = headers }; } - return await base.StartWorkflowAsync(input).ConfigureAwait(false); + try + { + return await base.StartWorkflowAsync(input).ConfigureAwait(false); + } + catch (Exception e) + { + RecordExceptionWithStatus(activity, e); + throw; + } } } @@ -212,7 +220,15 @@ public override async Task SignalWorkflowAsync(SignalWorkflowInput input) { input = input with { Headers = headers }; } - await base.SignalWorkflowAsync(input).ConfigureAwait(false); + try + { + await base.SignalWorkflowAsync(input).ConfigureAwait(false); + } + catch (Exception e) + { + RecordExceptionWithStatus(activity, e); + throw; + } } } @@ -228,7 +244,15 @@ public override async Task QueryWorkflowAsync(QueryWorkflowInp { input = input with { Headers = headers }; } - return await base.QueryWorkflowAsync(input).ConfigureAwait(false); + try + { + return await base.QueryWorkflowAsync(input).ConfigureAwait(false); + } + catch (Exception e) + { + RecordExceptionWithStatus(activity, e); + throw; + } } } @@ -245,7 +269,15 @@ public override async Task QueryWorkflowAsync(QueryWorkflowInp { input = input with { Headers = headers }; } - return await base.StartWorkflowUpdateAsync(input).ConfigureAwait(false); + try + { + return await base.StartWorkflowUpdateAsync(input).ConfigureAwait(false); + } + catch (Exception e) + { + RecordExceptionWithStatus(activity, e); + throw; + } } } diff --git a/tests/Temporalio.Tests/Client/TemporalClientScheduleTests.cs b/tests/Temporalio.Tests/Client/TemporalClientScheduleTests.cs index 92ba9264..17e35be8 100644 --- a/tests/Temporalio.Tests/Client/TemporalClientScheduleTests.cs +++ b/tests/Temporalio.Tests/Client/TemporalClientScheduleTests.cs @@ -323,7 +323,9 @@ public async Task CreateScheduleAsync_Backfill_CreatesProperActions() EndAt: now, Overlap: ScheduleOverlapPolicy.AllowAll), }); - Assert.Equal(6, (await handle.DescribeAsync()).Info.NumActions); + // Servers < 1.24 this is 6, servers >= 1.24 this is 7 + var numActions = (await handle.DescribeAsync()).Info.NumActions; + Assert.True(numActions == 6 || numActions == 7, $"Invalid num actions: {numActions}"); // Delete when done await TestUtils.DeleteAllSchedulesAsync(Client); diff --git a/tests/Temporalio.Tests/Extensions/OpenTelemetry/TracingInterceptorTests.cs b/tests/Temporalio.Tests/Extensions/OpenTelemetry/TracingInterceptorTests.cs index 89484509..1dc4d2b0 100644 --- a/tests/Temporalio.Tests/Extensions/OpenTelemetry/TracingInterceptorTests.cs +++ b/tests/Temporalio.Tests/Extensions/OpenTelemetry/TracingInterceptorTests.cs @@ -393,15 +393,6 @@ public async Task TracingInterceptor_TaskFailures_HaveProperSpans() "RunWorkflow:TracingWorkflow", Parent: "StartWorkflow:TracingWorkflow", Tags: workflowRunTags), - // Validate update - new( - "ValidateUpdate:UpdateTaskFailure", - Parent: "StartWorkflow:TracingWorkflow", - Tags: workflowRunTags, - // Ignore link because client-side send update not captured since it didn't complete - // TODO(cretz): This may need to change when server bug that doesn't finish update - // poll on workflow terminate is complete. - IgnoreLinks: true), // Handle update new( "HandleUpdate:UpdateTaskFailure", @@ -413,7 +404,13 @@ public async Task TracingInterceptor_TaskFailures_HaveProperSpans() "WorkflowTaskFailure:UpdateTaskFailure", Parent: "HandleUpdate:UpdateTaskFailure", Tags: workflowRunTags, - Events: new[] { ActivityAssertion.ExceptionEvent("some message") })); + Events: new[] { ActivityAssertion.ExceptionEvent("some message") }), + // On 1.24+, updates properly fail on client when workflow terminated + new( + "UpdateWorkflow:UpdateTaskFailure", + Parent: null, + Tags: workflowTags, + Events: new[] { ActivityAssertion.ExceptionEvent("workflow execution already completed") })); } [Fact] @@ -509,7 +506,8 @@ public async Task TracingInterceptor_ProperFailures_HaveProperSpans() new( "QueryWorkflow:QueryFailure", Parent: null, - Tags: workflowTags), + Tags: workflowTags, + Events: new[] { ActivityAssertion.ExceptionEvent("fail3") }), // Handle query new( "HandleQuery:QueryFailure",