or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

cli-operations.mdenvironment-management.mdindex.mdoperation-management.mdserver-management.mdservice-management.mdsession-management.mdsql-execution.mdui-components.md

ui-components.mddocs/

0

# UI Components

1

2

Web UI integration components providing monitoring and management interface for the Thrift server.

3

4

## Capabilities

5

6

### ThriftServerTab

7

8

Spark Web UI tab that displays statistics and information about the Thrift server operations.

9

10

```scala { .api }

11

/**

12

* Spark Web UI tab that shows statistics of jobs running in the thrift server.

13

* This assumes the given SparkContext has enabled its SparkUI.

14

* @param sparkContext The Spark context for UI integration

15

*/

16

private[thriftserver] class ThriftServerTab(sparkContext: SparkContext)

17

extends SparkUITab with Logging {

18

19

/** The name displayed in the UI tab */

20

override val name: String = "JDBC/ODBC Server"

21

22

/** Reference to the parent Spark UI */

23

val parent: SparkUI

24

25

/** Reference to the thrift server listener for data */

26

val listener: HiveThriftServer2Listener

27

28

/**

29

* Detach this tab from the Spark UI

30

*/

31

def detach(): Unit

32

}

33

```

34

35

**Usage Example:**

36

37

```scala

38

import org.apache.spark.sql.hive.thriftserver.ui.ThriftServerTab

39

40

// UI tab is automatically created when server starts

41

val uiTab = if (sparkContext.getConf.getBoolean("spark.ui.enabled", true)) {

42

Some(new ThriftServerTab(sparkContext))

43

} else {

44

None

45

}

46

47

// Tab is automatically attached to Spark UI and shows:

48

// - Active sessions

49

// - SQL statement history

50

// - Execution statistics

51

// - Session details

52

53

// Detach when server shuts down

54

uiTab.foreach(_.detach())

55

```

56

57

### ThriftServerPage

58

59

Main page of the Thrift server UI showing overview information and active sessions.

60

61

```scala { .api }

62

/**

63

* Main page of the Thrift server UI showing session and operation statistics

64

* @param parent The parent ThriftServerTab

65

*/

66

private[thriftserver] class ThriftServerPage(parent: ThriftServerTab)

67

extends WebUIPage("") {

68

69

/**

70

* Render the main Thrift server page content

71

* @param request HTTP request

72

* @return HTML content for the page

73

*/

74

def render(request: HttpServletRequest): Seq[Node]

75

}

76

```

77

78

### ThriftServerSessionPage

79

80

Detailed page showing information about a specific session and its operations.

81

82

```scala { .api }

83

/**

84

* Page showing detailed information about a specific Thrift server session

85

* @param parent The parent ThriftServerTab

86

*/

87

private[thriftserver] class ThriftServerSessionPage(parent: ThriftServerTab)

88

extends WebUIPage("session") {

89

90

/**

91

* Render the session detail page content

92

* @param request HTTP request

93

* @return HTML content for the session page

94

*/

95

def render(request: HttpServletRequest): Seq[Node]

96

}

97

```

98

99

## UI Data Integration

100

101

### Session Information Display

102

103

The UI displays comprehensive session information from the `HiveThriftServer2Listener`:

104

105

**Session List View:**

106

- Session ID and user information

107

- Start time and duration

108

- Client IP address

109

- Number of executed statements

110

- Current session status

111

112

**Session Detail View:**

113

- Complete session timeline

114

- All executed SQL statements

115

- Execution times and status

116

- Query execution plans

117

- Error details for failed operations

118

119

### Real-time Monitoring

120

121

**Active Operations:**

122

```scala

123

// UI shows real-time data from the listener

124

val onlineSessionCount = listener.getOnlineSessionNum

125

val runningOperations = listener.getTotalRunning

126

val allSessions = listener.getSessionList

127

val allExecutions = listener.getExecutionList

128

```

129

130

**Operation Tracking:**

131

- Statement execution progress

132

- Spark job integration and tracking

133

- Resource usage per operation

134

- Query performance metrics

135

136

### UI Configuration

137

138

**Retention Limits:**

139

```scala

140

// Configurable limits for UI data retention

141

spark.conf.set("spark.sql.thriftServer.ui.retainedSessions", "200")

142

spark.conf.set("spark.sql.thriftServer.ui.retainedStatements", "1000")

143

```

144

145

**UI Enablement:**

146

```scala

147

// UI tab creation is controlled by Spark UI setting

148

if (sparkContext.getConf.getBoolean("spark.ui.enabled", true)) {

149

// Create and attach UI tab

150

uiTab = Some(new ThriftServerTab(sparkContext))

151

}

152

```

153

154

## UI Navigation

155

156

**Main Server Page:**

157

- `/sqlserver/` - Overview of all sessions and operations

158

- Shows summary statistics and active sessions table

159

- Links to individual session detail pages

160

161

**Session Detail Page:**

162

- `/sqlserver/session/?id=<sessionId>` - Detailed session view

163

- Shows all operations for the specific session

164

- Includes timing, status, and execution details

165

166

**Integration with Spark UI:**

167

- Accessible through main Spark UI navigation

168

- Consistent styling with other Spark UI components

169

- Real-time updates as operations progress

170

171

## Monitoring Features

172

173

### Session Monitoring

174

175

**Session Lifecycle Tracking:**

176

- Session creation timestamps

177

- Connection duration

178

- Idle time tracking

179

- Session termination reasons

180

181

**User Activity:**

182

- Per-user session counts

183

- Query execution patterns

184

- Resource usage by user

185

- Authentication and authorization events

186

187

### Operation Monitoring

188

189

**SQL Statement Tracking:**

190

- Complete SQL statement history

191

- Execution time analysis

192

- Success/failure rates

193

- Most frequently executed queries

194

195

**Performance Metrics:**

196

- Query compilation times

197

- Execution duration breakdown

198

- Resource consumption per query

199

- Queue wait times for async operations

200

201

### Error Reporting

202

203

**Error Visualization:**

204

- Failed operation highlighting

205

- Error message display

206

- Stack traces for debugging

207

- Error trend analysis

208

209

**Troubleshooting Information:**

210

- Spark job correlation

211

- Resource allocation details

212

- Configuration impact analysis

213

- Performance bottleneck identification

214

215

The UI components provide comprehensive visibility into Thrift server operations, enabling administrators to monitor performance, troubleshoot issues, and optimize resource utilization across all client sessions and SQL operations.