diff --git a/server/src/main/java/org/opensearch/action/support/replication/TransportReplicationAction.java b/server/src/main/java/org/opensearch/action/support/replication/TransportReplicationAction.java index 68598cad802b3..6313e4094dee2 100644 --- a/server/src/main/java/org/opensearch/action/support/replication/TransportReplicationAction.java +++ b/server/src/main/java/org/opensearch/action/support/replication/TransportReplicationAction.java @@ -423,6 +423,7 @@ protected void handlePrimaryRequest(final ConcreteShardRequest request, new AsyncPrimaryAction(request, TraceableActionListener.create(listener, span, getTracer()), (ReplicationTask) task).run(); } catch (RuntimeException e) { listener.onFailure(e); + span.endSpan(); } } @@ -708,6 +709,7 @@ protected void handleReplicaRequest( .run(); } catch (RuntimeException e) { listener.onFailure(e); + span.endSpan(); } }