temporalio / sdk-java

Temporal Java SDK
https://temporal.io
Apache License 2.0
209 stars 142 forks source link

activity_succeed_endtoend_latency not reported when completing the activity with ActivityCompletionClient #2092

Open antmendoza opened 3 months ago

antmendoza commented 3 months ago

Expected Behavior

The metric activity_succeed_endtoend_latency should be reported when activity is completed with ActivityCompletionClient.complete

I think it is missing in this method https://github.com/temporalio/sdk-java/blob/0c8073ee74984333f045b79a27da337097d7ae7a/temporal-sdk/src/main/java/io/temporal/internal/client/external/ManualActivityCompletionClientImpl.java#L101

Actual Behavior

Metric is not reported, you can find a reproduction here https://github.com/antmendoza/my-temporal-pocs/tree/main/java/pocs/src/main/java/io/antmendoza/samples/_6442.

Steps to Reproduce the Problem

1. 1. 1.

Specifications

cretz commented 3 months ago

I don't believe any SDK records this metric when async activity is used. Async activity means "I will handle completion myself" and therefore it bypasses Temporal's completion mechanisms which includes this metric. Many users use async completion to complete activities on completely separate machines than where it was started which means it can't set this value (it doesn't know the start time).

Quinn-With-Two-Ns commented 3 months ago

in the case of manual completion that is intended for in process activity completion so the activity start time could be known.