Skip to content

Commit dfd9b49

Browse files
committed
[KYUUBI #7310] JSON metrics report path supports variables substitution
### Why are the changes needed? This PR enhances `kyuubi.metrics.json.location` to support variable substitution: `{{KYUUBI_HOME}}`, `{{KYUUBI_WORK_DIR_ROOT}}`, and changes the default value to `{{KYUUBI_HOME}}/metrics` - I suppose it is a more reasonable default value than `{{KYUUBI_WORK_DIR_ROOT}}/metrics`, given others dirs also under `KYUUBI_HOME` by default ``` export KYUUBI_LOG_DIR="${KYUUBI_LOG_DIR:-"${KYUUBI_HOME}/logs"}" export KYUUBI_PID_DIR="${KYUUBI_PID_DIR:-"${KYUUBI_HOME}/pid"}" export KYUUBI_WORK_DIR_ROOT="${KYUUBI_WORK_DIR_ROOT:-"${KYUUBI_HOME}/work"}" ``` To make things more consistent, variable substitution behavior is also updated for `kyuubi.metadata.store.jdbc.url` ### How was this patch tested? Manually tested by ``` bin/kyuubi run \ --conf kyuubi.metrics.reporters=JSON \ --conf kyuubi.metrics.json.location={{KYUUBI_HOME}}/metrics ``` ``` bin/kyuubi run \ --conf kyuubi.metrics.reporters=JSON \ --conf kyuubi.metrics.json.location={{KYUUBI_WORK_DIR_ROOT}}/metrics ``` and checks the metrics JSON file. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #7310 from pan3793/json-metrics. Closes #7310 71e4b28 [Cheng Pan] Update kyuubi-common/src/main/scala/org/apache/kyuubi/Utils.scala 1100283 [Cheng Pan] nit 2b27c38 [Cheng Pan] rename d6db4e2 [Cheng Pan] fix 0fb1165 [Cheng Pan] JSON metrics report path supports variables substitution Authored-by: Cheng Pan <chengpan@apache.org> Signed-off-by: Cheng Pan <chengpan@apache.org>
1 parent 69e8e95 commit dfd9b49

File tree

25 files changed

+80
-62
lines changed

25 files changed

+80
-62
lines changed

docs/configuration/settings.md

Lines changed: 12 additions & 12 deletions
Large diffs are not rendered by default.

docs/deployment/migration-guide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717

1818
# Kyuubi Migration Guide
1919

20+
## Upgrading from Kyuubi 1.11 to 1.12
21+
22+
* Since Kyuubi 1.12, the support of variable `<KYUUBI_HOME>` substitution in config `kyuubi.metadata.store.jdbc.url` is deprecated, use `{{KYUUBI_HOME}}` instead.
23+
* Since Kyuubi 1.12, default value of `kyuubi.metrics.json.location` is changed to `{{KYUUBI_HOME}}/metrics`, to restore previous behavior, change it to `{{KYUUBI_WORK_DIR_ROOT}}/metrics`.
24+
2025
## Upgrading from Kyuubi 1.10 to 1.11
2126

2227
* Since Kyuubi 1.11, the support of Spark engine for Spark 3.2 is removed.

externals/kyuubi-flink-sql-engine/src/test/scala/org/apache/kyuubi/engine/flink/WithFlinkSQLEngineLocal.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ trait WithFlinkSQLEngineLocal extends KyuubiFunSuite with WithFlinkTestResources
209209
}
210210
}.orElse {
211211
// 2. get the main resource jar from system build default
212-
env.get(KYUUBI_HOME).toSeq
212+
env.get(KYUUBI_HOME_ENV_VAR_NAME).toSeq
213213
.flatMap { p =>
214214
Seq(
215215
Paths.get(p, "externals", "engines", shortName, jarName),

externals/kyuubi-flink-sql-engine/src/test/scala/org/apache/kyuubi/engine/flink/WithFlinkSQLEngineOnYarn.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import org.apache.hadoop.yarn.server.MiniYARNCluster
3232

3333
import org.apache.kyuubi.{KYUUBI_VERSION, KyuubiFunSuite, SCALA_COMPILE_VERSION, Utils}
3434
import org.apache.kyuubi.config.KyuubiConf
35-
import org.apache.kyuubi.config.KyuubiConf.{ENGINE_FLINK_APPLICATION_JARS, KYUUBI_HOME}
35+
import org.apache.kyuubi.config.KyuubiConf.{ENGINE_FLINK_APPLICATION_JARS, KYUUBI_HOME_ENV_VAR_NAME}
3636
import org.apache.kyuubi.ha.HighAvailabilityConf.HA_ADDRESSES
3737
import org.apache.kyuubi.util.JavaUtils
3838
import org.apache.kyuubi.util.command.CommandLineUtils._
@@ -238,7 +238,7 @@ trait WithFlinkSQLEngineOnYarn extends KyuubiFunSuite with WithFlinkTestResource
238238
}
239239
}.orElse {
240240
// 2. get the main resource jar from system build default
241-
env.get(KYUUBI_HOME).toSeq
241+
env.get(KYUUBI_HOME_ENV_VAR_NAME).toSeq
242242
.flatMap { p =>
243243
Seq(
244244
Paths.get(p, "externals", "engines", shortName, jarName),

integration-tests/kyuubi-flink-it/src/test/scala/org/apache/kyuubi/it/flink/operation/FlinkOperationSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class FlinkOperationSuite extends WithKyuubiServerAndFlinkMiniCluster
2828
with HiveJDBCTestHelper {
2929

3030
override val conf: KyuubiConf = KyuubiConf()
31-
.set(s"$KYUUBI_ENGINE_ENV_PREFIX.$KYUUBI_HOME", kyuubiHome)
31+
.set(s"$KYUUBI_ENGINE_ENV_PREFIX.$KYUUBI_HOME_ENV_VAR_NAME", kyuubiHome)
3232
.set(ENGINE_TYPE, "FLINK_SQL")
3333
.set("flink.parallelism.default", "2")
3434

integration-tests/kyuubi-flink-it/src/test/scala/org/apache/kyuubi/it/flink/operation/FlinkOperationSuiteOnYarn.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class FlinkOperationSuiteOnYarn extends WithKyuubiServerAndYarnMiniCluster
3636

3737
override def beforeAll(): Unit = {
3838
conf
39-
.set(s"$KYUUBI_ENGINE_ENV_PREFIX.$KYUUBI_HOME", kyuubiHome)
39+
.set(s"$KYUUBI_ENGINE_ENV_PREFIX.$KYUUBI_HOME_ENV_VAR_NAME", kyuubiHome)
4040
.set(ENGINE_TYPE, "FLINK_SQL")
4141
.set("flink.execution.target", "yarn-application")
4242
.set("flink.parallelism.default", "2")

integration-tests/kyuubi-hive-it/src/test/scala/org/apache/kyuubi/it/hive/operation/KyuubiOperationHiveEnginePerConnectionSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class KyuubiOperationHiveEnginePerConnectionSuite extends WithKyuubiServer with
3434
metastore.toFile.delete()
3535
val currentUser = Utils.currentUser
3636
KyuubiConf()
37-
.set(s"$KYUUBI_ENGINE_ENV_PREFIX.$KYUUBI_HOME", kyuubiHome)
37+
.set(s"$KYUUBI_ENGINE_ENV_PREFIX.$KYUUBI_HOME_ENV_VAR_NAME", kyuubiHome)
3838
.set(ENGINE_TYPE, "HIVE_SQL")
3939
.set(ENGINE_SHARE_LEVEL, "connection")
4040
// increase this to 30s as hive session state and metastore client is slow initializing

integration-tests/kyuubi-hive-it/src/test/scala/org/apache/kyuubi/it/hive/operation/KyuubiOperationHiveEnginePerUserSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class KyuubiOperationHiveEnginePerUserSuite extends WithKyuubiServer with HiveEn
3131
val metastore = Utils.createTempDir(prefix = getClass.getSimpleName)
3232
metastore.toFile.delete()
3333
KyuubiConf()
34-
.set(s"$KYUUBI_ENGINE_ENV_PREFIX.$KYUUBI_HOME", kyuubiHome)
34+
.set(s"$KYUUBI_ENGINE_ENV_PREFIX.$KYUUBI_HOME_ENV_VAR_NAME", kyuubiHome)
3535
.set(ENGINE_TYPE, "HIVE_SQL")
3636
// increase this to 30s as hive session state and metastore client is slow initializing
3737
.setIfMissing(ENGINE_IDLE_TIMEOUT, 30000L)

integration-tests/kyuubi-hive-it/src/test/scala/org/apache/kyuubi/it/hive/operation/KyuubiOperationHiveEngineYarnModeSuite.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ package org.apache.kyuubi.it.hive.operation
1818

1919
import org.apache.kyuubi.{HiveEngineTests, Utils, WithKyuubiServerAndHadoopMiniCluster}
2020
import org.apache.kyuubi.config.KyuubiConf
21-
import org.apache.kyuubi.config.KyuubiConf.{ENGINE_IDLE_TIMEOUT, ENGINE_TYPE, KYUUBI_ENGINE_ENV_PREFIX, KYUUBI_HOME}
21+
import org.apache.kyuubi.config.KyuubiConf.{ENGINE_IDLE_TIMEOUT, ENGINE_TYPE, KYUUBI_ENGINE_ENV_PREFIX, KYUUBI_HOME_ENV_VAR_NAME}
2222
import org.apache.kyuubi.engine.deploy.DeployMode
2323

2424
class KyuubiOperationHiveEngineYarnModeSuite extends HiveEngineTests
@@ -28,7 +28,7 @@ class KyuubiOperationHiveEngineYarnModeSuite extends HiveEngineTests
2828
val metastore = Utils.createTempDir(prefix = getClass.getSimpleName)
2929
metastore.toFile.delete()
3030
KyuubiConf()
31-
.set(s"$KYUUBI_ENGINE_ENV_PREFIX.$KYUUBI_HOME", kyuubiHome)
31+
.set(s"$KYUUBI_ENGINE_ENV_PREFIX.$KYUUBI_HOME_ENV_VAR_NAME", kyuubiHome)
3232
.set(ENGINE_TYPE, "HIVE_SQL")
3333
.set(KyuubiConf.ENGINE_HIVE_DEPLOY_MODE, DeployMode.YARN.toString)
3434
// increase this to 30s as hive session state and metastore client is slow initializing

integration-tests/kyuubi-jdbc-it/src/test/scala/org/apache/kyuubi/it/jdbc/clickhouse/WithKyuubiServerAndClickHouseContainer.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import java.time.Duration
2121

2222
import org.apache.kyuubi.WithKyuubiServer
2323
import org.apache.kyuubi.config.KyuubiConf
24-
import org.apache.kyuubi.config.KyuubiConf.{ENGINE_IDLE_TIMEOUT, ENGINE_JDBC_EXTRA_CLASSPATH, KYUUBI_ENGINE_ENV_PREFIX, KYUUBI_HOME}
24+
import org.apache.kyuubi.config.KyuubiConf.{ENGINE_IDLE_TIMEOUT, ENGINE_JDBC_EXTRA_CLASSPATH, KYUUBI_ENGINE_ENV_PREFIX, KYUUBI_HOME_ENV_VAR_NAME}
2525
import org.apache.kyuubi.engine.jdbc.clickhouse.WithClickHouseEngine
2626
import org.apache.kyuubi.util.JavaUtils
2727

@@ -48,7 +48,7 @@ trait WithKyuubiServerAndClickHouseContainer extends WithKyuubiServer with WithC
4848

4949
override protected val conf: KyuubiConf = {
5050
KyuubiConf()
51-
.set(s"$KYUUBI_ENGINE_ENV_PREFIX.$KYUUBI_HOME", kyuubiHome)
51+
.set(s"$KYUUBI_ENGINE_ENV_PREFIX.$KYUUBI_HOME_ENV_VAR_NAME", kyuubiHome)
5252
.set(ENGINE_JDBC_EXTRA_CLASSPATH, clickHouseJdbcConnectorPath)
5353
.set(ENGINE_IDLE_TIMEOUT, Duration.ofMinutes(1).toMillis)
5454
}

0 commit comments

Comments
 (0)