Compare commits

..
Author SHA1 Message Date
Logic 821c62ba60 Merge branch 'master' into copy-token 2025-01-18 20:55:10 +08:00
Logic fbc1c0a29a Merge branch 'master' into copy-token 2025-01-17 23:25:58 +08:00
Logic 648064227f refactor(web-app): update alert integration modal button layout
- Swap OK and Cancel button positions in alert integration modal- Improve user experience by aligning with common UI practices
2025-01-17 23:05:53 +08:00
Logic a08fdd210c feat(alert): add copy button for alert integration token
- Add a copy button below the token display
- Implement copyToken() method to copy the token to clipboard
- Show a success notification after copying
2025-01-17 22:38:49 +08:00
73 changed files with 36645 additions and 37861 deletions
-73
View File
@@ -2225,79 +2225,6 @@
"contributions": [
"code"
]
},
{
"login": "helei1030",
"name": "helei1030",
"avatar_url": "https://avatars.githubusercontent.com/u/11839080?v=4",
"profile": "https://github.com/helei1030",
"contributions": [
"doc"
]
},
{
"login": "pjfanning",
"name": "PJ Fanning",
"avatar_url": "https://avatars.githubusercontent.com/u/11783444?v=4",
"profile": "https://medium.com/@pjfanning",
"contributions": [
"code"
]
},
{
"login": "MonsterChenzhuo",
"name": "monster",
"avatar_url": "https://avatars.githubusercontent.com/u/60029759?v=4",
"profile": "https://github.com/MonsterChenzhuo",
"contributions": [
"code"
]
},
{
"login": "MasamiYui",
"name": "Sherlock Yin",
"avatar_url": "https://avatars.githubusercontent.com/u/22274133?v=4",
"profile": "https://github.com/MasamiYui",
"contributions": [
"code"
]
},
{
"login": "wanhao23",
"name": "wanhao",
"avatar_url": "https://avatars.githubusercontent.com/u/29560961?v=4",
"profile": "https://github.com/wanhao23",
"contributions": [
"code",
"doc"
]
},
{
"login": "jonasHanhan",
"name": "jonasHanhan",
"avatar_url": "https://avatars.githubusercontent.com/u/130035609?v=4",
"profile": "https://github.com/jonasHanhan",
"contributions": [
"code"
]
},
{
"login": "NikhilMurugesan",
"name": "NikhilMurugesan",
"avatar_url": "https://avatars.githubusercontent.com/u/49281792?v=4",
"profile": "https://github.com/NikhilMurugesan",
"contributions": [
"code"
]
},
{
"login": "myangle1120",
"name": "myangle1120",
"avatar_url": "https://avatars.githubusercontent.com/u/19237013?v=4",
"profile": "https://github.com/myangle1120",
"contributions": [
"code"
]
}
],
"contributorsPerLine": 7,
-12
View File
@@ -496,18 +496,6 @@ Thanks to these wonderful people, welcome to join us:
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Suvrat1629"><img src="https://avatars.githubusercontent.com/u/140749446?v=4?s=100" width="100px;" alt="Suvrat1629"/><br /><sub><b>Suvrat1629</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=Suvrat1629" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://ghyghoo8.github.io/"><img src="https://avatars.githubusercontent.com/u/363129?v=4?s=100" width="100px;" alt="ghy"/><br /><sub><b>ghy</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=ghyghoo8" title="Code">💻</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/helei1030"><img src="https://avatars.githubusercontent.com/u/11839080?v=4?s=100" width="100px;" alt="helei1030"/><br /><sub><b>helei1030</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=helei1030" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://medium.com/@pjfanning"><img src="https://avatars.githubusercontent.com/u/11783444?v=4?s=100" width="100px;" alt="PJ Fanning"/><br /><sub><b>PJ Fanning</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=pjfanning" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/MonsterChenzhuo"><img src="https://avatars.githubusercontent.com/u/60029759?v=4?s=100" width="100px;" alt="monster"/><br /><sub><b>monster</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=MonsterChenzhuo" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/MasamiYui"><img src="https://avatars.githubusercontent.com/u/22274133?v=4?s=100" width="100px;" alt="Sherlock Yin"/><br /><sub><b>Sherlock Yin</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=MasamiYui" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/wanhao23"><img src="https://avatars.githubusercontent.com/u/29560961?v=4?s=100" width="100px;" alt="wanhao"/><br /><sub><b>wanhao</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=wanhao23" title="Code">💻</a> <a href="https://github.com/apache/hertzbeat/commits?author=wanhao23" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/jonasHanhan"><img src="https://avatars.githubusercontent.com/u/130035609?v=4?s=100" width="100px;" alt="jonasHanhan"/><br /><sub><b>jonasHanhan</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=jonasHanhan" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/NikhilMurugesan"><img src="https://avatars.githubusercontent.com/u/49281792?v=4?s=100" width="100px;" alt="NikhilMurugesan"/><br /><sub><b>NikhilMurugesan</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=NikhilMurugesan" title="Code">💻</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/myangle1120"><img src="https://avatars.githubusercontent.com/u/19237013?v=4?s=100" width="100px;" alt="myangle1120"/><br /><sub><b>myangle1120</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=myangle1120" title="Code">💻</a></td>
</tr>
</tbody>
</table>
-12
View File
@@ -495,18 +495,6 @@ Thanks these wonderful people, welcome to join us:
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Suvrat1629"><img src="https://avatars.githubusercontent.com/u/140749446?v=4?s=100" width="100px;" alt="Suvrat1629"/><br /><sub><b>Suvrat1629</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=Suvrat1629" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://ghyghoo8.github.io/"><img src="https://avatars.githubusercontent.com/u/363129?v=4?s=100" width="100px;" alt="ghy"/><br /><sub><b>ghy</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=ghyghoo8" title="Code">💻</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/helei1030"><img src="https://avatars.githubusercontent.com/u/11839080?v=4?s=100" width="100px;" alt="helei1030"/><br /><sub><b>helei1030</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=helei1030" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://medium.com/@pjfanning"><img src="https://avatars.githubusercontent.com/u/11783444?v=4?s=100" width="100px;" alt="PJ Fanning"/><br /><sub><b>PJ Fanning</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=pjfanning" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/MonsterChenzhuo"><img src="https://avatars.githubusercontent.com/u/60029759?v=4?s=100" width="100px;" alt="monster"/><br /><sub><b>monster</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=MonsterChenzhuo" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/MasamiYui"><img src="https://avatars.githubusercontent.com/u/22274133?v=4?s=100" width="100px;" alt="Sherlock Yin"/><br /><sub><b>Sherlock Yin</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=MasamiYui" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/wanhao23"><img src="https://avatars.githubusercontent.com/u/29560961?v=4?s=100" width="100px;" alt="wanhao"/><br /><sub><b>wanhao</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=wanhao23" title="Code">💻</a> <a href="https://github.com/apache/hertzbeat/commits?author=wanhao23" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/jonasHanhan"><img src="https://avatars.githubusercontent.com/u/130035609?v=4?s=100" width="100px;" alt="jonasHanhan"/><br /><sub><b>jonasHanhan</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=jonasHanhan" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/NikhilMurugesan"><img src="https://avatars.githubusercontent.com/u/49281792?v=4?s=100" width="100px;" alt="NikhilMurugesan"/><br /><sub><b>NikhilMurugesan</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=NikhilMurugesan" title="Code">💻</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/myangle1120"><img src="https://avatars.githubusercontent.com/u/19237013?v=4?s=100" width="100px;" alt="myangle1120"/><br /><sub><b>myangle1120</b></sub></a><br /><a href="https://github.com/apache/hertzbeat/commits?author=myangle1120" title="Code">💻</a></td>
</tr>
</tbody>
</table>
@@ -1,32 +0,0 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
alerter.availability.recover = 可用性警報已解決,監視狀態現在正常
alerter.alarm.recover = 警報解決通知
alerter.notify.title = HertzBeat 警報通知
alerter.notify.target = 監視目標
alerter.notify.monitorId = 監視 ID
alerter.notify.monitorName = 監視名稱
alerter.notify.monitorHost = 監視主機
alerter.notify.priority = 警報優先級
alerter.notify.triggerTime = 警報觸發時間
alerter.notify.restoreTime = 警報恢復時間
alerter.notify.times = 警報觸發次數
alerter.notify.tags = 警報標籤
alerter.notify.content = 警報內容
alerter.notify.console = 控制台登錄
alerter.priority.0 = 緊急警報
alerter.priority.1 = 嚴重警報
alerter.priority.2 = 警告警報
@@ -33,7 +33,6 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.util.List;
import org.apache.hertzbeat.alert.dto.AlertDefineDTO;
import org.apache.hertzbeat.alert.dto.ExportAlertDefineDTO;
@@ -69,7 +68,7 @@ class AlertDefineJsonImExportServiceTest {
@BeforeEach
public void setup() {
inputStream = new ByteArrayInputStream(JSON_DATA.getBytes(StandardCharsets.UTF_8));
inputStream = new ByteArrayInputStream(JSON_DATA.getBytes());
AlertDefineDTO alertDefine = new AlertDefineDTO();
alertDefine.setName("App1");
@@ -39,6 +39,7 @@ import org.apache.hertzbeat.alert.dto.ExportAlertDefineDTO;
import org.apache.hertzbeat.alert.service.impl.AlertDefineYamlImExportServiceImpl;
import org.apache.hertzbeat.common.util.JsonUtil;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
@@ -47,7 +48,8 @@ import org.yaml.snakeyaml.Yaml;
/**
* test case for {@link AlertDefineYamlImExportServiceImpl}
*/
*/
@Disabled
@ExtendWith(MockitoExtension.class)
class AlertDefineYamlImExportServiceTest {
@@ -17,27 +17,22 @@
package org.apache.hertzbeat.alert.service;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Optional;
import org.apache.hertzbeat.alert.dao.AlertGroupConvergeDao;
import org.apache.hertzbeat.alert.reduce.AlarmGroupReduce;
import org.apache.hertzbeat.alert.service.impl.AlertGroupConvergeServiceImpl;
import org.apache.hertzbeat.common.entity.alerter.AlertGroupConverge;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyList;
import static org.mockito.ArgumentMatchers.anySet;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.util.Collections;
import java.util.Optional;
import java.util.Set;
import org.apache.hertzbeat.alert.dao.AlertGroupConvergeDao;
import org.apache.hertzbeat.alert.service.impl.AlertGroupConvergeServiceImpl;
import org.apache.hertzbeat.common.entity.alerter.AlertGroupConverge;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
@@ -47,9 +42,10 @@ import org.springframework.data.jpa.domain.Specification;
/**
* test case for {@link AlertGroupConvergeServiceImpl}
*/
*/
@ExtendWith(MockitoExtension.class)
@Disabled
class AlertGroupConvergeServiceTest {
@Mock
@@ -58,28 +54,22 @@ class AlertGroupConvergeServiceTest {
@InjectMocks
private AlertGroupConvergeServiceImpl alertGroupConvergeService;
@Mock
private AlarmGroupReduce alarmGroupReduce;
@Test
public void testAddAlertGroupConverge() {
AlertGroupConverge alertGroupConverge = new AlertGroupConverge();
doNothing().when(alarmGroupReduce).refreshGroupDefines(anyList());
when(alertGroupConvergeDao.save(alertGroupConverge)).thenReturn(alertGroupConverge);
alertGroupConvergeService.addAlertGroupConverge(alertGroupConverge);
verify(alertGroupConvergeDao, times(1)).save(alertGroupConverge);
verify(alarmGroupReduce, times(1)).refreshGroupDefines(anyList());
}
AlertGroupConverge alertGroupConverge = new AlertGroupConverge();
alertGroupConvergeService.addAlertGroupConverge(alertGroupConverge);
verify(alertGroupConvergeDao, times(1)).save(alertGroupConverge);
}
@Test
public void testModifyAlertGroupConverge() {
AlertGroupConverge alertGroupConverge = new AlertGroupConverge();
doNothing().when(alarmGroupReduce).refreshGroupDefines(anyList());
when(alertGroupConvergeDao.save(alertGroupConverge)).thenReturn(alertGroupConverge);
alertGroupConvergeService.modifyAlertGroupConverge(alertGroupConverge);
verify(alertGroupConvergeDao, times(1)).save(alertGroupConverge);
verify(alarmGroupReduce, times(1)).refreshGroupDefines(anyList());
}
@Test
@@ -89,6 +79,7 @@ class AlertGroupConvergeServiceTest {
AlertGroupConverge alertGroupConverge = new AlertGroupConverge();
when(alertGroupConvergeDao.findById(convergeId)).thenReturn(Optional.of(alertGroupConverge));
AlertGroupConverge result = alertGroupConvergeService.getAlertGroupConverge(convergeId);
verify(alertGroupConvergeDao, times(1)).findById(convergeId);
assertEquals(alertGroupConverge, result);
}
@@ -96,11 +87,10 @@ class AlertGroupConvergeServiceTest {
@Test
public void testDeleteAlertGroupConverges() {
doNothing().when(alertGroupConvergeDao).deleteAlertGroupConvergesByIdIn(anySet());
doNothing().when(alarmGroupReduce).refreshGroupDefines(anyList());
alertGroupConvergeService.deleteAlertGroupConverges(new HashSet<>(Arrays.asList(1L, 2L)));
verify(alertGroupConvergeDao, times(1)).deleteAlertGroupConvergesByIdIn(anySet());
verify(alarmGroupReduce, times(1)).refreshGroupDefines(anyList());
Set<Long> convergeIds = Set.of(1L, 2L, 3L);
alertGroupConvergeService.deleteAlertGroupConverges(convergeIds);
verify(alertGroupConvergeDao, times(1)).deleteAlertGroupConvergesByIdIn(convergeIds);
}
@Test
@@ -17,23 +17,25 @@
package org.apache.hertzbeat.alert.service;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.util.Collections;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import org.apache.hertzbeat.alert.dao.GroupAlertDao;
import org.apache.hertzbeat.alert.dao.SingleAlertDao;
import org.apache.hertzbeat.alert.dto.AlertSummary;
import org.apache.hertzbeat.alert.reduce.AlarmCommonReduce;
import org.apache.hertzbeat.alert.service.impl.AlertServiceImpl;
import org.apache.hertzbeat.common.constants.CommonConstants;
import org.apache.hertzbeat.common.entity.alerter.SingleAlert;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
@@ -42,8 +44,9 @@ import org.mockito.junit.jupiter.MockitoExtension;
/**
* Test case for {@link AlertService}
*/
*/
@ExtendWith(MockitoExtension.class)
@Disabled
class AlertServiceTest {
@Mock
private GroupAlertDao groupAlertDao;
@@ -80,23 +83,14 @@ class AlertServiceTest {
}
@Test
void testGetAlertsSummary() {
SingleAlert alert = new SingleAlert();
alert.setLabels(Collections.singletonMap(CommonConstants.LABEL_ALERT_SEVERITY, CommonConstants.ALERT_SEVERITY_CRITICAL));
void getAlertsSummary() {
List<SingleAlert> singleAlerts = new ArrayList<>();
singleAlerts.add(SingleAlert.builder().status("firing")
.labels(Map.of(CommonConstants.LABEL_ALERT_SEVERITY, "warning")).build());
when(singleAlertDao.querySingleAlertsByStatus(any())).thenReturn(singleAlerts);
when(singleAlertDao.count()).thenReturn(1L);
when(singleAlertDao.querySingleAlertsByStatus(CommonConstants.ALERT_STATUS_FIRING)).thenReturn(Collections.singletonList(alert));
when(singleAlertDao.count()).thenReturn(10L);
AlertSummary summary = alertService.getAlertsSummary();
assertNotNull(summary);
assertEquals(1, summary.getPriorityCriticalNum());
assertEquals(0, summary.getPriorityEmergencyNum());
assertEquals(0, summary.getPriorityWarningNum());
assertEquals(10L, summary.getTotal());
assertEquals(90.0f, summary.getRate());
verify(singleAlertDao, times(1)).querySingleAlertsByStatus(CommonConstants.ALERT_STATUS_FIRING);
verify(singleAlertDao, times(1)).count();
assertDoesNotThrow(() -> alertService.getAlertsSummary());
assertNotNull(alertService.getAlertsSummary());
}
}
@@ -41,6 +41,7 @@ import javax.net.ssl.SSLException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.net.util.Base64;
import org.apache.hertzbeat.collector.collect.AbstractCollect;
import org.apache.hertzbeat.collector.collect.common.http.CommonHttpClient;
import org.apache.hertzbeat.collector.collect.http.promethus.AbstractPrometheusParse;
@@ -58,7 +59,6 @@ import org.apache.hertzbeat.common.constants.SignConstants;
import org.apache.hertzbeat.common.entity.job.Metrics;
import org.apache.hertzbeat.common.entity.job.protocol.HttpProtocol;
import org.apache.hertzbeat.common.entity.message.CollectRep;
import org.apache.hertzbeat.common.util.Base64Util;
import org.apache.hertzbeat.common.util.CommonUtil;
import org.apache.hertzbeat.common.util.IpDomainUtil;
import org.apache.http.Header;
@@ -153,7 +153,7 @@ public class HttpCollectImpl extends AbstractCollect {
case DispatchConstants.PARSE_XML_PATH ->
parseResponseByXmlPath(resp, metrics.getAliasFields(), metrics.getHttp(), builder);
case DispatchConstants.PARSE_WEBSITE ->
parseResponseByWebsite(resp, metrics, metrics.getHttp(), builder, responseTime);
parseResponseByWebsite(resp, metrics, metrics.getHttp(), builder, responseTime, response);
case DispatchConstants.PARSE_SITE_MAP ->
parseResponseBySiteMap(resp, metrics.getAliasFields(), builder);
case DispatchConstants.PARSE_HEADER ->
@@ -222,7 +222,8 @@ public class HttpCollectImpl extends AbstractCollect {
}
private void parseResponseByWebsite(String resp, Metrics metrics, HttpProtocol http,
CollectRep.MetricsData.Builder builder, Long responseTime) {
CollectRep.MetricsData.Builder builder, Long responseTime,
CloseableHttpResponse response) {
CollectRep.ValueRow.Builder valueRowBuilder = CollectRep.ValueRow.newBuilder();
int keywordNum = CollectUtil.countMatchKeyword(resp, http.getKeyword());
for (String alias : metrics.getAliasFields()) {
@@ -289,10 +290,9 @@ public class HttpCollectImpl extends AbstractCollect {
long startTime = System.currentTimeMillis();
try {
HttpGet httpGet = new HttpGet(siteUrl);
try (CloseableHttpResponse response = CommonHttpClient.getHttpClient().execute(httpGet)) {
statusCode = response.getStatusLine().getStatusCode();
EntityUtils.consume(response.getEntity());
}
CloseableHttpResponse response = CommonHttpClient.getHttpClient().execute(httpGet);
statusCode = response.getStatusLine().getStatusCode();
EntityUtils.consume(response.getEntity());
} catch (ClientProtocolException e1) {
if (e1.getCause() != null) {
errorMsg = e1.getCause().getMessage();
@@ -549,7 +549,7 @@ public class HttpCollectImpl extends AbstractCollect {
if (StringUtils.hasText(authorization.getBasicAuthUsername())
&& StringUtils.hasText(authorization.getBasicAuthPassword())) {
String authStr = authorization.getBasicAuthUsername() + SignConstants.DOUBLE_MARK + authorization.getBasicAuthPassword();
String encodedAuth = Base64Util.encode(authStr);
String encodedAuth = new String(Base64.encodeBase64(authStr.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8);
requestBuilder.addHeader(HttpHeaders.AUTHORIZATION, DispatchConstants.BASIC + SignConstants.BLANK + encodedAuth);
}
}
@@ -17,6 +17,7 @@
package org.apache.hertzbeat.collector.collect.http.promethus.exporter;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -418,7 +419,7 @@ public class ExporterParser {
* @return true/false
*/
private boolean isValidLabelValue(String s) {
return s != null;
return s != null && s.equals(new String(s.getBytes(StandardCharsets.UTF_8)));
}
private boolean isSum(String s) {
@@ -32,6 +32,7 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.net.ssl.SSLException;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.net.util.Base64;
import org.apache.hertzbeat.collector.collect.common.http.CommonHttpClient;
import org.apache.hertzbeat.collector.collect.prometheus.parser.MetricFamily;
import org.apache.hertzbeat.collector.collect.prometheus.parser.TextParser;
@@ -43,7 +44,6 @@ import org.apache.hertzbeat.common.constants.SignConstants;
import org.apache.hertzbeat.common.entity.job.Metrics;
import org.apache.hertzbeat.common.entity.job.protocol.PrometheusProtocol;
import org.apache.hertzbeat.common.entity.message.CollectRep;
import org.apache.hertzbeat.common.util.Base64Util;
import org.apache.hertzbeat.common.util.CommonUtil;
import org.apache.hertzbeat.common.util.IpDomainUtil;
import org.apache.http.HttpHeaders;
@@ -89,8 +89,9 @@ public class PrometheusAutoCollectImpl {
}
HttpContext httpContext = createHttpContext(metrics.getPrometheus());
HttpUriRequest request = createHttpRequest(metrics.getPrometheus());
try (CloseableHttpResponse response =
CommonHttpClient.getHttpClient().execute(request, httpContext)) {
try {
CloseableHttpResponse response = CommonHttpClient.getHttpClient()
.execute(request, httpContext);
int statusCode = response.getStatusLine().getStatusCode();
boolean isSuccessInvoke = defaultSuccessStatusCodes.contains(statusCode);
log.debug("http response status: {}", statusCode);
@@ -277,7 +278,7 @@ public class PrometheusAutoCollectImpl {
if (StringUtils.hasText(authorization.getBasicAuthUsername())
&& StringUtils.hasText(authorization.getBasicAuthPassword())) {
String authStr = authorization.getBasicAuthUsername() + ":" + authorization.getBasicAuthPassword();
String encodedAuth = Base64Util.encode(authStr);
String encodedAuth = new String(Base64.encodeBase64(authStr.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8);
requestBuilder.addHeader(HttpHeaders.AUTHORIZATION, DispatchConstants.BASIC + " " + encodedAuth);
}
}
@@ -17,6 +17,7 @@
package org.apache.hertzbeat.collector.collect.prometheus.parser;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
@@ -299,6 +300,6 @@ public class TextParser {
* @return true/false
*/
private static boolean isValidLabelValue(String s) {
return s != null;
return s != null && s.equals(new String(s.getBytes(StandardCharsets.UTF_8)));
}
}
@@ -86,7 +86,8 @@ public class PushCollectImpl extends AbstractCollect {
HttpContext httpContext = createHttpContext(pushProtocol);
HttpUriRequest request = createHttpRequest(pushProtocol, monitorId, time);
try (CloseableHttpResponse response = CommonHttpClient.getHttpClient().execute(request, httpContext)) {
try {
CloseableHttpResponse response = CommonHttpClient.getHttpClient().execute(request, httpContext);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != SUCCESS_CODE) {
builder.setCode(CollectRep.Code.FAIL);
@@ -20,7 +20,6 @@ package org.apache.hertzbeat.collector.collect.telnet;
import java.io.IOException;
import java.io.OutputStream;
import java.net.ConnectException;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@@ -123,7 +122,7 @@ public class TelnetCollectImpl extends AbstractCollect {
return new HashMap<>(16);
}
OutputStream outputStream = telnetClient.getOutputStream();
outputStream.write(cmd.getBytes(StandardCharsets.UTF_8));
outputStream.write(cmd.getBytes());
outputStream.flush();
String result = new String(telnetClient.getInputStream().readAllBytes());
String[] lines = result.split("\n");
@@ -28,7 +28,6 @@ import java.net.Socket;
import java.net.SocketAddress;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
import java.nio.charset.StandardCharsets;
import java.security.SecureRandom;
import java.util.Base64;
import java.util.HashMap;
@@ -129,16 +128,16 @@ public class WebsocketCollectImpl extends AbstractCollect {
byte[] key = generateRandomKey();
String base64Key = base64Encode(key);
String requestLine = "GET " + websocketProtocol.getPath() + " HTTP/1.1\r\n";
out.write(requestLine.getBytes(StandardCharsets.UTF_8));
out.write(requestLine.getBytes());
String hostName = InetAddress.getLocalHost().getHostAddress();
out.write(("Host:" + hostName + "\r\n").getBytes(StandardCharsets.UTF_8));
out.write("Upgrade: websocket\r\n".getBytes(StandardCharsets.UTF_8));
out.write("Connection: Upgrade\r\n".getBytes(StandardCharsets.UTF_8));
out.write("Sec-WebSocket-Version: 13\r\n".getBytes(StandardCharsets.UTF_8));
out.write("Sec-WebSocket-Extensions: chat, superchat\r\n".getBytes(StandardCharsets.UTF_8));
out.write(("Sec-WebSocket-Key: " + base64Key + "\r\n").getBytes(StandardCharsets.UTF_8));
out.write("Content-Length: 0\r\n".getBytes(StandardCharsets.UTF_8));
out.write("\r\n".getBytes(StandardCharsets.UTF_8));
out.write(("Host:" + hostName + "\r\n").getBytes());
out.write("Upgrade: websocket\r\n".getBytes());
out.write("Connection: Upgrade\r\n".getBytes());
out.write("Sec-WebSocket-Version: 13\r\n".getBytes());
out.write("Sec-WebSocket-Extensions: chat, superchat\r\n".getBytes());
out.write(("Sec-WebSocket-Key: " + base64Key + "\r\n").getBytes());
out.write("Content-Length: 0\r\n".getBytes());
out.write("\r\n".getBytes());
out.flush();
}
@@ -144,25 +144,12 @@ public class CommonHttpClient {
ScheduledExecutorService scheduledExecutor = Executors.newScheduledThreadPool(1, threadFactory);
scheduledExecutor.scheduleWithFixedDelay(() -> {
connectionManager.closeExpiredConnections();
connectionManager.closeIdleConnections(40, TimeUnit.SECONDS);
connectionManager.closeIdleConnections(100, TimeUnit.SECONDS);
}, 40L, 40L, TimeUnit.SECONDS);
// shutdown hook
Runtime.getRuntime().addShutdownHook(new Thread(CommonHttpClient::close));
} catch (Exception ignored) {}
}
public static CloseableHttpClient getHttpClient() {
return httpClient;
}
public static void close() {
try {
httpClient.close();
} catch (Exception e) {
log.error("close http client error", e);
}
}
}
@@ -94,11 +94,13 @@ public class NebulaGraphCollectImpl extends AbstractCollect {
String resp;
long responseTime;
HashMap<String, String> resultMap = new HashMap<>(64);
CloseableHttpResponse response;
HttpContext httpContext = createHttpContext(nebulaGraph.getHost(), nebulaGraph.getPort());
HttpUriRequest request = createHttpRequest(nebulaGraph.getHost(), nebulaGraph.getPort(),
nebulaGraph.getUrl(), nebulaGraph.getTimeout());
// Send an HTTP request to obtain response data
try (CloseableHttpResponse response = CommonHttpClient.getHttpClient().execute(request, httpContext)) {
try {
// Send an HTTP request to obtain response data
response = CommonHttpClient.getHttpClient().execute(request, httpContext);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != SUCCESS_CODE) {
builder.setCode(CollectRep.Code.FAIL);
@@ -25,12 +25,13 @@ import java.util.Arrays;
public enum AiTypeEnum {
/**
* ZhiPu
* 智普
*/
zhiPu,
/**
* sparkDesk
* 科大讯飞
*/
sparkDesk,
@@ -25,7 +25,7 @@ public interface NetworkConstants {
String KEEP_ALIVE = "Keep-Alive";
String USER_AGENT = "Mozilla/5.0 (Windows NT 6.1; WOW64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.76 Safari/537.36";
String USER_AGENT = "Mozilla/5.0 (Windows NT 6.1; WOW64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.76 Safari/537.36\")";
String IPV6 = "ipv6";
@@ -59,8 +59,14 @@ public interface NetworkConstants {
int READ_TIME_OUT = 6 * 1000;
int WRITE_TIME_OUT = 6 * 1000;
int CONNECT_TIME_OUT = 6 * 1000;
int CHUNK_SIZE = 8196;
int MAX_IDLE_CONNECTIONS = 20;
int KEEP_ALIVE_TIMEOUT = 30 * 1000;
int HTTP_CLIENT_CONNECTION_MANAGER_MAX_PER_ROUTE = 20;
int HTTP_CLIENT_CONNECTION_MANAGER_MAX_TOTAL = 20;
int HTTPCLIENT_KEEP_ALIVE_DURATION = 30 * 1000;
int HTTP_CLIENT_CONNECTION_MANAGER_CLOSE_WAIT_TIME_MS = 1000;
int HTTP_CLIENT_CONNECTION_MANAGER_CLOSE_IDLE_TIME_S = 30;
}
}
@@ -52,7 +52,7 @@ public class RocketmqProtocol implements CommonRequestProtocol, Protocol {
private String secretKey;
/**
* jsonpath parsing script
* jsonpath解析脚本
*/
private String parseScript;
@@ -22,7 +22,6 @@ package org.apache.hertzbeat.common.entity.message;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.channels.Channels;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -407,7 +406,7 @@ public final class CollectRep {
fieldIndex < row.getColumnsList().size()) {
String value = row.getColumns(fieldIndex);
if (value != null) {
vector.set(rowIndex, value.getBytes(StandardCharsets.UTF_8));
vector.set(rowIndex, value.getBytes());
}
}
}
@@ -90,7 +90,7 @@ public final class AesUtil {
// encode content to byte array
byte[] byteAes = cipher.doFinal(byteEncode);
// base64 encode content
return Base64.getEncoder().encodeToString(byteAes);
return new String(Base64.getEncoder().encode(byteAes), StandardCharsets.UTF_8);
} catch (Exception e) {
log.error("aes encode content error: {}", e.getMessage(), e);
return content;
@@ -17,7 +17,6 @@
package org.apache.hertzbeat.common.util;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
/**
@@ -40,8 +39,4 @@ public final class Base64Util {
return false;
}
}
public static String encode(String str) {
return Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8));
}
}
@@ -22,7 +22,6 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.channels.Channels;
import java.nio.charset.StandardCharsets;
import java.util.Map;
import org.apache.arrow.vector.VectorSchemaRoot;
import org.apache.arrow.vector.ipc.ArrowStreamWriter;
@@ -87,7 +86,7 @@ class KafkaMetricsDataDeserializerTest {
@Test
void testDeserializeWithInvalidBytes() {
byte[] invalidBytes = "invalid data".getBytes(StandardCharsets.UTF_8);
byte[] invalidBytes = "invalid data".getBytes();
assertThrows(RuntimeException.class, () -> deserializer.deserialize("", invalidBytes));
}
@@ -24,8 +24,6 @@ import org.junit.jupiter.api.Test;
import org.springframework.http.MediaType;
import org.springframework.mock.web.MockMultipartFile;
import java.nio.charset.StandardCharsets;
/**
* test case for {@link FileUtil}.
*/
@@ -43,12 +41,9 @@ class FileUtilTest {
@BeforeEach
void setUp() {
jsonFile = new MockMultipartFile("file", "test.json", MediaType.APPLICATION_JSON_VALUE,
"test content".getBytes(StandardCharsets.UTF_8));
excelFile = new MockMultipartFile("file", "test.xlsx", EXCEL_TYPE,
"test content".getBytes(StandardCharsets.UTF_8));
yamlFile = new MockMultipartFile("file", "test.yaml", YAML_TYPE,
"test content".getBytes(StandardCharsets.UTF_8));
jsonFile = new MockMultipartFile("file", "test.json", MediaType.APPLICATION_JSON_VALUE, "test content".getBytes());
excelFile = new MockMultipartFile("file", "test.xlsx", EXCEL_TYPE, "test content".getBytes());
yamlFile = new MockMultipartFile("file", "test.yaml", YAML_TYPE, "test content".getBytes());
emptyFile = new MockMultipartFile("file", "", null, (byte[]) null);
}
@@ -40,7 +40,6 @@ import org.springframework.util.ResourceUtils;
import java.io.IOException;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.HashMap;
import java.util.LinkedList;
@@ -104,10 +103,9 @@ public class DockerMonitorE2eTest extends AbstractCollectE2eTest {
private void sendJsonResponse(HttpExchange exchange, String response) throws IOException {
exchange.getResponseHeaders().set("Content-Type", "application/json");
final byte[] array = response.getBytes(StandardCharsets.UTF_8);
exchange.sendResponseHeaders(200, array.length);
exchange.sendResponseHeaders(200, response.getBytes().length);
try (OutputStream os = exchange.getResponseBody()) {
os.write(array);
os.write(response.getBytes());
}
}
@@ -1,123 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hertzbeat.collector.collect.basic.http;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpServer;
import lombok.extern.slf4j.Slf4j;
import org.apache.hertzbeat.collector.collect.AbstractCollectE2eTest;
import org.apache.hertzbeat.collector.collect.http.HttpCollectImpl;
import org.apache.hertzbeat.collector.util.CollectUtil;
import org.apache.hertzbeat.common.entity.job.Configmap;
import org.apache.hertzbeat.common.entity.job.Job;
import org.apache.hertzbeat.common.entity.job.Metrics;
import org.apache.hertzbeat.common.entity.job.protocol.HttpProtocol;
import org.apache.hertzbeat.common.entity.job.protocol.Protocol;
import org.apache.hertzbeat.common.entity.message.CollectRep;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.boot.test.context.SpringBootTest;
import java.io.IOException;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
/**
* E2E test for HTTP monitor
*/
@Slf4j
@ExtendWith(MockitoExtension.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class HttpMonitorE2eTest extends AbstractCollectE2eTest {
private static final int MOCK_SERVER_PORT = 52376;
private static final String LOCALHOST = "127.0.0.1";
private static final String RELATIVE_PATH = "/";
private static HttpServer mockServer;
@AfterAll
public static void tearDown() {
if (mockServer != null) {
mockServer.stop(0);
}
}
@BeforeEach
public void setUp() throws Exception {
super.setUp();
// Setup collect instance
collect = new HttpCollectImpl();
// Setup mock server and endpoints
mockServer = HttpServer.create(new InetSocketAddress(MOCK_SERVER_PORT), 0);
mockServer.setExecutor(null);
mockServer.start();
mockServer.createContext(RELATIVE_PATH, exchange -> sendJsonResponse(exchange, ""));
}
private void sendJsonResponse(HttpExchange exchange, String response) throws IOException {
exchange.getResponseHeaders().set("Content-Type", "application/json");
final byte[] array = response.getBytes(StandardCharsets.UTF_8);
exchange.sendResponseHeaders(200, array.length);
try (OutputStream os = exchange.getResponseBody()) {
os.write(array);
}
}
@Test
public void testHttpMonitor() {
Job dockerJob = appService.getAppDefine("api");
List<Map<String, Configmap>> configmapFromPreCollectData = new LinkedList<>();
for (Metrics metricsDef : dockerJob.getMetrics()) {
metricsDef = CollectUtil.replaceCryPlaceholderToMetrics(metricsDef, configmapFromPreCollectData.size() > 0 ? configmapFromPreCollectData.get(0) : new HashMap<>());
CollectRep.MetricsData metricsData = validateMetricsCollection(metricsDef, metricsDef.getName());
configmapFromPreCollectData = CollectUtil.getConfigmapFromPreCollectData(metricsData);
}
}
@Override
protected Protocol buildProtocol(Metrics metricsDef) {
// Setup HTTP protocol
HttpProtocol protocol = new HttpProtocol();
protocol.setHost(LOCALHOST);
protocol.setUrl(RELATIVE_PATH);
protocol.setMethod("GET");
protocol.setPort(String.valueOf(MOCK_SERVER_PORT));
protocol.setParseType(metricsDef.getHttp().getParseType());
protocol.setParseScript(metricsDef.getHttp().getParseScript());
return protocol;
}
@Override
protected CollectRep.MetricsData.Builder collectMetrics(Metrics metricsDef) {
HttpProtocol protocol = (HttpProtocol) buildProtocol(metricsDef);
metrics.setHttp(protocol);
return collectMetricsData(metrics, metricsDef);
}
}
@@ -25,8 +25,6 @@ import static org.apache.hertzbeat.grafana.common.GrafanaConstants.GET_SERVICE_A
import static org.apache.hertzbeat.grafana.common.GrafanaConstants.GRAFANA_CONFIG;
import com.fasterxml.jackson.databind.JsonNode;
import jakarta.annotation.PostConstruct;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.Objects;
import lombok.extern.slf4j.Slf4j;
@@ -194,9 +192,9 @@ public class ServiceAccountService {
private HttpHeaders createHeaders() {
String auth = username + SignConstants.DOUBLE_MARK + password;
String encodedAuth = Base64.getEncoder().encodeToString(auth.getBytes(StandardCharsets.UTF_8));
byte[] encodedAuth = Base64.getEncoder().encode(auth.getBytes());
String authHeader = NetworkConstants.BASIC
+ SignConstants.BLANK + encodedAuth;
+ SignConstants.BLANK + new String(encodedAuth);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
@@ -17,11 +17,10 @@
package org.apache.hertzbeat.manager.scheduler;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
/**
* List of assigned collection tasks
@@ -34,17 +33,17 @@ public class AssignJobs {
* current assign jobIds
*/
private Set<Long> jobs;
/**
* jobs to be adding
*/
private Set<Long> addingJobs;
/**
* jobs to be removed
*/
private Set<Long> removingJobs;
/**
* jobs has pinned in this collector
*/
@@ -60,15 +59,15 @@ public class AssignJobs {
public void addAssignJob(Long jobId) {
jobs.add(jobId);
}
public void addAddingJob(Long jobId) {
addingJobs.add(jobId);
}
public void addRemovingJob(Long jobId) {
removingJobs.add(jobId);
}
public void addPinnedJob(Long jobId) {
pinnedJobs.add(jobId);
}
@@ -78,19 +77,19 @@ public class AssignJobs {
jobs.addAll(jobSet);
}
}
public void addAddingJobs(Set<Long> jobSet) {
if (jobSet != null && !jobSet.isEmpty()) {
addingJobs.addAll(jobSet);
}
}
public void addRemovingJobs(Set<Long> jobSet) {
if (jobSet != null && !jobSet.isEmpty()) {
removingJobs.addAll(jobSet);
}
}
public void addPinnedJobs(Set<Long> jobSet) {
if (jobSet != null && !jobSet.isEmpty()) {
pinnedJobs.addAll(jobSet);
@@ -103,14 +102,14 @@ public class AssignJobs {
}
jobs.removeAll(jobIds);
}
public void removeAddingJobs(Set<Long> jobIds) {
if (addingJobs == null || jobIds == null || jobIds.isEmpty()) {
return;
}
addingJobs.removeAll(jobIds);
}
public void clearRemovingJobs() {
if (removingJobs == null) {
return;
@@ -119,10 +118,9 @@ public class AssignJobs {
}
/**
* Check if the corresponding jobId exists
*
* 判断是否存在对应的jobId
* @param jobId jobId
* @return true if exists and removes the jobId from assignJobs
* @return 若存在返回true,并把jobId从assignJobs remove掉
*/
public boolean containAndRemoveJob(Long jobId) {
if (jobs.isEmpty()) {
@@ -130,21 +128,21 @@ public class AssignJobs {
}
return jobs.remove(jobId);
}
public void removeAddingJob(Long jobId) {
if (addingJobs == null || jobId == null) {
return;
}
addingJobs.remove(jobId);
}
public void removeRemovingJob(Long jobId) {
if (removingJobs == null || jobId == null) {
return;
}
removingJobs.remove(jobId);
}
public void removePinnedJob(Long jobId) {
if (pinnedJobs == null || jobId == null) {
return;
@@ -153,7 +151,7 @@ public class AssignJobs {
}
/**
* Clean data
* 清理数据
*/
public void clear() {
if (!jobs.isEmpty()) {
@@ -1,331 +0,0 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
category: bigdata
app: starrocks_be
name:
zh-CN: StarRocks BE
en-US: StarRocks BE
help:
zh-CN: Hertzbeat 对 StarRocks 数据库BE的核心监控指标(CPU使用率、磁盘状态、Compaction分数、请求数、磁盘IO利用率、磁盘容量、内存使用、网络流量等)进行测量监控。<br>您可以点击 "<i>新建 StarRocks BE</i>" 并进行配置,或者选择"<i>更多操作</i>",导入已有配置。
en-US: Hertzbeat monitoring StarRocks BE through core performance metrics such as CPU usage, disk state, compaction score, request count, disk IO utilization, disk capacity, memory usage and network traffic. You could click the "<i>New StarRocks BE Monitor</i>" button and proceed with the configuration or import an existing setup through the "<i>More Actions</i>" menu.
zh-TW: Hertzbeat 對 StarRocks 資料庫BE的核心監控指標(CPU使用率、磁碟狀態、Compaction分數、請求數、磁碟IO利用率、磁碟容量、記憶體使用、網路流量等)進行量測監控。<br>您可以點擊"<i>新建 StarRocks BE</i>"並進行配寘,或者選擇"<i>更多操作</i>",導入已有配寘。
helpLink:
zh-CN: https://hertzbeat.apache.org/zh-cn/docs/help/starrocks_be/
en-US: https://hertzbeat.apache.org/docs/help/starrocks_be/
params:
- field: host
name:
zh-CN: 目标Host
en-US: Target Host
type: host
required: true
- field: port
name:
zh-CN: 端口
en-US: Port
type: number
range: '[0,65535]'
defaultValue: 8040
required: true
- field: timeout
name:
zh-CN: 查询超时时间
en-US: Query Timeout
type: number
required: false
hide: true
defaultValue: 6000
metrics:
- name: starrocks_be_cpu
i18n:
zh-CN: /proc/stat中的CPU使用信息
en-US: CPU Usage in /proc/stat
priority: 0
fields:
- field: mode
type: 1
label: true
- field: value
type: 0
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
- name: starrocks_be_disks_state
i18n:
zh-CN: 磁盘状态
en-US: Disk State
priority: 1
fields:
- field: path
type: 1
label: true
- field: value
type: 0
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
- name: starrocks_be_tablet_base_max_compaction_score
i18n:
zh-CN: Base Compaction分数
en-US: Base Compaction Score
priority: 2
fields:
- field: value
type: 0
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
- name: starrocks_be_tablet_cumulative_max_compaction_score
i18n:
zh-CN: Cumulative Compaction分数
en-US: Cumulative Compaction Score
priority: 3
fields:
- field: value
type: 0
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
- name: starrocks_be_engine_requests_total
i18n:
zh-CN: 总请求数
en-US: Total Requests
priority: 4
fields:
- field: status
type: 1
label: true
- field: type
type: 1
label: true
- field: value
type: 0
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
- name: starrocks_be_max_disk_io_util_percent
i18n:
zh-CN: 最大磁盘IO利用率(%)
en-US: Max Disk IO Utilization Rate(%)
priority: 5
fields:
- field: value
type: 0
unit: '%'
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
- name: starrocks_be_disks_avail_capacity
i18n:
zh-CN: 磁盘可用容量
en-US: Disk Available Capacity
priority: 6
fields:
- field: path
type: 1
label: true
- field: value
type: 0
unit: MB
units:
- value=B->MB
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
- name: starrocks_be_disks_data_used_capacity
i18n:
zh-CN: 磁盘已用容量
en-US: Disk Used Capacity
priority: 7
fields:
- field: path
type: 1
label: true
- field: value
type: 0
unit: MB
units:
- value=B->MB
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
- name: starrocks_be_load_bytes
i18n:
zh-CN: 总导入字节数
en-US: Total Load Bytes
priority: 8
fields:
- field: value
type: 0
unit: bytes
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
- name: starrocks_be_load_rows
i18n:
zh-CN: 导入行数
en-US: Load Rows
priority: 9
fields:
- field: value
type: 0
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
- name: starrocks_be_process_mem_bytes
i18n:
zh-CN: 进程内存使用
en-US: Process Memory Usage
priority: 10
fields:
- field: value
type: 0
unit: MB
label: true
units:
- value=B->MB
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
- name: starrocks_be_jemalloc_allocated_bytes
i18n:
zh-CN: 已分配的内存
en-US: Allocated Memory
priority: 11
fields:
- field: value
type: 0
unit: MB
label: true
units:
- value=B->MB
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
- name: starrocks_be_network_receive_bytes
i18n:
zh-CN: 网络接收字节数
en-US: Network Received Bytes
priority: 12
fields:
- field: device
type: 1
label: true
- field: value
type: 0
unit: bytes
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
- name: starrocks_be_network_send_bytes
i18n:
zh-CN: 网络发送字节数
en-US: Network Sent Bytes
priority: 13
fields:
- field: device
type: 1
label: true
- field: value
type: 0
unit: bytes
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
@@ -1,407 +0,0 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
category: bigdata
# The monitoring type eg: linux windows tomcat mysql aws...
app: starrocks_fe
# The monitoring i18n name
name:
zh-CN: StarRocks FE
en-US: StarRocks FE
# The description and help of this monitoring type
help:
zh-CN: Hertzbeat 对 StarRocks 数据库FE的核心监控指标(JVM内存、线程、查询响应时间、编辑日志、加载任务、作业状态、事务状态、连接数等)进行测量监控。<br>您可以点击 "<i>新建 StarRocks FE</i>" 并进行配置,或者选择"<i>更多操作</i>",导入已有配置。
en-US: Hertzbeat monitoring StarRocks FE through core performance metrics such as JVM memory, threads, query response time, edit logs, load jobs, job status, transaction status and connections. You could click the "<i>New StarRocks FE Monitor</i>" button and proceed with the configuration or import an existing setup through the "<i>More Actions</i>" menu.
zh-TW: Hertzbeat 對 StarRocks 資料庫FE的核心監控指標(JVM記憶體、執行緒、查詢響應時間、編輯日誌、載入任務、作業狀態、事務狀態、連接數等)進行量測監控。<br>您可以點擊"<i>新建 StarRocks FE</i>"並進行配寘,或者選擇"<i>更多操作</i>",導入已有配寘。
helpLink:
zh-CN: https://hertzbeat.apache.org/zh-cn/docs/help/starrocks_fe/
en-US: https://hertzbeat.apache.org/docs/help/starrocks_fe/
# Input params define for monitoring(render web ui by the definition)
params:
# field-param field key
- field: host
# name-param field display i18n name
name:
zh-CN: 目标 Host
en-US: Target Host
# type-param field type(most mapping the html input type)
type: host
# required-true or false
required: true
- field: port
name:
zh-CN: 端口
en-US: Port
# type-param field type(most mapping the html input type)
type: number
# when type is number, range is required
range: '[0,65535]'
# default value
defaultValue: 8030
required: true
- field: timeout
name:
zh-CN: 查询超时时间
en-US: Query Timeout
type: number
required: false
# hide param-true or false
hide: true
defaultValue: 6000
metrics:
- name: jvm_heap_size_bytes
i18n:
zh-CN: JVM堆内存
en-US: JVM Heap Size
priority: 0
fields:
- field: type
type: 1
label: true
- field: value
type: 0
unit: MB
units:
- value=B->MB
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
- name: jvm_non_heap_size_bytes
i18n:
zh-CN: JVM非堆内存
en-US: JVM Non-Heap Size
priority: 1
fields:
- field: type
type: 1
label: true
- field: value
type: 0
unit: MB
units:
- value=B->MB
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
- name: jvm_thread
i18n:
zh-CN: JVM线程
en-US: JVM Thread
priority: 2
fields:
- field: type
type: 1
label: true
- field: value
type: 0
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
- name: starrocks_fe_query_err
i18n:
zh-CN: 查询失败数
en-US: Failed Queries
priority: 3
fields:
- field: value
type: 0
label: true
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
- name: starrocks_fe_query_latency_ms
i18n:
zh-CN: 查询响应时间(ms)
en-US: Query Response Time(ms)
priority: 4
fields:
- field: quantile
type: 1
label: true
- field: value
type: 0
unit: ms
label: true
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
- name: starrocks_fe_edit_log_write
i18n:
zh-CN: 编辑日志写入速率
en-US: Edit Log Write Rate
priority: 5
fields:
- field: value
type: 0
label: true
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
- name: starrocks_fe_load_add
i18n:
zh-CN: 新增加载任务数
en-US: New Load Jobs
priority: 6
fields:
- field: value
type: 0
label: true
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
- name: starrocks_fe_load_finished
i18n:
zh-CN: 完成加载任务数
en-US: Finished Load Jobs
priority: 7
fields:
- field: value
type: 0
label: true
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
- name: starrocks_fe_job
i18n:
zh-CN: FE作业状态
en-US: FE Job Status
priority: 8
fields:
- field: job
type: 1
label: true
- field: type
type: 1
label: true
- field: state
type: 1
label: true
- field: value
type: 0
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
- name: starrocks_fe_tablet_max_compaction_score
i18n:
zh-CN: 节点上最高的 Compaction Score
en-US: Max Compaction Score on Node
priority: 9
fields:
- field: backend
type: 1
label: true
- field: value
type: 0
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
- name: starrocks_fe_meta_log_count
i18n:
zh-CN: 未做 Checkpoint 的 Edit Log 数量
en-US: Edit Log Count without Checkpoint
priority: 10
fields:
- field: value
type: 0
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
- name: starrocks_fe_query_total
i18n:
zh-CN: 查询总数
en-US: Total Queries
priority: 11
fields:
- field: value
type: 0
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
- name: starrocks_fe_request_total
i18n:
zh-CN: 请求总数
en-US: Total Requests
priority: 12
fields:
- field: value
type: 0
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
- name: starrocks_fe_txn_reject
i18n:
zh-CN: 事务拒绝数
en-US: Rejected Transactions
priority: 13
fields:
- field: value
type: 0
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
- name: starrocks_fe_txn_begin
i18n:
zh-CN: 事务开始数
en-US: Beginning Transactions
priority: 14
fields:
- field: value
type: 0
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
- name: starrocks_fe_txn_success
i18n:
zh-CN: 事务成功数
en-US: Successful Transactions
priority: 15
fields:
- field: value
type: 0
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
- name: starrocks_fe_txn_failed
i18n:
zh-CN: 事务失败数
en-US: Failed Transactions
priority: 16
fields:
- field: value
type: 0
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
- name: starrocks_fe_connection_total
i18n:
zh-CN: 连接总数
en-US: Total Connections
priority: 17
fields:
- field: user
type: 1
label: true
- field: value
type: 0
protocol: http
http:
host: ^_^host^_^
port: ^_^port^_^
url: '/metrics'
timeout: ^_^timeout^_^
method: GET
parseType: prometheus
@@ -19,8 +19,6 @@ package org.apache.hertzbeat.manager.controller;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import org.apache.hertzbeat.common.constants.CommonConstants;
@@ -64,7 +62,7 @@ class PluginControllerTest {
"jarFile",
"plugin-test.jar",
"application/java-archive",
"This is the file content".getBytes(StandardCharsets.UTF_8)
"This is the file content".getBytes()
);
this.mockMvc.perform(MockMvcRequestBuilders.multipart("/api/plugin")
@@ -32,7 +32,6 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.util.List;
import org.apache.hertzbeat.manager.service.impl.AbstractImExportServiceImpl;
import org.apache.hertzbeat.manager.service.impl.JsonImExportServiceImpl;
@@ -67,7 +66,7 @@ class JsonImExportServiceTest {
void testParseImport() throws IOException {
String json = "[{}]";
ByteArrayInputStream bis = new ByteArrayInputStream(json.getBytes(StandardCharsets.UTF_8));
ByteArrayInputStream bis = new ByteArrayInputStream(json.getBytes());
AbstractImExportServiceImpl.MonitorDTO monitorDTO = new AbstractImExportServiceImpl.MonitorDTO();
@@ -28,8 +28,6 @@ import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
@@ -89,9 +87,7 @@ class PluginServiceTest {
PluginServiceImpl service = spy(pluginService);
doReturn(metadata).when(service).validateJarFile(any());
MockMultipartFile mockFile = new MockMultipartFile(
"file", "test-plugin.jar", "application/java-archive",
"plugin-content".getBytes(StandardCharsets.UTF_8));
MockMultipartFile mockFile = new MockMultipartFile("file", "test-plugin.jar", "application/java-archive", "plugin-content".getBytes());
PluginUpload pluginUpload = new PluginUpload(mockFile, "Test Plugin", true);
when(metadataDao.save(any(PluginMetadata.class))).thenReturn(new PluginMetadata());
@@ -46,13 +46,13 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.hertzbeat.common.constants.CommonConstants;
import org.apache.hertzbeat.common.constants.MetricDataConstants;
import org.apache.hertzbeat.common.entity.arrow.RowWrapper;
import org.apache.hertzbeat.common.entity.dto.Value;
import org.apache.hertzbeat.common.entity.message.CollectRep;
import org.apache.hertzbeat.common.util.Base64Util;
import org.apache.hertzbeat.common.util.JsonUtil;
import org.apache.hertzbeat.common.util.TimePeriodUtil;
import org.apache.hertzbeat.warehouse.store.history.AbstractHistoryDataStorage;
@@ -208,7 +208,7 @@ public class GreptimeDbDataStorage extends AbstractHistoryDataStorage {
if (StringUtils.hasText(greptimeProperties.username())
&& StringUtils.hasText(greptimeProperties.password())) {
String authStr = greptimeProperties.username() + ":" + greptimeProperties.password();
String encodedAuth = Base64Util.encode(authStr);
String encodedAuth = new String(Base64.encodeBase64(authStr.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8);
headers.add(HttpHeaders.AUTHORIZATION, BASIC + " " + encodedAuth);
}
Instant now = Instant.now();
@@ -40,6 +40,7 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.hertzbeat.common.constants.CommonConstants;
import org.apache.hertzbeat.common.constants.MetricDataConstants;
@@ -48,7 +49,6 @@ import org.apache.hertzbeat.common.constants.SignConstants;
import org.apache.hertzbeat.common.entity.arrow.RowWrapper;
import org.apache.hertzbeat.common.entity.dto.Value;
import org.apache.hertzbeat.common.entity.message.CollectRep;
import org.apache.hertzbeat.common.util.Base64Util;
import org.apache.hertzbeat.common.util.CommonUtil;
import org.apache.hertzbeat.common.util.JsonUtil;
import org.apache.hertzbeat.common.util.TimePeriodUtil;
@@ -217,7 +217,7 @@ public class VictoriaMetricsClusterDataStorage extends AbstractHistoryDataStorag
if (StringUtils.hasText(vmInsertProps.username())
&& StringUtils.hasText(vmInsertProps.password())) {
String authStr = vmInsertProps.username() + ":" + vmInsertProps.password();
String encodedAuth = Base64Util.encode(authStr);
String encodedAuth = new String(Base64.encodeBase64(authStr.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8);
headers.add(HttpHeaders.AUTHORIZATION, NetworkConstants.BASIC + SignConstants.BLANK + encodedAuth);
}
StringBuilder stringBuilder = new StringBuilder();
@@ -262,7 +262,8 @@ public class VictoriaMetricsClusterDataStorage extends AbstractHistoryDataStorag
headers.setAccept(List.of(MediaType.APPLICATION_JSON));
if (StringUtils.hasText(vmSelectProps.username()) && StringUtils.hasText(vmSelectProps.password())) {
String authStr = vmSelectProps.username() + ":" + vmSelectProps.password();
String encodedAuth = Base64Util.encode(authStr);
String encodedAuth = new String(Base64.encodeBase64(authStr.getBytes(StandardCharsets.UTF_8)),
StandardCharsets.UTF_8);
headers.add(HttpHeaders.AUTHORIZATION, NetworkConstants.BASIC
+ SignConstants.BLANK + encodedAuth);
}
@@ -357,7 +358,8 @@ public class VictoriaMetricsClusterDataStorage extends AbstractHistoryDataStorag
headers.setAccept(List.of(MediaType.APPLICATION_JSON));
if (StringUtils.hasText(vmSelectProps.username()) && StringUtils.hasText(vmSelectProps.password())) {
String authStr = vmSelectProps.username() + ":" + vmSelectProps.password();
String encodedAuth = Base64Util.encode(authStr);
String encodedAuth = new String(Base64.encodeBase64(authStr.getBytes(StandardCharsets.UTF_8)),
StandardCharsets.UTF_8);
headers.add(HttpHeaders.AUTHORIZATION, NetworkConstants.BASIC
+ SignConstants.BLANK + encodedAuth);
}
@@ -38,6 +38,7 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.hertzbeat.common.constants.CommonConstants;
import org.apache.hertzbeat.common.constants.MetricDataConstants;
@@ -46,7 +47,6 @@ import org.apache.hertzbeat.common.constants.SignConstants;
import org.apache.hertzbeat.common.entity.arrow.RowWrapper;
import org.apache.hertzbeat.common.entity.dto.Value;
import org.apache.hertzbeat.common.entity.message.CollectRep;
import org.apache.hertzbeat.common.util.Base64Util;
import org.apache.hertzbeat.common.util.CommonUtil;
import org.apache.hertzbeat.common.util.JsonUtil;
import org.apache.hertzbeat.common.util.TimePeriodUtil;
@@ -109,7 +109,7 @@ public class VictoriaMetricsDataStorage extends AbstractHistoryDataStorage {
if (StringUtils.hasText(victoriaMetricsProp.username())
&& StringUtils.hasText(victoriaMetricsProp.password())) {
String authStr = victoriaMetricsProp.username() + SignConstants.DOUBLE_MARK + victoriaMetricsProp.password();
String encodedAuth = Base64Util.encode(authStr);
String encodedAuth = new String(Base64.encodeBase64(authStr.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8);
headers.add(HttpHeaders.AUTHORIZATION, NetworkConstants.BASIC + " " + encodedAuth);
}
HttpEntity<Void> httpEntity = new HttpEntity<>(headers);
@@ -222,7 +222,7 @@ public class VictoriaMetricsDataStorage extends AbstractHistoryDataStorage {
if (StringUtils.hasText(victoriaMetricsProp.username())
&& StringUtils.hasText(victoriaMetricsProp.password())) {
String authStr = victoriaMetricsProp.username() + ":" + victoriaMetricsProp.password();
String encodedAuth = Base64Util.encode(authStr);
String encodedAuth = new String(Base64.encodeBase64(authStr.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8);
headers.add(HttpHeaders.AUTHORIZATION, NetworkConstants.BASIC + SignConstants.BLANK + encodedAuth);
}
StringBuilder stringBuilder = new StringBuilder();
@@ -262,7 +262,7 @@ public class VictoriaMetricsDataStorage extends AbstractHistoryDataStorage {
if (StringUtils.hasText(victoriaMetricsProp.username())
&& StringUtils.hasText(victoriaMetricsProp.password())) {
String authStr = victoriaMetricsProp.username() + ":" + victoriaMetricsProp.password();
String encodedAuth = Base64Util.encode(authStr);
String encodedAuth = new String(Base64.encodeBase64(authStr.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8);
headers.add(HttpHeaders.AUTHORIZATION, NetworkConstants.BASIC + SignConstants.BLANK + encodedAuth);
}
HttpEntity<Void> httpEntity = new HttpEntity<>(headers);
@@ -356,7 +356,7 @@ public class VictoriaMetricsDataStorage extends AbstractHistoryDataStorage {
if (StringUtils.hasText(victoriaMetricsProp.username())
&& StringUtils.hasText(victoriaMetricsProp.password())) {
String authStr = victoriaMetricsProp.username() + ":" + victoriaMetricsProp.password();
String encodedAuth = Base64Util.encode(authStr);
String encodedAuth = new String(Base64.encodeBase64(authStr.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8);
headers.add(HttpHeaders.AUTHORIZATION, NetworkConstants.BASIC
+ SignConstants.BLANK + encodedAuth);
}
-112
View File
@@ -1,112 +0,0 @@
---
id: starrocks_be
title: Monitoring StarRocks Database BE Monitoring
sidebar_label: StarRocks Database BE
keywords: [Open Source Monitoring System, Open Source Database Monitoring, StarRocks Database BE Monitoring]
---
> Collect and monitor general performance metrics for StarRocks database BE. Supports StarRocks 2.4.0 and later versions.
**Protocol: HTTP**
### Pre-monitoring Operations
Check the `be/conf/be.conf` file to obtain the value of the `http_port` configuration item, which is used for monitoring.
### Configuration Parameters
| Parameter Name | Parameter Description |
|---------------|----------------------|
| Monitor Host | The monitored target's IPV4, IPV6, or domain name. Note: Without the protocol header (e.g., https://, http://) |
| Task Name | A unique name identifying this monitoring task |
| Port | The port provided by the database to the outside, default is 8040, get the value of the `http_port` configuration item |
| Query Timeout | The timeout for the connection to not respond, in milliseconds, default is 6000 milliseconds |
| Description | Additional notes and descriptions for this monitoring task |
### Collection Metrics
> For more metrics, please refer to the StarRocks official documentation: [General Monitoring Metrics](https://docs.mirrorship.cn/docs/administration/management/monitoring/metrics/).
#### Metric Set: starrocks_be_cpu
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | None | CPU usage information returned by /proc/stat |
#### Metric Set: starrocks_be_disks_state
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | None | State of each disk. 1 indicates that the disk is in use, and 0 indicates that the disk is not in use |
#### Metric Set: starrocks_be_tablet_base_max_compaction_score
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | None | Highest base compaction score of tablets in this BE |
#### Metric Set: starrocks_be_tablet_cumulative_max_compaction_score
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | None | Highest cumulative compaction score of tablets in this BE |
#### Metric Set: starrocks_be_engine_requests_total
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | None | Total count of all types of requests, including CREATE TABLE, Publish Version and Tablet Clone |
#### Metric Set: starrocks_be_max_disk_io_util_percent
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | % | Maximum disk I/O utilization percentage |
#### Metric Set: starrocks_be_disks_avail_capacity
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | MB | Available capacity of a specific disk |
#### Metric Set: starrocks_be_disks_data_used_capacity
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | MB | Used capacity of each disk (represented by a storage path) |
#### Metric Set: starrocks_be_load_bytes
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | Bytes | Total loaded bytes |
#### Metric Set: starrocks_be_load_rows
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | None | Total loaded rows |
#### Metric Set: starrocks_be_process_mem_bytes
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | MB | Memory used by this process |
#### Metric Set: starrocks_be_jemalloc_allocated_bytes
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | MB | Total number of bytes allocated by jemalloc |
#### Metric Set: starrocks_be_network_receive_bytes
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | Bytes | Total bytes received via network |
#### Metric Set: starrocks_be_network_send_bytes
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | Bytes | Number of bytes sent over the network |
-136
View File
@@ -1,136 +0,0 @@
---
id: starrocks_fe
title: Monitoring StarRocks Database FE Monitoring
sidebar_label: StarRocks Database FE
keywords: [Open Source Monitoring System, Open Source Database Monitoring, StarRocks Database FE Monitoring]
---
> Collect and monitor general performance metrics for StarRocks database FE. Supports StarRocks 2.4.0 and later versions.
**Protocol: HTTP**
### Pre-monitoring Operations
Check the `fe/conf/fe.conf` file to obtain the value of the `http_port` configuration item, which is used for monitoring.
### Configuration Parameters
| Parameter Name | Parameter Description |
|---------------|----------------------|
| Monitor Host | The monitored target's IPV4, IPV6, or domain name. Note: Without the protocol header (e.g., https://, http://) |
| Task Name | A unique name identifying this monitoring task |
| Port | The port provided by the database to the outside, default is 8030, get the value of the `http_port` configuration item |
| Query Timeout | The timeout for the connection to not respond, in milliseconds, default is 6000 milliseconds |
| Description | Additional notes and descriptions for this monitoring task |
### Collection Metrics
> For more metrics, please refer to the StarRocks official documentation: [General Monitoring Metrics](https://docs.mirrorship.cn/docs/administration/management/monitoring/metrics/).
#### Metric Set: jvm_heap_size_bytes
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | Byte | JVM heap memory size |
#### Metric Set: jvm_non_heap_size_bytes
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | Byte | JVM non-heap memory size |
#### Metric Set: jvm_thread
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | None | Number of JVM threads |
#### Metric Set: starrocks_fe_query_err
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | None | Number of failed queries |
#### Metric Set: starrocks_fe_query_latency_ms
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | ms | Query response time |
#### Metric Set: starrocks_fe_edit_log_write
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | Byte/s | Write speed of FE edit log |
#### Metric Set: starrocks_fe_load_add
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | None | Number of new load jobs |
#### Metric Set: starrocks_fe_load_finished
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | None | Number of finished load jobs |
#### Metric Set: starrocks_fe_job
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | None | FE job status |
#### Metric Set: starrocks_fe_tablet_max_compaction_score
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | None | Indicates the highest Compaction Score on each BE node |
#### Metric Set: starrocks_fe_meta_log_count
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | None | The number of Edit Logs without a checkpoint. A value within 100000 is reasonable |
#### Metric Set: starrocks_fe_query_total
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | None | Total number of queries |
#### Metric Set: starrocks_fe_request_total
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | None | Total number of requests |
#### Metric Set: starrocks_fe_txn_reject
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | None | Number of rejected transactions |
#### Metric Set: starrocks_fe_txn_begin
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | None | Number of beginning transactions |
#### Metric Set: starrocks_fe_txn_success
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | None | Number of successful transactions |
#### Metric Set: starrocks_fe_txn_failed
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | None | Number of failed transactions |
#### Metric Set: starrocks_fe_connection_total
| Metric Name | Metric Unit | Metric Help Description |
|------------|-------------|------------------------|
| value | None | Total number of FE connections |
@@ -1,112 +0,0 @@
---
id: starrocks_be
title: 监控:StarRocks数据库BE监控
sidebar_label: StarRocks数据库BE
keywords: [开源监控系统, 开源数据库监控, StarRocks数据库BE监控]
---
> 对StarRocks数据库BE的通用性能指标进行采集监控。支持 StarRocks 2.4.0 及其之后版本。
**使用协议:HTTP**
### 监控前操作
查看 `be/conf/be.conf` 文件,获取 `http_port` 配置项的值,该值用作监控使用。
### 配置参数
| 参数名称 | 参数帮助描述 |
|--------|------------|
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://) |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性 |
| 端口 | 数据库对外提供的端口,默认为8040,取值自 `http_port` 配置项的值 |
| 查询超时时间 | 设置连接未响应的超时时间,单位ms毫秒,默认6000毫秒 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
### 采集指标
> 更多指标请参考StarRocks官网:[通用监控指标](https://docs.mirrorship.cn/zh/docs/administration/management/monitoring/metrics/)。
#### 指标集合:starrocks_be_cpu
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | 无 | /proc/stat 返回的 CPU 使用信息 |
#### 指标集合:starrocks_be_disks_state
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | 无 | 磁盘的状态。1 表示磁盘正在使用,0 表示磁盘未被使用 |
#### 指标集合:starrocks_be_tablet_base_max_compaction_score
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | 无 | 此 BE 中各 Tablet 的最高 Base Compaction Score |
#### 指标集合:starrocks_be_tablet_cumulative_max_compaction_score
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | 无 | 此 BE 中各 Tablet 的最高 Cumulative Compaction Score |
#### 指标集合:starrocks_be_engine_requests_total
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | 无 | BE 和 FE 之间各种请求的总数,包括 CREATE TABLE、Publish Version 和 Tablet Clone |
#### 指标集合:starrocks_be_max_disk_io_util_percent
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | % | 最大磁盘 I/O 利用率百分比 |
#### 指标集合:starrocks_be_disks_avail_capacity
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | MB | 磁盘的可用容量 |
#### 指标集合:starrocks_be_disks_data_used_capacity
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | MB | 每个磁盘(由存储路径表示)的已用容量 |
#### 指标集合:starrocks_be_load_bytes
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | 字节 | 总导入字节数 |
#### 指标集合:starrocks_be_load_rows
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | 无 | 总导入行数 |
#### 指标集合:starrocks_be_process_mem_bytes
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | MB | 此进程使用的内存 |
#### 指标集合:starrocks_be_jemalloc_allocated_bytes
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | MB | jemalloc 已分配的总字节数 |
#### 指标集合:starrocks_be_network_receive_bytes
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | 字节 | 通过网络接收的总字节数 |
#### 指标集合:starrocks_be_network_send_bytes
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | 字节 | 通过网络发送的字节数 |
@@ -1,136 +0,0 @@
---
id: starrocks_fe
title: 监控:StarRocks数据库FE监控
sidebar_label: StarRocks数据库FE
keywords: [开源监控系统, 开源数据库监控, StarRocks数据库FE监控]
---
> 对StarRocks数据库FE的通用性能指标进行采集监控。支持 StarRocks 2.4.0 及其之后版本。
**使用协议:HTTP**
### 监控前操作
查看 `fe/conf/fe.conf` 文件,获取 `http_port` 配置项的值,该值用作监控使用。
### 配置参数
| 参数名称 | 参数帮助描述 |
|--------|------------|
| 监控Host | 被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://) |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性 |
| 端口 | 数据库对外提供的端口,默认为8030,取值自 `http_port` 配置项的值 |
| 查询超时时间 | 设置连接未响应的超时时间,单位ms毫秒,默认6000毫秒 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息 |
### 采集指标
> 更多指标请参考StarRocks官网:[通用监控指标](https://docs.mirrorship.cn/zh/docs/administration/management/monitoring/metrics/)。
#### 指标集合:jvm_heap_size_bytes
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | 字节 | JVM堆内存大小 |
#### 指标集合:jvm_non_heap_size_bytes
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | 字节 | JVM非堆内存大小 |
#### 指标集合:jvm_thread
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | 无 | JVM线程数量 |
#### 指标集合:starrocks_fe_query_err
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | 无 | 查询失败数量 |
#### 指标集合:starrocks_fe_query_latency_ms
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | 毫秒 | 查询响应时间 |
#### 指标集合:starrocks_fe_edit_log_write
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | 字节/秒 | FE编辑日志写入速率 |
#### 指标集合:starrocks_fe_load_add
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | 无 | 新增加载任务数量 |
#### 指标集合:starrocks_fe_load_finished
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | 无 | 完成加载任务数量 |
#### 指标集合:starrocks_fe_job
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | 无 | FE作业状态 |
#### 指标集合:starrocks_fe_tablet_max_compaction_score
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | 无 | 节点上最高的 Compaction Score |
#### 指标集合:starrocks_fe_meta_log_count
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | 无 | 未做 Checkpoint 的 Edit Log 数量,该值在 100000 以内为合理 |
#### 指标集合:starrocks_fe_query_total
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | 无 | 查询总数 |
#### 指标集合:starrocks_fe_request_total
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | 无 | 请求总数 |
#### 指标集合:starrocks_fe_txn_reject
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | 无 | 事务拒绝数 |
#### 指标集合:starrocks_fe_txn_begin
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | 无 | 事务开始数 |
#### 指标集合:starrocks_fe_txn_success
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | 无 | 事务成功数 |
#### 指标集合:starrocks_fe_txn_failed
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | 无 | 事务失败数 |
#### 指标集合:starrocks_fe_connection_total
| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|---------|------------|
| value | 无 | FE连接总数 |
-2
View File
@@ -189,8 +189,6 @@
"help/clickhouse",
"help/doris_be",
"help/doris_fe",
"help/starrocks_be",
"help/starrocks_fe",
"help/elasticsearch",
"help/flink",
"help/flink_on_yarn",
File diff suppressed because it is too large Load Diff
+9 -166
View File
@@ -1635,7 +1635,7 @@
"@docusaurus/theme-search-algolia" "2.3.1"
"@docusaurus/types" "2.3.1"
"@docusaurus/react-loadable@5.5.2":
"@docusaurus/react-loadable@5.5.2", "react-loadable@npm:@docusaurus/react-loadable@5.5.2":
version "5.5.2"
resolved "https://registry.yarnpkg.com/@docusaurus/react-loadable/-/react-loadable-5.5.2.tgz#81aae0db81ecafbdaee3651f12804580868fa6ce"
integrity sha512-A3dYjdBGuy0IGT+wyLIGIKLRE+sAk1iNk0f1HjNDysO7u8lhL4N3VEm+FAubmJbAztn94F7MxBTPmnixbiyFdQ==
@@ -2248,11 +2248,6 @@
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea"
integrity sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==
"@sindresorhus/merge-streams@^2.1.0":
version "2.3.0"
resolved "https://registry.npmmirror.com/@sindresorhus/merge-streams/-/merge-streams-2.3.0.tgz#719df7fb41766bc143369eaa0dd56d8dc87c9958"
integrity sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==
"@slorber/static-site-generator-webpack-plugin@^4.0.7":
version "4.0.7"
resolved "https://registry.yarnpkg.com/@slorber/static-site-generator-webpack-plugin/-/static-site-generator-webpack-plugin-4.0.7.tgz#fc1678bddefab014e2145cbe25b3ce4e1cfc36f3"
@@ -3336,13 +3331,6 @@ braces@^3.0.2, braces@~3.0.2:
dependencies:
fill-range "^7.0.1"
braces@^3.0.3:
version "3.0.3"
resolved "https://registry.npmmirror.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789"
integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==
dependencies:
fill-range "^7.1.1"
browserslist@^4.0.0, browserslist@^4.16.6, browserslist@^4.18.1, browserslist@^4.20.2, browserslist@^4.20.3, browserslist@^4.21.2:
version "4.21.2"
resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.2.tgz#59a400757465535954946a400b841ed37e2b4ecf"
@@ -4268,11 +4256,6 @@ dns-packet@^5.2.2:
dependencies:
"@leichtgewicht/ip-codec" "^2.0.1"
docusaurus-plugin-matomo@^0.0.8:
version "0.0.8"
resolved "https://registry.npmmirror.com/docusaurus-plugin-matomo/-/docusaurus-plugin-matomo-0.0.8.tgz#eb11cf9d0f145a27ed5b9dec3835db01fae71060"
integrity sha512-YSaDdjxI7uN1FuNLSGrQy4BmDEXwwyL6vac7GfmS7wFBLck/Ias5jHqENPBHXe36m2cYzyesGPQL1EsS9vanwA==
dom-converter@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/dom-converter/-/dom-converter-0.2.0.tgz#6721a9daee2e293682955b6afe416771627bb768"
@@ -4478,11 +4461,6 @@ entities@^4.2.0, entities@^4.3.0:
resolved "https://registry.yarnpkg.com/entities/-/entities-4.3.1.tgz#c34062a94c865c322f9d67b4384e4169bcede6a4"
integrity sha512-o4q/dYJlmyjP2zfnaWDUC6A3BQFmVTX+tZPezK7k0GLSU9QYCauscf5Y+qcEPzKL+EixVouYDgLQK5H9GrLpkg==
entities@^4.4.0:
version "4.5.0"
resolved "https://registry.npmmirror.com/entities/-/entities-4.5.0.tgz#5d268ea5e7113ec74c4d033b79ea5a35a488fb48"
integrity sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==
error-ex@^1.3.1:
version "1.3.2"
resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf"
@@ -4716,17 +4694,6 @@ fast-glob@^3.2.11, fast-glob@^3.2.9:
merge2 "^1.3.0"
micromatch "^4.0.4"
fast-glob@^3.3.2:
version "3.3.3"
resolved "https://registry.npmmirror.com/fast-glob/-/fast-glob-3.3.3.tgz#d06d585ce8dba90a16b0505c543c3ccfb3aeb818"
integrity sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==
dependencies:
"@nodelib/fs.stat" "^2.0.2"
"@nodelib/fs.walk" "^1.2.3"
glob-parent "^5.1.2"
merge2 "^1.3.0"
micromatch "^4.0.8"
fast-json-stable-stringify@^2.0.0, fast-json-stable-stringify@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633"
@@ -4812,13 +4779,6 @@ fill-range@^7.0.1:
dependencies:
to-regex-range "^5.0.1"
fill-range@^7.1.1:
version "7.1.1"
resolved "https://registry.npmmirror.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292"
integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==
dependencies:
to-regex-range "^5.0.1"
finalhandler@1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.2.0.tgz#7d23fe5731b207b4640e4fcd00aec1f9207a7b32"
@@ -5085,18 +5045,6 @@ globals@^11.1.0:
resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e"
integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==
globby@14.0.1:
version "14.0.1"
resolved "https://registry.npmmirror.com/globby/-/globby-14.0.1.tgz#a1b44841aa7f4c6d8af2bc39951109d77301959b"
integrity sha512-jOMLD2Z7MAhyG8aJpNOpmziMOP4rPLcc95oQPKXBazW82z+CEgPFBQvEpRUa1KeIMUJo4Wsm+q6uzO/Q/4BksQ==
dependencies:
"@sindresorhus/merge-streams" "^2.1.0"
fast-glob "^3.3.2"
ignore "^5.2.4"
path-type "^5.0.0"
slash "^5.1.0"
unicorn-magic "^0.1.0"
globby@^11.0.1, globby@^11.0.4, globby@^11.1.0:
version "11.1.0"
resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b"
@@ -5459,11 +5407,6 @@ ignore@^5.2.0:
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a"
integrity sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==
ignore@^5.2.4:
version "5.3.2"
resolved "https://registry.npmmirror.com/ignore/-/ignore-5.3.2.tgz#3cd40e729f3643fd87cb04e50bf0eb722bc596f5"
integrity sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==
image-size@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/image-size/-/image-size-1.0.2.tgz#d778b6d0ab75b2737c1556dd631652eb963bc486"
@@ -5895,13 +5838,6 @@ joi@^17.6.0:
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==
js-yaml@4.1.0, js-yaml@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602"
integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==
dependencies:
argparse "^2.0.1"
js-yaml@^3.13.1:
version "3.14.1"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537"
@@ -5910,6 +5846,13 @@ js-yaml@^3.13.1:
argparse "^1.0.7"
esprima "^4.0.0"
js-yaml@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602"
integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==
dependencies:
argparse "^2.0.1"
jsesc@^2.5.1:
version "2.5.2"
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4"
@@ -5957,11 +5900,6 @@ json5@^2.1.2, json5@^2.2.0, json5@^2.2.1:
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c"
integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==
jsonc-parser@3.2.1:
version "3.2.1"
resolved "https://registry.npmmirror.com/jsonc-parser/-/jsonc-parser-3.2.1.tgz#031904571ccf929d7670ee8c547545081cb37f1a"
integrity sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==
jsonfile@^6.0.1:
version "6.1.0"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae"
@@ -6020,13 +5958,6 @@ lines-and-columns@^1.1.6:
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632"
integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==
linkify-it@^5.0.0:
version "5.0.0"
resolved "https://registry.npmmirror.com/linkify-it/-/linkify-it-5.0.0.tgz#9ef238bfa6dc70bd8e7f9572b52d369af569b421"
integrity sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==
dependencies:
uc.micro "^2.0.0"
loader-runner@^4.2.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.3.0.tgz#c1b4a163b99f614830353b16755e7149ac2314e1"
@@ -6158,48 +6089,6 @@ markdown-escapes@^1.0.0:
resolved "https://registry.yarnpkg.com/markdown-escapes/-/markdown-escapes-1.0.4.tgz#c95415ef451499d7602b91095f3c8e8975f78535"
integrity sha512-8z4efJYk43E0upd0NbVXwgSTQs6cT3T06etieCMEg7dRbzCbxUCK/GHlX8mhHRDcp+OLlHkPKsvqQTCvsRl2cg==
markdown-it@14.1.0:
version "14.1.0"
resolved "https://registry.npmmirror.com/markdown-it/-/markdown-it-14.1.0.tgz#3c3c5992883c633db4714ccb4d7b5935d98b7d45"
integrity sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==
dependencies:
argparse "^2.0.1"
entities "^4.4.0"
linkify-it "^5.0.0"
mdurl "^2.0.0"
punycode.js "^2.3.1"
uc.micro "^2.1.0"
markdownlint-cli2-formatter-default@0.0.4:
version "0.0.4"
resolved "https://registry.npmmirror.com/markdownlint-cli2-formatter-default/-/markdownlint-cli2-formatter-default-0.0.4.tgz#81e26b0a50409c0357c6f0d38d8246946b236fab"
integrity sha512-xm2rM0E+sWgjpPn1EesPXx5hIyrN2ddUnUwnbCsD/ONxYtw3PX6LydvdH6dciWAoFDpwzbHM1TO7uHfcMd6IYg==
markdownlint-cli2@^0.13.0:
version "0.13.0"
resolved "https://registry.npmmirror.com/markdownlint-cli2/-/markdownlint-cli2-0.13.0.tgz#691cab01994295b4b8c87aa0485c0b1e0f792289"
integrity sha512-Pg4nF7HlopU97ZXtrcVISWp3bdsuc5M0zXyLp2/sJv2zEMlInrau0ZKK482fQURzVezJzWBpNmu4u6vGAhij+g==
dependencies:
globby "14.0.1"
js-yaml "4.1.0"
jsonc-parser "3.2.1"
markdownlint "0.34.0"
markdownlint-cli2-formatter-default "0.0.4"
micromatch "4.0.5"
markdownlint-micromark@0.1.9:
version "0.1.9"
resolved "https://registry.npmmirror.com/markdownlint-micromark/-/markdownlint-micromark-0.1.9.tgz#4876996b60d4dceb3a02f4eee2d3a366eb9569fa"
integrity sha512-5hVs/DzAFa8XqYosbEAEg6ok6MF2smDj89ztn9pKkCtdKHVdPQuGMH7frFfYL9mLkvfFe4pTyAMffLbjf3/EyA==
markdownlint@0.34.0:
version "0.34.0"
resolved "https://registry.npmmirror.com/markdownlint/-/markdownlint-0.34.0.tgz#bbc2047c952d1644269009a69ba227ed597b23fa"
integrity sha512-qwGyuyKwjkEMOJ10XN6OTKNOVYvOIi35RNvDLNxTof5s8UmyGHlCdpngRHoRGNvQVGuxO3BJ7uNSgdeX166WXw==
dependencies:
markdown-it "14.1.0"
markdownlint-micromark "0.1.9"
mdast-squeeze-paragraphs@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/mdast-squeeze-paragraphs/-/mdast-squeeze-paragraphs-4.0.0.tgz#7c4c114679c3bee27ef10b58e2e015be79f1ef97"
@@ -6248,11 +6137,6 @@ mdurl@^1.0.0:
resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e"
integrity sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==
mdurl@^2.0.0:
version "2.0.0"
resolved "https://registry.npmmirror.com/mdurl/-/mdurl-2.0.0.tgz#80676ec0433025dd3e17ee983d0fe8de5a2237e0"
integrity sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==
media-typer@0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748"
@@ -6290,7 +6174,7 @@ methods@~1.1.2:
resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee"
integrity sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==
micromatch@4.0.5, micromatch@^4.0.2, micromatch@^4.0.4, micromatch@^4.0.5:
micromatch@^4.0.2, micromatch@^4.0.4, micromatch@^4.0.5:
version "4.0.5"
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6"
integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==
@@ -6298,14 +6182,6 @@ micromatch@4.0.5, micromatch@^4.0.2, micromatch@^4.0.4, micromatch@^4.0.5:
braces "^3.0.2"
picomatch "^2.3.1"
micromatch@^4.0.8:
version "4.0.8"
resolved "https://registry.npmmirror.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202"
integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==
dependencies:
braces "^3.0.3"
picomatch "^2.3.1"
mime-db@1.52.0, "mime-db@>= 1.43.0 < 2":
version "1.52.0"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70"
@@ -6847,11 +6723,6 @@ path-type@^4.0.0:
resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b"
integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==
path-type@^5.0.0:
version "5.0.0"
resolved "https://registry.npmmirror.com/path-type/-/path-type-5.0.0.tgz#14b01ed7aea7ddf9c7c3f46181d4d04f9c785bb8"
integrity sha512-5HviZNaZcfqP95rwpv+1HDgUamezbqdSYTyzjTvwtJSnIH+3vnbmWsItli8OFEndS984VT55M3jduxZbX351gg==
picocolors@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c"
@@ -7269,11 +7140,6 @@ pump@^3.0.0:
end-of-stream "^1.1.0"
once "^1.3.1"
punycode.js@^2.3.1:
version "2.3.1"
resolved "https://registry.npmmirror.com/punycode.js/-/punycode.js-2.3.1.tgz#6b53e56ad75588234e79f4affa90972c7dd8cdb7"
integrity sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==
punycode@^1.3.2:
version "1.4.1"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e"
@@ -7480,14 +7346,6 @@ react-loadable-ssr-addon-v5-slorber@^1.0.1:
dependencies:
"@babel/runtime" "^7.10.3"
"react-loadable@npm:@docusaurus/react-loadable@5.5.2":
version "5.5.2"
resolved "https://registry.yarnpkg.com/@docusaurus/react-loadable/-/react-loadable-5.5.2.tgz#81aae0db81ecafbdaee3651f12804580868fa6ce"
integrity sha512-A3dYjdBGuy0IGT+wyLIGIKLRE+sAk1iNk0f1HjNDysO7u8lhL4N3VEm+FAubmJbAztn94F7MxBTPmnixbiyFdQ==
dependencies:
"@types/react" "*"
prop-types "^15.6.2"
react-resizable@^1.8.0:
version "1.11.1"
resolved "https://registry.npmmirror.com/react-resizable/-/react-resizable-1.11.1.tgz#02ca6850afa7a22c1b3e623e64aef71ee252af69"
@@ -8313,11 +8171,6 @@ slash@^4.0.0:
resolved "https://registry.yarnpkg.com/slash/-/slash-4.0.0.tgz#2422372176c4c6c5addb5e2ada885af984b396a7"
integrity sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==
slash@^5.1.0:
version "5.1.0"
resolved "https://registry.npmmirror.com/slash/-/slash-5.1.0.tgz#be3adddcdf09ac38eebe8dcdc7b1a57a75b095ce"
integrity sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==
slick-carousel@1.8.1:
version "1.8.1"
resolved "https://registry.npmmirror.com/slick-carousel/-/slick-carousel-1.8.1.tgz#a4bfb29014887bb66ce528b90bd0cda262cc8f8d"
@@ -8847,11 +8700,6 @@ ua-parser-js@^0.7.30:
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.31.tgz#649a656b191dffab4f21d5e053e27ca17cbff5c6"
integrity sha512-qLK/Xe9E2uzmYI3qLeOmI0tEOt+TBBQyUIAh4aAgU05FVYzeZrKUdkAZfBNVGRaHVgV0TDkdEngJSw/SyQchkQ==
uc.micro@^2.0.0, uc.micro@^2.1.0:
version "2.1.0"
resolved "https://registry.npmmirror.com/uc.micro/-/uc.micro-2.1.0.tgz#f8d3f7d0ec4c3dea35a7e3c8efa4cb8b45c9e7ee"
integrity sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==
unbox-primitive@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.2.tgz#29032021057d5e6cdbd08c5129c226dff8ed6f9e"
@@ -8900,11 +8748,6 @@ unicode-property-aliases-ecmascript@^2.0.0:
resolved "https://registry.yarnpkg.com/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.0.0.tgz#0a36cb9a585c4f6abd51ad1deddb285c165297c8"
integrity sha512-5Zfuy9q/DFr4tfO7ZPeVXb1aPoeQSdeFMLpYuFebehDAhbuevLs5yxSZmIFN1tP5F9Wl4IpJrYojg85/zgyZHQ==
unicorn-magic@^0.1.0:
version "0.1.0"
resolved "https://registry.npmmirror.com/unicorn-magic/-/unicorn-magic-0.1.0.tgz#1bb9a51c823aaf9d73a8bfcd3d1a23dde94b0ce4"
integrity sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==
unified@9.2.0:
version "9.2.0"
resolved "https://registry.yarnpkg.com/unified/-/unified-9.2.0.tgz#67a62c627c40589edebbf60f53edfd4d822027f8"
@@ -115,7 +115,7 @@ public class AccountController {
@PostMapping("/register")
@Transactional
public ResponseEntity<Message<String>> accountRegister(@RequestBody @Validated SignUpDto account) {
// TODO Let the front-end pass the plaintext password here first, and then change it to an encrypted password later
//此处先让前端传递明文密码,后续改为加密密码
if (accountService.registerAccount(account)) {
Long authUser = roleService.getRoleIdByCode("role_user");
@@ -49,7 +49,7 @@ public class LocalFileStorageServiceImpl implements FileStorageService {
// Define the file path
File localFile = new File(directory,fileName);
try (FileOutputStream outputStream = new FileOutputStream(localFile)) {
outputStream.write(file.getBytes(StandardCharsets.UTF_8));
outputStream.write(file.getBytes());
}
// Return the file URL (local file path in this case)
@@ -70,38 +70,38 @@ public class SurenessFilterExample implements Filter {
response.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization, authorization,x-requested-with, *");
try {
// Retrieve the filters attribute from the filter chain
//获取过滤器链中的filters属性
Field filtersField = filterChain.getClass().getDeclaredField("filters");
// Reflection setting attribute reachable
//反射设置属性可达
filtersField.setAccessible(true);
// Get the value of the filters attribute
//获取filters属性值
FilterConfig[] filters = (FilterConfig[]) filtersField.get(filterChain);
// Skip the record of the number of filters
//跳过过滤器个数记录
int k = 0;
// Traverse all filters
//遍历所有过滤器
for (int i = 0; i < filters.length; i++) {
if (filters[i] != null) {
// Get the filterDef attribute of the filter
//获取过滤器filterDef属性
Field filterDefField = filters[i].getClass().getDeclaredField("filterDef");
filterDefField.setAccessible(true);
// Get the class of the filter
//获取filter的class
Field filterClassField = filterDefField.get(filters[i]).getClass().getDeclaredField("filterClass");
filterClassField.setAccessible(true);
String filterClass = (String) filterClassField.get(filterDefField.get(filters[i]));
String FILTER_REFERENCE1 = "com.usthe.sureness.configuration.SurenessJakartaServletFilter";
String FILTER_REFERENCE2 = "org.apache.tomcat.websocket.server.WsFilter";
// Skip specified filter processing
//跳过指定过滤器处理
if (FILTER_REFERENCE1.equals(filterClass)||FILTER_REFERENCE2.equals(filterClass)) {
filters[i] = null;
k++;
break;
}
// Attribute can be disabled
//属性可达关闭
filterClassField.setAccessible(false);
filterDefField.setAccessible(false);
}
}
// Re assign the filter array and adjust it after removing the specified filter
//过滤器数组重新赋值,调整移除指定过滤器后过滤器数组
int index = 0;
for (int i = 0; i < filters.length; i++) {
if (index == 0 && filters[i] == null) {
@@ -113,7 +113,7 @@ public class SurenessFilterExample implements Filter {
index = 0;
}
}
// Reassignment of n value
//n值重新赋值
filtersField.setAccessible(false);
Field n = filterChain.getClass().getDeclaredField("n");
n.setAccessible(true);
@@ -39,7 +39,7 @@ public class DatabasePathTreeProvider implements PathTreeProvider {
@Override
public Set<String> providePathData() {
// Read path information from the database and retrieve all path information with a status of 1, which is normal
// 从数据库中读取出path信息,取出所有状态为1,即正常的path信息
Set<String> pathSet = SurenessCommonUtil.attachContextPath(getContextPath(), resourceService.getAllEnableResourcePath());
return pathSet;
@@ -47,7 +47,7 @@ public class DatabasePathTreeProvider implements PathTreeProvider {
@Override
public Set<String> provideExcludedResource() {
// Read path information from the database and retrieve all path information with a status of 9, which is disabled
// 从数据库中读取出path信息,取出所有状态为9,即禁用的path信息
Set<String> exlResourceSet = SurenessCommonUtil.attachContextPath(getContextPath(), resourceService.getAllDisableResourcePath());
return exlResourceSet;
}
@@ -132,7 +132,7 @@ class VersionControllerTest {
when(versionService.upload(any(), any())).thenReturn(true);
mockMvc.perform(multipart("/version/upload")
.file("file", "dummy content".getBytes(StandardCharsets.UTF_8))
.file("file", "dummy content".getBytes())
.param("templateDto", templateDtoJson))
.andExpect(status().isOk())
.andExpect(jsonPath("$.code").value(0));
@@ -132,7 +132,7 @@ class VersionDOControllerTest {
when(versionService.upload(any(), any())).thenReturn(true);
mockMvc.perform(multipart("/version/upload")
.file("file", "dummy content".getBytes(StandardCharsets.UTF_8))
.file("file", "dummy content".getBytes())
.param("templateDto", templateDtoJson))
.andExpect(status().isOk())
.andExpect(jsonPath("$.msg").value("upload success"));
@@ -82,8 +82,8 @@
<th nzAlign="center" nzWidth="10%">{{ 'alert.group-converge.group-wait' | i18n }}</th>
<th nzAlign="center" nzWidth="10%">{{ 'alert.group-converge.group-interval' | i18n }}</th>
<th nzAlign="center" nzWidth="10%">{{ 'alert.group-converge.repeat-interval' | i18n }}</th>
<th nzAlign="center" nzWidth="8%" nzRight>{{ 'alert.group-converge.enable' | i18n }}</th>
<th nzAlign="center" nzWidth="12%" nzRight>{{ 'common.edit' | i18n }}</th>
<th nzAlign="center" nzWidth="8%">{{ 'alert.group-converge.enable' | i18n }}</th>
<th nzAlign="center" nzWidth="12%">{{ 'common.edit' | i18n }}</th>
</tr>
</thead>
<tbody>
@@ -98,10 +98,10 @@
<td nzAlign="center"> {{ data.groupWait }}{{ 'alert.group-converge.seconds' | i18n }} </td>
<td nzAlign="center"> {{ data.groupInterval }}{{ 'alert.group-converge.seconds' | i18n }} </td>
<td nzAlign="center"> {{ data.repeatInterval }}{{ 'alert.group-converge.seconds' | i18n }} </td>
<td nzAlign="center" nzRight>
<td nzAlign="center">
<nz-switch [(ngModel)]="data.enable" (ngModelChange)="updateGroupConverge(data)" name="enable"></nz-switch>
</td>
<td nzAlign="center" nzRight>
<td nzAlign="center">
<div class="actions">
<button
nz-button
@@ -81,8 +81,8 @@
<th nzAlign="center" nzWidth="20%">{{ 'alert.inhibit.source_labels' | i18n }}</th>
<th nzAlign="center" nzWidth="20%">{{ 'alert.inhibit.target_labels' | i18n }}</th>
<th nzAlign="center" nzWidth="15%">{{ 'alert.inhibit.equal_labels' | i18n }}</th>
<th nzAlign="center" nzWidth="8%" nzRight>{{ 'common.enable' | i18n }}</th>
<th nzAlign="center" nzWidth="12%" nzRight>{{ 'common.edit' | i18n }}</th>
<th nzAlign="center" nzWidth="8%">{{ 'common.enable' | i18n }}</th>
<th nzAlign="center" nzWidth="12%">{{ 'common.edit' | i18n }}</th>
</tr>
</thead>
<tbody>
@@ -98,10 +98,10 @@
<td nzAlign="center">
<nz-tag *ngFor="let label of data.equalLabels">{{ label }}</nz-tag>
</td>
<td nzAlign="center" nzRight>
<td nzAlign="center">
<nz-switch [(ngModel)]="data.enable" (ngModelChange)="updateInhibit(data)" name="enable"></nz-switch>
</td>
<td nzAlign="center" nzRight>
<td nzAlign="center">
<div class="actions">
<button nz-button nzType="primary" (click)="editInhibit(data.id)" nz-tooltip [nzTooltipTitle]="'alert.inhibit.edit' | i18n">
<i nz-icon nzType="edit" nzTheme="outline"></i>
@@ -36,7 +36,7 @@
<th nzAlign="center" nzWidth="20%">{{ 'alert.notice.receiver.type' | i18n }}</th>
<th nzAlign="center" nzWidth="20%">{{ 'alert.notice.receiver.setting' | i18n }}</th>
<th nzAlign="center" nzWidth="20%">{{ 'common.edit-time' | i18n }}</th>
<th nzAlign="center" nzWidth="15%" nzRight>{{ 'common.edit' | i18n }}</th>
<th nzAlign="center" nzWidth="25%">{{ 'common.edit' | i18n }}</th>
</tr>
</thead>
<tbody>
@@ -119,7 +119,7 @@
<span *ngIf="data.type == 13">{{ data.gotifyToken }}</span>
</td>
<td nzAlign="center">{{ (data.gmtUpdate ? data.gmtUpdate : data.gmtCreate) | date : 'YYYY-MM-dd HH:mm:ss' }}</td>
<td nzAlign="center" nzRight>
<td nzAlign="center">
<div class="actions">
<button
(click)="onEditOneNoticeReceiver(data)"
@@ -37,8 +37,8 @@
<th nzAlign="center" nzWidth="15%">{{ 'alert.notice.template.name' | i18n }}</th>
<th nzAlign="center" nzWidth="10%">{{ 'alert.notice.rule.all' | i18n }}</th>
<th nzAlign="center" nzWidth="10%">{{ 'common.enable' | i18n }}</th>
<th nzAlign="center" nzWidth="20%">{{ 'common.edit-time' | i18n }}</th>
<th nzAlign="center" nzWidth="15%" nzRight>{{ 'common.edit' | i18n }}</th>
<th nzAlign="center" nzWidth="15%">{{ 'common.edit-time' | i18n }}</th>
<th nzAlign="center" nzWidth="20%">{{ 'common.edit' | i18n }}</th>
</tr>
</thead>
<tbody>
@@ -62,7 +62,7 @@
<nz-switch [(ngModel)]="data.enable" (ngModelChange)="updateNoticeRule(data)"></nz-switch>
</td>
<td nzAlign="center">{{ (data.gmtUpdate ? data.gmtUpdate : data.gmtCreate) | date : 'YYYY-MM-dd HH:mm:ss' }}</td>
<td nzAlign="center" nzRight>
<td nzAlign="center">
<div class="actions">
<button
(click)="onEditOneNoticeRule(data)"
@@ -41,7 +41,7 @@
<th nzAlign="center" nzWidth="15%">{{ 'alert.notice.template.type' | i18n }}</th>
<th nzAlign="center" nzWidth="15%">{{ 'alert.notice.template.preset' | i18n }}</th>
<th nzAlign="center" nzWidth="20%">{{ 'common.edit-time' | i18n }}</th>
<th nzAlign="center" nzWidth="15%" nzRight>{{ 'common.edit' | i18n }}</th>
<th nzAlign="center" nzWidth="15%">{{ 'common.edit' | i18n }}</th>
</tr>
</thead>
<tbody>
@@ -106,7 +106,7 @@
</span>
</td>
<td nzAlign="center">{{ (data.gmtUpdate ? data.gmtUpdate : data.gmtCreate) | date : 'YYYY-MM-dd HH:mm:ss' }}</td>
<td nzAlign="center" nzRight>
<td nzAlign="center">
<div *ngIf="!data.preset" class="actions">
<button
(click)="onEditOneNoticeTemplate(data)"
@@ -36,7 +36,7 @@ const routes: Routes = [
{ path: 'silence', component: AlertSilenceComponent },
{ path: 'group', component: AlertGroupConvergeComponent },
{ path: 'inhibit', component: AlertInhibitComponent },
{ path: 'integration/:source', component: AlertIntegrationComponent, data: { titleI18n: 'menu.alert.integration' } }
{ path: 'integration/:source', component: AlertIntegrationComponent }
];
@NgModule({
@@ -97,8 +97,8 @@
<th nzAlign="center" nzWidth="24%">{{ 'alert.setting.expr' | i18n }}</th>
<th nzAlign="center" nzWidth="20%">{{ 'alert.setting.template' | i18n }}</th>
<th nzAlign="center" nzWidth="8%">{{ 'label.bind' | i18n }}</th>
<th nzAlign="center" nzWidth="8%" nzRight>{{ 'alert.setting.enable' | i18n }}</th>
<th nzAlign="center" nzWidth="8%" nzRight>{{ 'common.edit' | i18n }}</th>
<th nzAlign="center" nzWidth="8%">{{ 'alert.setting.enable' | i18n }}</th>
<th nzAlign="center" nzWidth="8%">{{ 'common.edit' | i18n }}</th>
</tr>
</thead>
<tbody>
@@ -122,10 +122,10 @@
<td nzAlign="center">
<nz-tag *ngFor="let item of data.labels | keyvalue">{{ item.key }}:{{ item.value }}</nz-tag>
</td>
<td nzAlign="center" nzRight>
<td nzAlign="center">
<nz-switch [(ngModel)]="data.enable" (ngModelChange)="updateAlertDefine(data)" name="enable"></nz-switch>
</td>
<td nzAlign="center" nzRight>
<td nzAlign="center">
<div class="actions">
<button
nz-button
@@ -498,21 +498,23 @@
</nz-form-label>
<nz-form-control [nzSpan]="12" [nzErrorTip]="'validation.required' | i18n">
<div class="template-input-wrapper">
<div class="draggable-vars-container">
<div *ngFor="let env of templateEnvVars" class="draggable-tag" draggable="true" (dragstart)="onDragStart($event, env)">
<div class="key-value-block">
<span class="var-key">{{ env.name }}</span>
<span class="var-value">{{ env.description | i18n }}</span>
</div>
</div>
<div *ngFor="let metric of currentMetrics" class="draggable-tag" draggable="true" (dragstart)="onDragStart($event, metric)">
<div class="key-value-block">
<span class="var-key">{{ '${' + metric.value + '}' }}</span>
<span class="var-value">{{ metric.label }}</span>
</div>
</div>
</div>
<a nz-dropdown [nzDropdownMenu]="menu" class="env-vars-dropdown" nzTrigger="click" [nzPlacement]="'bottomRight'">
<button nz-button nzType="link" nz-tooltip [nzTooltipTitle]="'alert.setting.template.tip' | i18n">
<i nz-icon nzType="snippets" nzTheme="outline"></i>
</button>
</a>
<nz-dropdown-menu #menu="nzDropdownMenu">
<ul nz-menu class="env-vars-menu">
<li nz-menu-item *ngFor="let env of templateEnvVars" (click)="onEnvVarClick(env)">
<span class="env-var-name">{{ env.name }}</span>
<span class="env-var-desc">{{ env.description | i18n }}</span>
</li>
<li nz-menu-item *ngFor="let env of currentMetrics" (click)="onEnvVarClick(env)">
<span class="env-var-name">{{ '${' + env.value + '}' }}</span>
<span class="env-var-desc">{{ env.label }}</span>
</li>
</ul>
</nz-dropdown-menu>
<nz-textarea-count [nzMaxCharacterCount]="200">
<textarea
@@ -523,10 +525,8 @@
name="template"
id="template"
[placeholder]="'alert.setting.template.example' | i18n"
(dragover)="onTextareaDragOver($event)"
(drop)="onTextareaDrop($event)"
(dragleave)="onTextareaDragLeave($event)"
></textarea>
>
</textarea>
</nz-textarea-count>
</div>
</nz-form-control>
@@ -1,5 +1,4 @@
@import '@delon/theme/index';
@import '../../../../styles/theme.less';
::ng-deep {
.row {
@@ -16,7 +15,7 @@
}
.tree:empty {
margin: 0;
margin: 0px;
}
.ruleset-invalid {
@@ -239,117 +238,4 @@
opacity: 0.7;
cursor: not-allowed;
}
.draggable-vars-container {
display: flex;
flex-wrap: wrap;
gap: 10px;
margin-bottom: 16px;
padding: 12px;
background: #fafafa;
border: 1px dashed @border-color;
border-radius: 6px;
@media (max-width: 768px) {
flex-direction: column;
}
}
.draggable-tag {
padding: 8px 12px;
min-width: 140px;
background: #f0f5ff;
border: 1px solid fade(@primary-color, 30%);
border-radius: 4px;
cursor: move;
user-select: none;
transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
.key-value-block {
display: flex;
flex-direction: column;
gap: 4px;
}
.var-key {
font-weight: 500;
font-size: 13px;
color: @primary-color;
line-height: 1.2;
display: flex;
align-items: center;
&::before {
content: '';
width: 6px;
height: 6px;
border-radius: 50%;
margin-right: 8px;
background: @success-green;
}
&.metric-key::before {
background: @error-red;
}
}
.var-value {
font-size: 12px;
color: @secondary-color;
line-height: 1.4;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
&:hover {
background: @highlight-blue;
transform: translateY(-2px);
box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
.var-key {
color: darken(@primary-color, 10%);
}
.var-value {
color: darken(@secondary-color, 10%);
}
}
&.dragging-active {
opacity: 0.8;
transform: scale(0.98);
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
&:active {
transform: scale(0.95);
}
}
.drag-over {
border-color: @primary-color !important;
box-shadow: 0 0 8px fade(@primary-color, 10%) !important;
}
.env-type-environment {
.var-key::before {
background: @success-green;
}
}
.env-type-metric {
.var-key::before {
background: @error-red;
}
}
@media (max-width: 576px) {
.draggable-tag {
width: 100%;
min-width: auto;
}
}
}
@@ -17,7 +17,7 @@
* under the License.
*/
import { Component, HostListener, Inject, OnInit, ViewChild } from '@angular/core';
import { Component, Inject, OnInit, ViewChild } from '@angular/core';
import { AbstractControl, FormBuilder, FormControl, NgForm, ValidationErrors } from '@angular/forms';
import { I18NService } from '@core';
import { ALAIN_I18N_TOKEN } from '@delon/theme';
@@ -43,8 +43,6 @@ const AVAILABILITY = 'availability';
styleUrls: ['./alert-setting.component.less']
})
export class AlertSettingComponent implements OnInit {
private savedSelectionStart = 0;
private savedSelectionEnd = 0;
constructor(
private modal: NzModalService,
private notifySvc: NzNotificationService,
@@ -214,9 +212,8 @@ export class AlertSettingComponent implements OnInit {
translationSearchList.push(trimSearch);
}
let alertDefineInit$ = this.alertDefineSvc
.getAlertDefines(translationSearchList, this.pageIndex - 1, this.pageSize)
.subscribe(message => {
let alertDefineInit$ = this.alertDefineSvc.getAlertDefines(translationSearchList, this.pageIndex - 1, this.pageSize).subscribe(
message => {
this.tableLoading = false;
this.checkedAll = false;
this.checkedDefineIds.clear();
@@ -229,7 +226,12 @@ export class AlertSettingComponent implements OnInit {
console.warn(message.msg);
}
alertDefineInit$.unsubscribe();
});
},
error => {
this.tableLoading = false;
alertDefineInit$.unsubscribe();
}
);
}
onNewAlertDefine() {
@@ -440,7 +442,7 @@ export class AlertSettingComponent implements OnInit {
* @param params page info
*/
onTablePageChange(params: NzTableQueryParams) {
const { pageSize, pageIndex } = params;
const { pageSize, pageIndex, sort, filter } = params;
this.pageIndex = pageIndex;
this.pageSize = pageSize;
this.loadAlertDefineTable();
@@ -731,7 +733,7 @@ export class AlertSettingComponent implements OnInit {
const funcMatch = expr.match(/^(!)?(?:equals|contains|matches)\(([^,]+),\s*"([^"]+)"\)$/);
if (funcMatch) {
const [_, not, field, value] = funcMatch;
const func = expr.match(/equals|contains|matches/)?.[0] || '';
const func = expr.match(/(?:equals|contains|matches)/)?.[0] || '';
return {
field,
operator: not ? `!${func}` : func,
@@ -1172,69 +1174,4 @@ export class AlertSettingComponent implements OnInit {
this.pageIndex = 1;
this.loadAlertDefineTable();
}
onDragStart(event: DragEvent, data: any): void {
if (!event.dataTransfer) return;
let dragText: string;
if (this.isMetric(data)) {
dragText = `\${${data.value}}`;
} else {
dragText = data.name;
}
event.dataTransfer.setData('text/plain', dragText);
(event.target as HTMLElement).classList.add('dragging-active');
this.saveTextareaSelection();
}
@HostListener('document:dragend', ['$event'])
onGlobalDragEnd() {
document.querySelectorAll('.dragging-active').forEach(el => {
el.classList.remove('dragging-active');
});
}
private isMetric(data: any): boolean {
return 'value' in data && 'label' in data;
}
private saveTextareaSelection(): void {
const textarea = document.getElementById('template') as HTMLTextAreaElement;
this.savedSelectionStart = textarea.selectionStart;
this.savedSelectionEnd = textarea.selectionEnd;
}
onTextareaDrop(event: DragEvent): void {
event.preventDefault();
if (!event.dataTransfer) return;
const textarea = event.target as HTMLTextAreaElement;
const data = event.dataTransfer.getData('text/plain');
this.insertAtCursor(textarea, data);
this.define.template = textarea.value;
}
private insertAtCursor(textarea: HTMLTextAreaElement, text: string): void {
const startPos = textarea.selectionStart;
const endPos = textarea.selectionEnd;
const content = textarea.value;
textarea.value = content.substring(0, startPos) + text + content.substring(endPos, content.length);
const newPos = startPos + text.length;
textarea.selectionStart = newPos;
textarea.selectionEnd = newPos;
}
onTextareaDragOver(event: DragEvent): void {
event.preventDefault();
(event.target as HTMLElement).classList.add('drag-over');
}
onTextareaDragLeave(event: DragEvent): void {
(event.target as HTMLElement).classList.remove('drag-over');
}
}
@@ -77,11 +77,11 @@
<thead>
<tr>
<th nzAlign="center" nzLeft nzWidth="3%" [(nzChecked)]="checkedAll" (nzCheckedChange)="onAllChecked($event)"></th>
<th nzAlign="center" nzWidth="7%">{{ 'alert.silence.name' | i18n }}</th>
<th nzAlign="center" nzWidth="7%">{{ 'alert.silence.type' | i18n }}</th>
<th nzAlign="center" nzWidth="10%">{{ 'alert.silence.times' | i18n }}</th>
<th nzAlign="center" nzWidth="3%" nzRight>{{ 'alert.silence.enable' | i18n }}</th>
<th nzAlign="center" nzWidth="5%" nzRight>{{ 'common.edit' | i18n }}</th>
<th nzAlign="center" nzWidth="8%">{{ 'alert.silence.name' | i18n }}</th>
<th nzAlign="center" nzWidth="14%">{{ 'alert.silence.type' | i18n }}</th>
<th nzAlign="center" nzWidth="8%">{{ 'alert.silence.times' | i18n }}</th>
<th nzAlign="center" nzWidth="8%">{{ 'alert.silence.enable' | i18n }}</th>
<th nzAlign="center" nzWidth="15%">{{ 'common.edit' | i18n }}</th>
</tr>
</thead>
<tbody>
@@ -106,10 +106,10 @@
<span>{{ data.times == undefined ? 0 : data.times }}</span>
</nz-tag>
</td>
<td nzAlign="center" nzRight>
<td nzAlign="center">
<nz-switch [(ngModel)]="data.enable" (ngModelChange)="updateAlertSilence(data)" name="enable"></nz-switch>
</td>
<td nzAlign="center" nzRight>
<td nzAlign="center">
<div class="actions">
<button
nz-button
@@ -158,7 +158,7 @@
<th nzAlign="center" nzWidth="10%">{{ 'monitor.app' | i18n }}</th>
<th nzAlign="center" nzWidth="21%">{{ 'label' | i18n }}</th>
<th nzAlign="center" nzWidth="14%" nzColumnKey="gmtUpdate" [nzSortFn]="true">{{ 'common.edit-time' | i18n }}</th>
<th nzAlign="center" nzWidth="10%" nzRight>{{ 'common.edit' | i18n }}</th>
<th nzAlign="center" nzWidth="10%">{{ 'common.edit' | i18n }}</th>
</tr>
</thead>
<tbody>
@@ -212,7 +212,7 @@
</nz-tag>
</td>
<td nzAlign="center">{{ (data.gmtUpdate ? data.gmtUpdate : data.gmtCreate) | date : 'YYYY-MM-dd HH:mm:ss' }}</td>
<td nzAlign="center" nzRight>
<td nzAlign="center">
<div class="actions">
<button nz-button nzType="primary" [routerLink]="['/monitors/' + data.id]" nz-tooltip [nzTooltipTitle]="'monitor.detail' | i18n">
<i nz-icon nzType="area-chart" nzTheme="outline"></i>
@@ -20,7 +20,7 @@ const routes: Routes = [
children: [
{ path: '', redirectTo: 'dashboard', pathMatch: 'full' },
{ path: 'dashboard', component: DashboardComponent, data: { titleI18n: 'menu.dashboard' } },
{ path: 'bulletin', component: BulletinComponent, data: { titleI18n: 'menu.monitor.bulletin' } },
{ path: 'bulletin', component: BulletinComponent, data: { titleI18n: 'menu.dashboard' } },
{ path: 'exception', loadChildren: () => import('./exception/exception.module').then(m => m.ExceptionModule) },
{ path: 'monitors', loadChildren: () => import('./monitor/monitor.module').then(m => m.MonitorModule) },
{ path: 'alert', loadChildren: () => import('./alert/alert.module').then(m => m.AlertModule) },
@@ -100,7 +100,7 @@
<th nzAlign="center" nzWidth="12%">{{ 'collector.ip' | i18n }}</th>
<th nzAlign="center" nzWidth="12%">{{ 'collector.version' | i18n }}</th>
<th nzAlign="center" nzWidth="12%">{{ 'collector.start-time' | i18n }}</th>
<th nzAlign="center" nzWidth="13%" nzRight>{{ 'common.edit' | i18n }}</th>
<th nzAlign="center" nzWidth="13%">{{ 'common.edit' | i18n }}</th>
</tr>
</thead>
<tbody>
@@ -143,7 +143,7 @@
<td nzAlign="center">
{{ (data.collector.gmtUpdate | date : 'YYYY-MM-dd HH:mm:ss')?.trim() }}
</td>
<td nzAlign="center" nzRight>
<td nzAlign="center">
<div class="actions">
<button
*ngIf="data.collector.status == 1"
@@ -91,22 +91,21 @@
<app-key-value-input
*ngIf="item.type === 'key-value'"
[(ngModel)]="value"
(ngModelChange)="onChange($event)"
[(value)]="value"
(valueChange)="onChange($event)"
[id]="item.field"
[keyAlias]="'monitor.headerName.tip' | i18n"
[valueAlias]="'monitor.headerValue.tip' | i18n"
[name]="item.field"
[id]="item.field"
/>
<app-metrics-field-input
*ngIf="item.type === 'metrics-field'"
[(value)]="value"
(valueChange)="onChange($event)"
[id]="item.field"
[FieldAlias]="'Field'"
[UnitAlias]="'Unit'"
[TypeAlias]="'Type'"
[id]="item.field"
/>
<ng-container *ngIf="item.type === 'collectors-selection'">
@@ -19,10 +19,10 @@
<div style="margin-bottom: 2px; margin-top: 2px" *ngFor="let item of keyValues; let i = index" nz-row>
<div nz-col nzSpan="10">
<input nz-input [placeholder]="keyAlias" [(ngModel)]="item.key" (ngModelChange)="emitChange()" />
<input nz-input [placeholder]="keyAlias" [(ngModel)]="item.key" (ngModelChange)="onChange()" />
</div>
<div nz-col nzSpan="10">
<input nz-input [placeholder]="valueAlias" [(ngModel)]="item.value" (ngModelChange)="emitChange()" />
<input nz-input [placeholder]="valueAlias" [(ngModel)]="item.value" (ngModelChange)="onChange()" />
</div>
<div nz-col nzSpan="4">
<i nz-icon nzType="plus-circle" class="dynamic-button" *ngIf="i === 0" (click)="addNew($event)"></i>
@@ -17,24 +17,19 @@
* under the License.
*/
import { Component, forwardRef, Input, OnInit } from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
@Component({
selector: 'app-key-value-input',
templateUrl: './key-value-input.component.html',
styleUrls: ['./key-value-input.component.less'],
providers: [
{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => KeyValueInputComponent),
multi: true
}
]
styleUrls: ['./key-value-input.component.less']
})
export class KeyValueInputComponent implements OnInit, ControlValueAccessor {
export class KeyValueInputComponent implements OnInit {
constructor() {}
@Input() value!: any;
@Output() readonly valueChange = new EventEmitter<string>();
@Input()
keyAlias: string = 'Key';
@Input()
@@ -42,44 +37,20 @@ export class KeyValueInputComponent implements OnInit, ControlValueAccessor {
keyValues: any[] = [];
// ControlValueAccessor
private onChange: any = () => {};
private onTouched: any = () => {};
ngOnInit(): void {
if (this.keyValues.length === 0) {
this.addNew();
if (this.value == undefined) {
this.value = {
'': ''
};
} else {
this.value = JSON.parse(this.value);
}
}
writeValue(obj: string): void {
if (obj != undefined) {
let value = JSON.parse(obj);
if (value != null) {
this.keyValues = [];
Object.keys(value).map(item => {
this.keyValues.push({
key: item,
value: value[item]
});
});
}
}
if (this.keyValues.length === 0) {
this.addNew();
}
}
registerOnChange(fn: any): void {
this.onChange = fn;
}
registerOnTouched(fn: any): void {
this.onTouched = fn;
}
setDisabledState(isDisabled: boolean): void {
// set disabled state here
Object.keys(this.value).map(item => {
this.keyValues.push({
key: item,
value: this.value[item]
});
});
}
addNew(e?: MouseEvent) {
@@ -91,29 +62,21 @@ export class KeyValueInputComponent implements OnInit, ControlValueAccessor {
value: ''
});
}
removeCurrent(index: number, e?: MouseEvent) {
if (e) {
e.preventDefault();
}
if (this.keyValues.length > 1) {
this.keyValues.splice(index, 1);
this.emitChange();
}
}
emitChange() {
let value: Record<string, string> = {};
onChange() {
this.value = {};
this.keyValues.forEach(item => {
if (item != null && item.key != null) {
value[item.key] = item.value;
this.value[item.key] = item.value;
}
});
if (Object.keys(value).length === 0 || Object.values(value).every(v => v === '')) {
this.onChange(null);
} else {
this.onChange(JSON.stringify(value));
}
this.onTouched();
this.valueChange.emit(JSON.stringify(this.value));
}
}
+1
View File
@@ -148,6 +148,7 @@
"icon": "anticon-calculator",
"link": "/alert/setting"
},
{
"text": "Integration",
"i18n": "menu.alert.integration",
-4
View File
@@ -316,9 +316,6 @@
"alert.status.all": "All Status",
"alert.status.firing": "Firing",
"alert.status.resolved": "Resolved",
"annotation": "Annotate",
"annotation.bind": "Binding Annotations",
"annotation.bind.tip": "You can use annotations to mark entity information, such as annotating important events for resource binding.",
"app.lock": "Unlock",
"app.lock.placeholder": "Enter Any To Unlock",
"app.login.explore.cloud": "Explore Cloud",
@@ -829,7 +826,6 @@
"status.public.to-component": "Status Page",
"status.public.to-incident": "Incident History",
"status.public.today": "Today",
"tag": "Tag",
"validation.confirm-password.required": "Please confirm your password!",
"validation.date.required": "Please select the start and end date",
"validation.email.invalid": "Invalid email",
-9
View File
@@ -16,7 +16,6 @@
"about.star": "点赞支持",
"about.title": "Apache HertzBeat (incubating) 是一个开源实时监控系统,无需Agent,性能集群,兼容Prometheus,自定义监控和状态页构建能力。",
"about.upgrade": "升级指引",
"alert": "告警",
"alert.center.clear": "一键清空",
"alert.center.confirm.clear-all": "请确认是否清空所有告警记录!",
"alert.center.confirm.delete": "请确认是否删除!",
@@ -211,7 +210,6 @@
"alert.setting.default": "应用全局",
"alert.setting.default.tip": "此告警阈值配置是否应用于全局所有此类型监控",
"alert.setting.delete": "删除阈值规则",
"alert.setting.edit": "编辑阈值规则",
"alert.setting.edit.periodic": "编辑计划阈值",
"alert.setting.edit.realtime": "编辑实时阈值",
"alert.setting.enable": "启用阈值",
@@ -394,9 +392,6 @@
"collector.status": "运行状态",
"collector.task": "总任务数量",
"collector.version": "版本",
"common.annotation": "注解",
"common.annotation.bind": "绑定注解",
"common.annotation.bind.tip": "可以使用注解来标记实体信息,例如将重要事件的注解绑定到资源上。",
"common.button.cancel": "取消",
"common.button.collapse": "收起",
"common.button.confirm": "确认",
@@ -515,7 +510,6 @@
"label.name": "标签名",
"label.new": "新增标签",
"label.search": "搜索标签",
"label.setting": "标签",
"label.value": "标签值",
"labels.help": "标签无处不在,我们可以应用标签在资源分组,规则下的标签匹配等场景。标签管理用于对标签的统一管理维护,包含新增,删除,编辑等操作。<br>例如:您可以使用标签对监控资源进行分类管理,给资源分别绑定生产环境、测试环境的标签,在告警通知时通过标签匹配不同的通知人。",
"labels.help.link": "https://hertzbeat.apache.org/zh-cn/docs/",
@@ -534,7 +528,6 @@
"menu.advanced.status": "状态页面",
"menu.alert": "告警",
"menu.alert.center": "告警中心",
"menu.alert.converge": "收敛",
"menu.alert.dispatch": "消息通知",
"menu.alert.group": "分组收敛",
"menu.alert.inhibit": "告警抑制",
@@ -729,7 +722,6 @@
"plugin.type.POST_ALERT": "告警后",
"plugin.type.POST_COLLECT": "采集后",
"plugin.upload": "上传插件",
"question.link": "https://hertzbeat.apache.org/docs/help/issue/",
"settings.object-store": "文件服务配置",
"settings.object-store.obs.accessKey": "AccessKey",
"settings.object-store.obs.accessKey.placeholder": "华为云的AccessKeyId",
@@ -829,7 +821,6 @@
"status.public.to-component": "状态页面",
"status.public.to-incident": "事件信息",
"status.public.today": "今天",
"tag": "标签",
"validation.confirm-password.required": "请确认密码!",
"validation.date.required": "请选择起止日期",
"validation.email.invalid": "无效的邮箱地址!",
-77
View File
@@ -316,9 +316,6 @@
"alert.status.all": "全部狀態",
"alert.status.firing": "告警中",
"alert.status.resolved": "已恢复",
"annotation": "註解",
"annotation.bind": "綁定註解",
"annotation.bind.tip": "您可以使用註解來標記實體訊息,例如為資源綁定的重要事件進行註解。",
"app.lock": "解除鎖定",
"app.lock.placeholder": "輸入任意解鎖",
"app.login.explore.cloud": "探索雲端服務",
@@ -575,8 +572,6 @@
"menu.more": "更多",
"menu.search.placeholder": "搜索監控任務名稱、HOST等",
"monitor": "監控",
"monitor.advanced": "進階設定",
"monitor.advanced.tip": "設定高級可選參數",
"monitor.app": "監控類型",
"monitor.app.api": "HTTP API",
"monitor.app.fullsite": "全站監控",
@@ -588,7 +583,6 @@
"monitor.app.redis": "Redis",
"monitor.app.website": "網站監測",
"monitor.availability": "監控可用性",
"monitor.cancel": "暫停監控",
"monitor.category": "監控類別",
"monitor.category.auto": "自動任務",
"monitor.category.bigdata": "大數據",
@@ -603,12 +597,7 @@
"monitor.category.server": "服務器監控",
"monitor.category.service": "應用服務",
"monitor.category.webserver": "Web伺服器",
"monitor.center.help": "監控中心是監控資源管理入口,以清單的形式展示目前已新增的監控,同時支援標籤分組,查詢過濾,查看監控詳情等。 <br>您可以對監控資源進行新增,修改,刪除,暫停監控,匯入匯出,批次管理等操作。",
"monitor.center.help.link": "https://hertzbeat.apache.org/docs/",
"monitor.center.search.placeholder": "搜尋待加入監控任務的類型: Linux, Redis",
"monitor.coilRegisterAddresses.tip": "輸入暫存器位址",
"monitor.collect.time": "採集時間",
"monitor.collect.time.tip": "最近採集時間",
"monitor.collector": "採集器",
"monitor.collector.status.offline": "離線",
"monitor.collector.status.online": "在線",
@@ -621,47 +610,8 @@
"monitor.copy.failed": "复制监控失败",
"monitor.copy.notify.one-select": "只能选择一个监控进行复制",
"monitor.copy.success": "复制监控成功",
"monitor.delete": "刪除",
"monitor.delete-monitor": "刪除監控",
"monitor.description": "描述備注",
"monitor.description.tip": "更多標識和描述此任務的備注信息",
"monitor.detail": "監控詳情",
"monitor.detail.auto-refresh": "自動刷新 {{time}} 秒",
"monitor.detail.basic": "監控任務訊息",
"monitor.detail.chart.back": "縮放還原",
"monitor.detail.chart.no-data": "暫無數據",
"monitor.detail.chart.query-1d": "查詢近1天",
"monitor.detail.chart.query-1h": "查詢近1小時",
"monitor.detail.chart.query-1m": "查詢近1月",
"monitor.detail.chart.query-1w": "查詢近1週",
"monitor.detail.chart.query-3m": "查詢近3月",
"monitor.detail.chart.query-6h": "查詢近6小時",
"monitor.detail.chart.save": "保存圖片",
"monitor.detail.chart.unit": "單位",
"monitor.detail.chart.zoom": "區域縮放",
"monitor.detail.close-refresh": "關閉自動刷新",
"monitor.detail.config-refresh": "設定 {{time}} 秒自動刷新",
"monitor.detail.description": "描述",
"monitor.detail.history": "監控歷史圖表詳情",
"monitor.detail.name": "名稱",
"monitor.detail.port": "連接埠",
"monitor.detail.realtime": "監控即時數據詳情",
"monitor.detail.show-basic": "顯示監控基本屬性",
"monitor.detail.status": "狀態",
"monitor.detail.time-series.unavailable": "無法提供歷史圖表數據,請設定時序資料庫",
"monitor.detail.value.null": "無數據",
"monitor.detect": "測試連接",
"monitor.detect.failed": "測試連線失敗",
"monitor.detect.success": "測試連線成功",
"monitor.detect.tip": "測試檢查監控的可用性狀態",
"monitor.edit": "編輯",
"monitor.edit-monitor": "編輯監控",
"monitor.edit.failed": "修改監控失敗",
"monitor.edit.success": "修改監控成功",
"monitor.enable": "恢復監控",
"monitor.export": "匯出監控",
"monitor.export.switch-type": "請選擇匯出文件格式!",
"monitor.export.use-type": "以 {{type}} 檔案格式匯出監控",
"monitor.grafana.enabled.label": "啓用Grafana監控",
"monitor.grafana.enabled.tip": "是否啓用Grafana監控",
"monitor.grafana.upload.label": "上傳Grafana模板",
@@ -671,47 +621,21 @@
"monitor.holdingRegisterAddresses.tip": "輸入暫存器位址",
"monitor.host": "目標Host",
"monitor.host.tip": "被監控的對端IP或域名",
"monitor.icon.bigdata": "dot-chart",
"monitor.icon.cache": "group",
"monitor.icon.center": "laptop",
"monitor.icon.cn": "cloud-server",
"monitor.icon.custom": "project",
"monitor.icon.db": "console-sql",
"monitor.icon.mid": "cluster",
"monitor.icon.network": "global",
"monitor.icon.os": "windows",
"monitor.icon.program": "code",
"monitor.icon.service": "appstore",
"monitor.icon.webserver": "database",
"monitor.import": "導入監控",
"monitor.intervals": "監控周期",
"monitor.intervals.tip": "周期性采集數據的時間間隔,單位秒",
"monitor.keyword.tip": "輸入需要監控的關鍵字",
"monitor.list": "監控列表",
"monitor.name": "任務名稱",
"monitor.name.tip": "標識監控任務的名稱",
"monitor.new": "新增",
"monitor.new-monitor": "新增監控",
"monitor.new.failed": "新增監控失敗",
"monitor.new.notify.change-to-http": "已關閉HTTPS,連接埠號碼自動變更為 80,請留意。",
"monitor.new.notify.change-to-https": "已開啟HTTPS,連接埠號碼自動變更為 443,請留意。",
"monitor.new.success": "新增監控成功",
"monitor.not-found": "查詢異常,此監控不存在",
"monitor.path.tip": "匯出器Url端點路徑",
"monitor.payload.tip": "可用於 POST PUT",
"monitor.privateKey.tip": "啟動RSA私鑰",
"monitor.search.app": "類型篩選",
"monitor.search.placeholder": "搜尋監控",
"monitor.search.tag": "標籤篩選",
"monitor.sitemap.tip": "網站地圖 EG:/sitemap.xml",
"monitor.spinning-tip.detecting": "Available Detecting",
"monitor.status": "任務狀態",
"monitor.status.all": "全部狀態",
"monitor.status.down": "宕機",
"monitor.status.paused": "暫停",
"monitor.status.unreachable": "不可達",
"monitor.status.up": "正常",
"monitor.total": "總量",
"monitor.uri.tip": "網站 uri 路徑(無 ip 連接埠) EG:/console",
"monitor.url.tip": "服務:jmx:rmi:///jndi/rmi://host:port/jmxrmi",
"placeholder.key": "鍵",
@@ -729,7 +653,6 @@
"plugin.type.POST_ALERT": "告警後",
"plugin.type.POST_COLLECT": "採集後",
"plugin.upload": "上傳外掛",
"question.link": "https://hertzbeat.apache.org/docs/help/issue/",
"settings.object-store": "文件服務配置",
"settings.object-store.obs.accessKey": "AccessKey",
"settings.object-store.obs.accessKey.placeholder": "華為雲的AccessKeyId",
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
-5
View File
@@ -9,11 +9,6 @@
// The theme parameters can be generated at https://ng-alain.github.io/ng-alain/
// @primary-color: #f50;
@primary-color: #3f51b5;
@secondary-color: #8c8c8c;
@highlight-blue: #d6e4ff;
@border-color: #d9d9d9;
@success-green: #52c41a;
@error-red: #f5222d;
@font-size-base: 14px;
@nz-table-rep-padding-vertical: 3px;
@nz-table-rep-padding-horizontal: 3px;