Skip to content

Commit 2b0db16

Browse files
authored
fix the load of config file of metric module. (apache#7040)
1 parent ebe05c6 commit 2b0db16

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

metrics/interface/src/main/java/org/apache/iotdb/metrics/config/MetricConfigDescriptor.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,23 @@ public ReloadLevel loadHotProps() {
104104
private String getPropsUrl() {
105105
// first, try to get conf folder of standalone iotdb or datanode
106106
String url = System.getProperty(MetricConstant.IOTDB_CONF, null);
107+
if (url == null) {
108+
// try to get conf folder from IOTDB_HOME
109+
url = System.getProperty(MetricConstant.IOTDB_HOME, null);
110+
if (url != null) {
111+
url += File.separator + "conf";
112+
}
113+
}
107114
// second, try to get conf folder of datanode
108115
if (url == null) {
109116
url = System.getProperty(MetricConstant.CONFIGNODE_CONF, null);
117+
if (url == null) {
118+
// try to get conf folder from CONFIGNODE_HOME
119+
url = System.getProperty(MetricConstant.CONFIGNODE_HOME, null);
120+
if (url != null) {
121+
url += File.separator + "conf";
122+
}
123+
}
110124
}
111125
// finally, return null when not find
112126
if (url == null) {

metrics/interface/src/main/java/org/apache/iotdb/metrics/config/MetricConstant.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ private MetricConstant() {}
2525

2626
static final String IOTDB_CONF = "IOTDB_CONF";
2727

28+
static final String IOTDB_HOME = "IOTDB_HOME";
29+
2830
static final String CONFIGNODE_CONF = "CONFIGNODE_CONF";
2931

32+
static final String CONFIGNODE_HOME = "CONFIGNODE_HOME";
33+
3034
static final String CONFIG_NAME = "iotdb-metric.yml";
3135
}

0 commit comments

Comments
 (0)