This is an automated email from the ASF dual-hosted git repository.

feiwang pushed a commit to branch branch-1.8
in repository https://gitbox.apache.org/repos/asf/kyuubi.git


The following commit(s) were added to refs/heads/branch-1.8 by this push:
     new f7f45c4db [KYUUBI #5696] [REST] Return remote session id and remote 
operation id
f7f45c4db is described below

commit f7f45c4db04df2ee8ba2a81fc9af81642cf0ac0b
Author: fwang12 <[email protected]>
AuthorDate: Wed Nov 15 13:02:50 2023 +0800

    [KYUUBI #5696] [REST] Return remote session id and remote operation id
    
    ### _Why are the changes needed?_
    
     Not all the engine sessionIds/operationIds are unified between kyuubi 
server and kyuubi engines, so we need to expose  these remote details to 
provide more insights.
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including 
negative and positive cases if possible
    
    - [ ] Add screenshots for manual tests if appropriate
    
    - [x] [Run 
test](https://kyuubi.readthedocs.io/en/master/contributing/code/testing.html#running-tests)
 locally before make a pull request
    
    ### _Was this patch authored or co-authored using generative AI tooling?_
    
    No.
    
    Closes #5696 from turboFei/remote_id.
    
    Closes #5696
    
    4dc6e1df7 [fwang12] [REST] Return remote session id and remote operation id
    
    Authored-by: fwang12 <[email protected]>
    Signed-off-by: fwang12 <[email protected]>
    (cherry picked from commit 905170d7a59660d136ed36a587686e1ab97a3885)
    Signed-off-by: fwang12 <[email protected]>
---
 .../org/apache/kyuubi/client/api/v1/dto/OperationData.java    | 11 +++++++++++
 .../java/org/apache/kyuubi/client/api/v1/dto/SessionData.java | 11 +++++++++++
 .../main/scala/org/apache/kyuubi/server/api/ApiUtils.scala    |  2 ++
 3 files changed, 24 insertions(+)

diff --git 
a/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/api/v1/dto/OperationData.java
 
b/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/api/v1/dto/OperationData.java
index 70c2dd3f3..dd3b30264 100644
--- 
a/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/api/v1/dto/OperationData.java
+++ 
b/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/api/v1/dto/OperationData.java
@@ -25,6 +25,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
 
 public class OperationData {
   private String identifier;
+  private String remoteId;
   private String statement;
   private String state;
   private Long createTime;
@@ -41,6 +42,7 @@ public class OperationData {
 
   public OperationData(
       String identifier,
+      String remoteId,
       String statement,
       String state,
       Long createTime,
@@ -53,6 +55,7 @@ public class OperationData {
       String kyuubiInstance,
       Map<String, String> metrics) {
     this.identifier = identifier;
+    this.remoteId = remoteId;
     this.statement = statement;
     this.state = state;
     this.createTime = createTime;
@@ -74,6 +77,14 @@ public class OperationData {
     this.identifier = identifier;
   }
 
+  public String getRemoteId() {
+    return remoteId;
+  }
+
+  public void setRemoteId(String remoteId) {
+    this.remoteId = remoteId;
+  }
+
   public String getStatement() {
     return statement;
   }
diff --git 
a/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/api/v1/dto/SessionData.java
 
b/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/api/v1/dto/SessionData.java
index ae7dfdec9..30a4eb515 100644
--- 
a/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/api/v1/dto/SessionData.java
+++ 
b/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/api/v1/dto/SessionData.java
@@ -25,6 +25,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
 
 public class SessionData {
   private String identifier;
+  private String remoteId;
   private String user;
   private String ipAddr;
   private Map<String, String> conf;
@@ -40,6 +41,7 @@ public class SessionData {
 
   public SessionData(
       String identifier,
+      String remoteId,
       String user,
       String ipAddr,
       Map<String, String> conf,
@@ -51,6 +53,7 @@ public class SessionData {
       String kyuubiInstance,
       String engineId) {
     this.identifier = identifier;
+    this.remoteId = remoteId;
     this.user = user;
     this.ipAddr = ipAddr;
     this.conf = conf;
@@ -71,6 +74,14 @@ public class SessionData {
     this.identifier = identifier;
   }
 
+  public String getRemoteId() {
+    return remoteId;
+  }
+
+  public void setRemoteId(String remoteId) {
+    this.remoteId = remoteId;
+  }
+
   public String getUser() {
     return user;
   }
diff --git 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/ApiUtils.scala 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/ApiUtils.scala
index 5aaf4d778..04a126235 100644
--- a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/ApiUtils.scala
+++ b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/ApiUtils.scala
@@ -32,6 +32,7 @@ object ApiUtils extends Logging {
     val sessionEvent = session.getSessionEvent
     new SessionData(
       session.handle.identifier.toString,
+      sessionEvent.map(_.remoteSessionId).getOrElse(""),
       session.user,
       session.ipAddress,
       session.conf.asJava,
@@ -48,6 +49,7 @@ object ApiUtils extends Logging {
     val opEvent = KyuubiOperationEvent(operation)
     new OperationData(
       opEvent.statementId,
+      opEvent.remoteId,
       opEvent.statement,
       opEvent.state,
       opEvent.createTime,

Reply via email to