@@ -914,11 +914,11 @@ void operationEnd_withoutMatchingStart_createsContinuationSpanWithLink() {
914914 }
915915
916916 @ Test
917- void operationEnd_withoutMatchingStart_usesOperationStartTimestamp () {
917+ void operationEnd_withoutMatchingStart_startsWithinCurrentInvocation () {
918918 plugin .onInvocationStart (new InvocationInfo ("req-1" , "arn:exec1" , true , Instant .now ()));
919919
920- var operationStart = Instant .parse ( "2026-01-15T08:30:00Z" ) ;
921- var operationEnd = Instant . parse ( "2026-01-15T09:00:00Z" );
920+ var operationStart = Instant .EPOCH ;
921+ var operationEnd = operationStart . plusSeconds ( 60 );
922922
923923 // onOperationEnd without a prior onOperationStart — continuation span
924924 plugin .onOperationEnd (new OperationEndInfo (
@@ -936,15 +936,19 @@ void operationEnd_withoutMatchingStart_usesOperationStartTimestamp() {
936936
937937 plugin .onInvocationEnd (new InvocationEndInfo ("req-1" , "arn:exec1" , true , InvocationStatus .SUCCEEDED , null ));
938938
939- var continuationSpan = spanExporter .getFinishedSpanItems ().stream ()
939+ var spans = spanExporter .getFinishedSpanItems ();
940+ var continuationSpan = spans .stream ()
940941 .filter (s -> s .getName ().contains ("wait" ))
941942 .findFirst ()
942943 .orElseThrow ();
944+ var invocationSpan = spans .stream ()
945+ .filter (s -> s .getName ().equals ("Invocation" ))
946+ .findFirst ()
947+ .orElseThrow ();
943948
944- assertEquals (
945- operationStart .toEpochMilli (),
946- continuationSpan .getStartEpochNanos () / 1_000_000 ,
947- "Continuation span should use the operation's startTimestamp" );
949+ assertEquals (invocationSpan .getSpanId (), continuationSpan .getParentSpanId ());
950+ assertTrue (continuationSpan .getStartEpochNanos () >= invocationSpan .getStartEpochNanos ());
951+ assertTrue (continuationSpan .getEndEpochNanos () <= invocationSpan .getEndEpochNanos ());
948952 }
949953
950954 @ Test
0 commit comments