2727public class SearchProfileCoordinatorResult implements Writeable , ToXContentFragment {
2828
2929 private final String nodeId ;
30+ private long tookInMillis ;
3031 private final RetrieverProfileResult retrieverProfileResult ;
3132 private final Map <String , Long > breakdownMap ;
3233
@@ -38,13 +39,15 @@ public SearchProfileCoordinatorResult(String nodeId, RetrieverProfileResult retr
3839
3940 public SearchProfileCoordinatorResult (StreamInput in ) throws IOException {
4041 nodeId = in .readString ();
42+ tookInMillis = in .readLong ();
4143 retrieverProfileResult = in .readOptionalWriteable (RetrieverProfileResult ::new );
4244 breakdownMap = in .readMap (StreamInput ::readString , StreamInput ::readLong );
4345 }
4446
4547 @ Override
4648 public void writeTo (StreamOutput out ) throws IOException {
4749 out .writeString (nodeId );
50+ out .writeLong (tookInMillis );
4851 out .writeOptionalWriteable (retrieverProfileResult );
4952 out .writeMap (breakdownMap , StreamOutput ::writeString , StreamOutput ::writeLong );
5053 }
@@ -53,13 +56,16 @@ public String getNodeId() {
5356 return this .nodeId ;
5457 }
5558
56- public RetrieverProfileResult getRetrieverProfileResult ( ) {
57- return this .retrieverProfileResult ;
59+ public void setTookInMillis ( long tookInMillis ) {
60+ this .tookInMillis = tookInMillis ;
5861 }
5962
6063 @ Override
6164 public XContentBuilder toXContent (XContentBuilder builder , Params params ) throws IOException {
6265 builder .field ("node_id" , nodeId );
66+ if (tookInMillis != -1 ) {
67+ builder .field ("took_in_millis" , tookInMillis );
68+ }
6369 if (retrieverProfileResult != null ) {
6470 builder .field ("retriever" , retrieverProfileResult );
6571 }
@@ -75,13 +81,14 @@ public boolean equals(Object o) {
7581 if (o == null || getClass () != o .getClass ()) return false ;
7682 SearchProfileCoordinatorResult that = (SearchProfileCoordinatorResult ) o ;
7783 return nodeId .equals (that .nodeId )
84+ && tookInMillis == that .tookInMillis
7885 && Objects .equals (retrieverProfileResult , that .retrieverProfileResult )
7986 && Objects .equals (breakdownMap , that .breakdownMap );
8087 }
8188
8289 @ Override
8390 public int hashCode () {
84- return Objects .hash (nodeId , retrieverProfileResult , breakdownMap );
91+ return Objects .hash (nodeId , tookInMillis , retrieverProfileResult , breakdownMap );
8592 }
8693
8794 @ Override
0 commit comments