Skip to content

Commit

Permalink
[KYUUBI apache#5696] [REST] Return remote session id and remote opera…
Browse files Browse the repository at this point in the history
…tion 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 apache#5696 from turboFei/remote_id.

Closes apache#5696

4dc6e1d [fwang12] [REST] Return remote session id and remote operation id

Authored-by: fwang12 <fwang12@ebay.com>
Signed-off-by: fwang12 <fwang12@ebay.com>
  • Loading branch information
turboFei committed Nov 15, 2023
1 parent 3c2291e commit 905170d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

public class OperationData {
private String identifier;
private String remoteId;
private String statement;
private String state;
private Long createTime;
Expand All @@ -41,6 +42,7 @@ public OperationData() {}

public OperationData(
String identifier,
String remoteId,
String statement,
String state,
Long createTime,
Expand All @@ -53,6 +55,7 @@ public OperationData(
String kyuubiInstance,
Map<String, String> metrics) {
this.identifier = identifier;
this.remoteId = remoteId;
this.statement = statement;
this.state = state;
this.createTime = createTime;
Expand All @@ -74,6 +77,14 @@ public void setIdentifier(String identifier) {
this.identifier = identifier;
}

public String getRemoteId() {
return remoteId;
}

public void setRemoteId(String remoteId) {
this.remoteId = remoteId;
}

public String getStatement() {
return statement;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

public class SessionData {
private String identifier;
private String remoteId;
private String user;
private String ipAddr;
private Map<String, String> conf;
Expand All @@ -40,6 +41,7 @@ public SessionData() {}

public SessionData(
String identifier,
String remoteId,
String user,
String ipAddr,
Map<String, String> conf,
Expand All @@ -51,6 +53,7 @@ public SessionData(
String kyuubiInstance,
String engineId) {
this.identifier = identifier;
this.remoteId = remoteId;
this.user = user;
this.ipAddr = ipAddr;
this.conf = conf;
Expand All @@ -71,6 +74,14 @@ public void setIdentifier(String identifier) {
this.identifier = identifier;
}

public String getRemoteId() {
return remoteId;
}

public void setRemoteId(String remoteId) {
this.remoteId = remoteId;
}

public String getUser() {
return user;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -48,6 +49,7 @@ object ApiUtils extends Logging {
val opEvent = KyuubiOperationEvent(operation)
new OperationData(
opEvent.statementId,
opEvent.remoteId,
opEvent.statement,
opEvent.state,
opEvent.createTime,
Expand Down

0 comments on commit 905170d

Please sign in to comment.