mirror of
https://github.com/dromara/hertzbeat.git
synced 2026-09-17 09:40:58 +00:00
[refactor] change name from http_sd to registry (#2827)
Co-authored-by: Zhang Yuxuan <1373529784@qq.com>
This commit is contained in:
+13
-17
@@ -17,7 +17,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hertzbeat.collector.collect.httpsd;
|
||||
package org.apache.hertzbeat.collector.collect.registry;
|
||||
|
||||
import com.ecwid.consul.transport.TransportException;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
@@ -27,22 +27,22 @@ import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.hertzbeat.collector.collect.AbstractCollect;
|
||||
import org.apache.hertzbeat.collector.collect.httpsd.discovery.DiscoveryClient;
|
||||
import org.apache.hertzbeat.collector.collect.httpsd.discovery.DiscoveryClientManagement;
|
||||
import org.apache.hertzbeat.collector.collect.httpsd.discovery.entity.ServerInfo;
|
||||
import org.apache.hertzbeat.collector.collect.registry.discovery.DiscoveryClient;
|
||||
import org.apache.hertzbeat.collector.collect.registry.discovery.DiscoveryClientManagement;
|
||||
import org.apache.hertzbeat.collector.collect.registry.discovery.entity.ServerInfo;
|
||||
import org.apache.hertzbeat.collector.constants.CollectorConstants;
|
||||
import org.apache.hertzbeat.collector.dispatch.DispatchConstants;
|
||||
import org.apache.hertzbeat.common.constants.CommonConstants;
|
||||
import org.apache.hertzbeat.common.entity.job.Metrics;
|
||||
import org.apache.hertzbeat.common.entity.job.protocol.HttpsdProtocol;
|
||||
import org.apache.hertzbeat.common.entity.job.protocol.RegistryProtocol;
|
||||
import org.apache.hertzbeat.common.entity.message.CollectRep;
|
||||
import org.apache.hertzbeat.common.util.CommonUtil;
|
||||
|
||||
/**
|
||||
* http_sd protocol collection implementation
|
||||
* registry protocol collection implementation
|
||||
*/
|
||||
@Slf4j
|
||||
public class HttpsdImpl extends AbstractCollect {
|
||||
public class RegistryImpl extends AbstractCollect {
|
||||
private static final String SERVER = "server";
|
||||
|
||||
@Setter
|
||||
@@ -51,17 +51,17 @@ public class HttpsdImpl extends AbstractCollect {
|
||||
|
||||
@Override
|
||||
public void preCheck(Metrics metrics) throws IllegalArgumentException {
|
||||
HttpsdProtocol httpsdProtocol = metrics.getHttpsd();
|
||||
if (Objects.isNull(httpsdProtocol) || httpsdProtocol.isInvalid()){
|
||||
throw new IllegalArgumentException("http_sd collect must have a valid http_sd protocol param! ");
|
||||
RegistryProtocol registryProtocol = metrics.getRegistry();
|
||||
if (Objects.isNull(registryProtocol) || registryProtocol.isInvalid()){
|
||||
throw new IllegalArgumentException("registry collect must have a valid registry protocol param! ");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collect(CollectRep.MetricsData.Builder builder, long monitorId, String app, Metrics metrics) {
|
||||
HttpsdProtocol httpsdProtocol = metrics.getHttpsd();
|
||||
RegistryProtocol registryProtocol = metrics.getRegistry();
|
||||
|
||||
try (DiscoveryClient discoveryClient = discoveryClientManagement.getClient(httpsdProtocol)) {
|
||||
try (DiscoveryClient discoveryClient = discoveryClientManagement.getClient(registryProtocol)) {
|
||||
collectMetrics(builder, metrics, discoveryClient);
|
||||
} catch (TransportException e1) {
|
||||
String errorMsg = "Consul " + CommonUtil.getMessageFromThrowable(e1);
|
||||
@@ -103,11 +103,7 @@ public class HttpsdImpl extends AbstractCollect {
|
||||
|
||||
@Override
|
||||
public String supportProtocol() {
|
||||
return DispatchConstants.PROTOCOL_HTTP_SD;
|
||||
}
|
||||
|
||||
private boolean checkParamsFailed(HttpsdProtocol httpsd) {
|
||||
return Objects.isNull(httpsd) || httpsd.isInvalid();
|
||||
return DispatchConstants.PROTOCOL_REGISTRY;
|
||||
}
|
||||
|
||||
private void addColumnIfMatched(String fieldName, Object sourceObj, CollectRep.ValueRow.Builder valueRowBuilder) {
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hertzbeat.collector.collect.httpsd.constant;
|
||||
package org.apache.hertzbeat.collector.collect.registry.constant;
|
||||
|
||||
/**
|
||||
* Discovery client instance status.
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hertzbeat.collector.collect.httpsd.constant;
|
||||
package org.apache.hertzbeat.collector.collect.registry.constant;
|
||||
|
||||
import java.util.Arrays;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
+7
-7
@@ -17,13 +17,13 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hertzbeat.collector.collect.httpsd.discovery;
|
||||
package org.apache.hertzbeat.collector.collect.registry.discovery;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.hertzbeat.collector.collect.httpsd.discovery.entity.ConnectConfig;
|
||||
import org.apache.hertzbeat.collector.collect.httpsd.discovery.entity.ServerInfo;
|
||||
import org.apache.hertzbeat.collector.collect.httpsd.discovery.entity.ServiceInstance;
|
||||
import org.apache.hertzbeat.common.entity.job.protocol.HttpsdProtocol;
|
||||
import org.apache.hertzbeat.collector.collect.registry.discovery.entity.ConnectConfig;
|
||||
import org.apache.hertzbeat.collector.collect.registry.discovery.entity.ServerInfo;
|
||||
import org.apache.hertzbeat.collector.collect.registry.discovery.entity.ServiceInstance;
|
||||
import org.apache.hertzbeat.common.entity.job.protocol.RegistryProtocol;
|
||||
|
||||
/**
|
||||
* DiscoveryClient interface.
|
||||
@@ -32,10 +32,10 @@ public interface DiscoveryClient extends AutoCloseable {
|
||||
|
||||
/**
|
||||
* Build connect config.
|
||||
* @param httpsdProtocol httpsd protocol.
|
||||
* @param registryProtocol registry protocol.
|
||||
* @return connect config object.
|
||||
*/
|
||||
ConnectConfig buildConnectConfig(HttpsdProtocol httpsdProtocol);
|
||||
ConnectConfig buildConnectConfig(RegistryProtocol registryProtocol);
|
||||
|
||||
/**
|
||||
* Initialize client.
|
||||
+11
-11
@@ -17,39 +17,39 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hertzbeat.collector.collect.httpsd.discovery;
|
||||
package org.apache.hertzbeat.collector.collect.registry.discovery;
|
||||
|
||||
import java.util.Objects;
|
||||
import org.apache.hertzbeat.collector.collect.httpsd.constant.DiscoveryClientInstance;
|
||||
import org.apache.hertzbeat.collector.collect.httpsd.discovery.impl.ConsulDiscoveryClient;
|
||||
import org.apache.hertzbeat.collector.collect.httpsd.discovery.impl.NacosDiscoveryClient;
|
||||
import org.apache.hertzbeat.common.entity.job.protocol.HttpsdProtocol;
|
||||
import org.apache.hertzbeat.collector.collect.registry.constant.DiscoveryClientInstance;
|
||||
import org.apache.hertzbeat.collector.collect.registry.discovery.impl.ConsulDiscoveryClient;
|
||||
import org.apache.hertzbeat.collector.collect.registry.discovery.impl.NacosDiscoveryClient;
|
||||
import org.apache.hertzbeat.common.entity.job.protocol.RegistryProtocol;
|
||||
|
||||
/**
|
||||
* Discovery Client Management
|
||||
*/
|
||||
public class DiscoveryClientManagement {
|
||||
|
||||
public DiscoveryClient getClient(HttpsdProtocol httpsdProtocol) {
|
||||
return createClient(httpsdProtocol, DiscoveryClientInstance.getByName(httpsdProtocol.getDiscoveryClientTypeName()));
|
||||
public DiscoveryClient getClient(RegistryProtocol registryProtocol) {
|
||||
return createClient(registryProtocol, DiscoveryClientInstance.getByName(registryProtocol.getDiscoveryClientTypeName()));
|
||||
}
|
||||
|
||||
private DiscoveryClient createClient(HttpsdProtocol httpsdProtocol, DiscoveryClientInstance discoveryClientInstance) {
|
||||
private DiscoveryClient createClient(RegistryProtocol registryProtocol, DiscoveryClientInstance discoveryClientInstance) {
|
||||
if (Objects.equals(discoveryClientInstance, DiscoveryClientInstance.NOT_SUPPORT)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return doCreateClient(httpsdProtocol, discoveryClientInstance);
|
||||
return doCreateClient(registryProtocol, discoveryClientInstance);
|
||||
}
|
||||
|
||||
private DiscoveryClient doCreateClient(HttpsdProtocol httpsdProtocol, DiscoveryClientInstance discoveryClientInstance) {
|
||||
private DiscoveryClient doCreateClient(RegistryProtocol registryProtocol, DiscoveryClientInstance discoveryClientInstance) {
|
||||
DiscoveryClient discoveryClient;
|
||||
switch (discoveryClientInstance) {
|
||||
case CONSUL -> discoveryClient = new ConsulDiscoveryClient();
|
||||
case NACOS -> discoveryClient = new NacosDiscoveryClient();
|
||||
default -> { return null; }
|
||||
}
|
||||
discoveryClient.initClient(discoveryClient.buildConnectConfig(httpsdProtocol));
|
||||
discoveryClient.initClient(discoveryClient.buildConnectConfig(registryProtocol));
|
||||
return discoveryClient;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hertzbeat.collector.collect.httpsd.discovery.entity;
|
||||
package org.apache.hertzbeat.collector.collect.registry.discovery.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hertzbeat.collector.collect.httpsd.discovery.entity;
|
||||
package org.apache.hertzbeat.collector.collect.registry.discovery.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hertzbeat.collector.collect.httpsd.discovery.entity;
|
||||
package org.apache.hertzbeat.collector.collect.registry.discovery.entity;
|
||||
|
||||
import java.util.Map;
|
||||
import lombok.AllArgsConstructor;
|
||||
+9
-9
@@ -17,7 +17,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hertzbeat.collector.collect.httpsd.discovery.impl;
|
||||
package org.apache.hertzbeat.collector.collect.registry.discovery.impl;
|
||||
|
||||
import com.ecwid.consul.v1.ConsulClient;
|
||||
import com.ecwid.consul.v1.agent.model.Check;
|
||||
@@ -28,11 +28,11 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.hertzbeat.collector.collect.httpsd.discovery.DiscoveryClient;
|
||||
import org.apache.hertzbeat.collector.collect.httpsd.discovery.entity.ConnectConfig;
|
||||
import org.apache.hertzbeat.collector.collect.httpsd.discovery.entity.ServerInfo;
|
||||
import org.apache.hertzbeat.collector.collect.httpsd.discovery.entity.ServiceInstance;
|
||||
import org.apache.hertzbeat.common.entity.job.protocol.HttpsdProtocol;
|
||||
import org.apache.hertzbeat.collector.collect.registry.discovery.DiscoveryClient;
|
||||
import org.apache.hertzbeat.collector.collect.registry.discovery.entity.ConnectConfig;
|
||||
import org.apache.hertzbeat.collector.collect.registry.discovery.entity.ServerInfo;
|
||||
import org.apache.hertzbeat.collector.collect.registry.discovery.entity.ServiceInstance;
|
||||
import org.apache.hertzbeat.common.entity.job.protocol.RegistryProtocol;
|
||||
|
||||
/**
|
||||
* DiscoveryClient impl of Consul
|
||||
@@ -41,10 +41,10 @@ public class ConsulDiscoveryClient implements DiscoveryClient {
|
||||
private ConsulClient consulClient;
|
||||
|
||||
@Override
|
||||
public ConnectConfig buildConnectConfig(HttpsdProtocol httpsdProtocol) {
|
||||
public ConnectConfig buildConnectConfig(RegistryProtocol registryProtocol) {
|
||||
return ConnectConfig.builder()
|
||||
.host(httpsdProtocol.getHost())
|
||||
.port(Integer.parseInt(httpsdProtocol.getPort()))
|
||||
.host(registryProtocol.getHost())
|
||||
.port(Integer.parseInt(registryProtocol.getPort()))
|
||||
.build();
|
||||
}
|
||||
|
||||
+10
-10
@@ -17,7 +17,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hertzbeat.collector.collect.httpsd.discovery.impl;
|
||||
package org.apache.hertzbeat.collector.collect.registry.discovery.impl;
|
||||
|
||||
import com.alibaba.nacos.api.exception.NacosException;
|
||||
import com.alibaba.nacos.api.naming.NamingFactory;
|
||||
@@ -27,12 +27,12 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.hertzbeat.collector.collect.httpsd.constant.DiscoveryClientHealthStatus;
|
||||
import org.apache.hertzbeat.collector.collect.httpsd.discovery.DiscoveryClient;
|
||||
import org.apache.hertzbeat.collector.collect.httpsd.discovery.entity.ConnectConfig;
|
||||
import org.apache.hertzbeat.collector.collect.httpsd.discovery.entity.ServerInfo;
|
||||
import org.apache.hertzbeat.collector.collect.httpsd.discovery.entity.ServiceInstance;
|
||||
import org.apache.hertzbeat.common.entity.job.protocol.HttpsdProtocol;
|
||||
import org.apache.hertzbeat.collector.collect.registry.constant.DiscoveryClientHealthStatus;
|
||||
import org.apache.hertzbeat.collector.collect.registry.discovery.DiscoveryClient;
|
||||
import org.apache.hertzbeat.collector.collect.registry.discovery.entity.ConnectConfig;
|
||||
import org.apache.hertzbeat.collector.collect.registry.discovery.entity.ServerInfo;
|
||||
import org.apache.hertzbeat.collector.collect.registry.discovery.entity.ServiceInstance;
|
||||
import org.apache.hertzbeat.common.entity.job.protocol.RegistryProtocol;
|
||||
|
||||
/**
|
||||
* DiscoveryClient impl of Nacos
|
||||
@@ -43,10 +43,10 @@ public class NacosDiscoveryClient implements DiscoveryClient {
|
||||
private ConnectConfig localConnectConfig;
|
||||
|
||||
@Override
|
||||
public ConnectConfig buildConnectConfig(HttpsdProtocol httpsdProtocol) {
|
||||
public ConnectConfig buildConnectConfig(RegistryProtocol registryProtocol) {
|
||||
return ConnectConfig.builder()
|
||||
.host(httpsdProtocol.getHost())
|
||||
.port(Integer.parseInt(httpsdProtocol.getPort()))
|
||||
.host(registryProtocol.getHost())
|
||||
.port(Integer.parseInt(registryProtocol.getPort()))
|
||||
.build();
|
||||
}
|
||||
|
||||
+21
-21
@@ -15,18 +15,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hertzbeat.collector.collect.httpsd;
|
||||
package org.apache.hertzbeat.collector.collect.registry;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.hertzbeat.collector.collect.httpsd.discovery.DiscoveryClient;
|
||||
import org.apache.hertzbeat.collector.collect.httpsd.discovery.DiscoveryClientManagement;
|
||||
import org.apache.hertzbeat.collector.collect.httpsd.discovery.entity.ServerInfo;
|
||||
import org.apache.hertzbeat.collector.collect.httpsd.discovery.entity.ServiceInstance;
|
||||
import org.apache.hertzbeat.collector.collect.registry.discovery.DiscoveryClient;
|
||||
import org.apache.hertzbeat.collector.collect.registry.discovery.DiscoveryClientManagement;
|
||||
import org.apache.hertzbeat.collector.collect.registry.discovery.entity.ServerInfo;
|
||||
import org.apache.hertzbeat.collector.collect.registry.discovery.entity.ServiceInstance;
|
||||
import org.apache.hertzbeat.common.entity.job.Metrics;
|
||||
import org.apache.hertzbeat.common.entity.job.protocol.HttpsdProtocol;
|
||||
import org.apache.hertzbeat.common.entity.job.protocol.RegistryProtocol;
|
||||
import org.apache.hertzbeat.common.entity.message.CollectRep;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
@@ -37,13 +37,13 @@ import org.mockito.Spy;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
/**
|
||||
* Test case for {@link HttpsdImpl}
|
||||
* Test case for {@link RegistryImpl}
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class HttpsdImplTest {
|
||||
class RegistryImplTest {
|
||||
@InjectMocks
|
||||
@Spy
|
||||
private HttpsdImpl httpsd;
|
||||
private RegistryImpl registry;
|
||||
|
||||
@Mock
|
||||
private DiscoveryClient client;
|
||||
@@ -57,7 +57,7 @@ class HttpsdImplTest {
|
||||
|
||||
String port = "123";
|
||||
String host = "127.0.0.1";
|
||||
HttpsdProtocol httpsdProtocol = HttpsdProtocol.builder()
|
||||
RegistryProtocol registryProtocol = RegistryProtocol.builder()
|
||||
.port(port)
|
||||
.host(host)
|
||||
.discoveryClientTypeName("consul")
|
||||
@@ -68,18 +68,18 @@ class HttpsdImplTest {
|
||||
aliasField.add("responseTime");
|
||||
Metrics metrics = new Metrics();
|
||||
metrics.setName("server");
|
||||
metrics.setHttpsd(httpsdProtocol);
|
||||
metrics.setRegistry(registryProtocol);
|
||||
metrics.setAliasFields(aliasField);
|
||||
|
||||
Mockito.when(discoveryClientManagement.getClient(httpsdProtocol)).thenReturn(client);
|
||||
Mockito.when(discoveryClientManagement.getClient(registryProtocol)).thenReturn(client);
|
||||
ServerInfo serverInfo = ServerInfo.builder()
|
||||
.address(host)
|
||||
.port(port)
|
||||
.build();
|
||||
Mockito.when(client.getServerInfo()).thenReturn(serverInfo);
|
||||
httpsd.setDiscoveryClientManagement(discoveryClientManagement);
|
||||
httpsd.preCheck(metrics);
|
||||
httpsd.collect(builder, 1L, "test", metrics);
|
||||
registry.setDiscoveryClientManagement(discoveryClientManagement);
|
||||
registry.preCheck(metrics);
|
||||
registry.collect(builder, 1L, "test", metrics);
|
||||
for (CollectRep.ValueRow valueRow : builder.getValuesList()) {
|
||||
assertEquals(host, valueRow.getColumns(0));
|
||||
assertEquals(port, valueRow.getColumns(1));
|
||||
@@ -93,7 +93,7 @@ class HttpsdImplTest {
|
||||
|
||||
String port = "123";
|
||||
String host = "127.0.0.1";
|
||||
HttpsdProtocol httpsdProtocol = HttpsdProtocol.builder()
|
||||
RegistryProtocol registryProtocol = RegistryProtocol.builder()
|
||||
.port(port)
|
||||
.host(host)
|
||||
.discoveryClientTypeName("consul")
|
||||
@@ -105,10 +105,10 @@ class HttpsdImplTest {
|
||||
aliasField.add("port");
|
||||
Metrics metrics = new Metrics();
|
||||
metrics.setName("service");
|
||||
metrics.setHttpsd(httpsdProtocol);
|
||||
metrics.setRegistry(registryProtocol);
|
||||
metrics.setAliasFields(aliasField);
|
||||
|
||||
Mockito.when(discoveryClientManagement.getClient(httpsdProtocol)).thenReturn(client);
|
||||
Mockito.when(discoveryClientManagement.getClient(registryProtocol)).thenReturn(client);
|
||||
|
||||
String serviceId = "test";
|
||||
String serviceName = "service";
|
||||
@@ -121,9 +121,9 @@ class HttpsdImplTest {
|
||||
.build());
|
||||
|
||||
Mockito.when(client.getServices()).thenReturn(serviceInstances);
|
||||
httpsd.setDiscoveryClientManagement(discoveryClientManagement);
|
||||
httpsd.preCheck(metrics);
|
||||
httpsd.collect(builder, 1L, "test", metrics);
|
||||
registry.setDiscoveryClientManagement(discoveryClientManagement);
|
||||
registry.preCheck(metrics);
|
||||
registry.collect(builder, 1L, "test", metrics);
|
||||
assertEquals(builder.getValuesCount(), 1);
|
||||
for (CollectRep.ValueRow valueRow : builder.getValuesList()) {
|
||||
assertEquals(serviceId, valueRow.getColumns(0));
|
||||
+1
-1
@@ -20,7 +20,7 @@ org.apache.hertzbeat.collector.collect.nginx.NginxCollectImpl
|
||||
org.apache.hertzbeat.collector.collect.memcached.MemcachedCollectImpl
|
||||
org.apache.hertzbeat.collector.collect.nebulagraph.NebulaGraphCollectImpl
|
||||
org.apache.hertzbeat.collector.collect.pop3.Pop3CollectImpl
|
||||
org.apache.hertzbeat.collector.collect.httpsd.HttpsdImpl
|
||||
org.apache.hertzbeat.collector.collect.registry.RegistryImpl
|
||||
org.apache.hertzbeat.collector.collect.redfish.RedfishCollectImpl
|
||||
org.apache.hertzbeat.collector.collect.nebulagraph.NgqlCollectImpl
|
||||
org.apache.hertzbeat.collector.collect.imap.ImapCollectImpl
|
||||
|
||||
+2
-2
@@ -120,9 +120,9 @@ public interface DispatchConstants {
|
||||
*/
|
||||
String PROTOCOL_POP3 = "pop3";
|
||||
/**
|
||||
* protocol http_sd
|
||||
* protocol registry
|
||||
*/
|
||||
String PROTOCOL_HTTP_SD = "httpsd";
|
||||
String PROTOCOL_REGISTRY = "registry";
|
||||
/**
|
||||
* protocol redfish
|
||||
*/
|
||||
|
||||
@@ -32,7 +32,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.hertzbeat.common.entity.job.protocol.DnsProtocol;
|
||||
import org.apache.hertzbeat.common.entity.job.protocol.FtpProtocol;
|
||||
import org.apache.hertzbeat.common.entity.job.protocol.HttpProtocol;
|
||||
import org.apache.hertzbeat.common.entity.job.protocol.HttpsdProtocol;
|
||||
import org.apache.hertzbeat.common.entity.job.protocol.RegistryProtocol;
|
||||
import org.apache.hertzbeat.common.entity.job.protocol.IcmpProtocol;
|
||||
import org.apache.hertzbeat.common.entity.job.protocol.ImapProtocol;
|
||||
import org.apache.hertzbeat.common.entity.job.protocol.IpmiProtocol;
|
||||
@@ -219,9 +219,9 @@ public class Metrics {
|
||||
*/
|
||||
private Pop3Protocol pop3;
|
||||
/**
|
||||
* Monitoring configuration information using the public http_sd protocol
|
||||
* Monitoring configuration information using the public registry protocol
|
||||
*/
|
||||
private HttpsdProtocol httpsd;
|
||||
private RegistryProtocol registry;
|
||||
/**
|
||||
* Monitoring configuration information using the public redfish protocol
|
||||
*/
|
||||
|
||||
+2
-2
@@ -26,13 +26,13 @@ import lombok.NoArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* Httpsd protocol
|
||||
* Registry protocol
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class HttpsdProtocol {
|
||||
public class RegistryProtocol {
|
||||
private String host;
|
||||
private String port;
|
||||
private String discoveryClientTypeName;
|
||||
+10
-10
@@ -16,16 +16,16 @@
|
||||
# The monitoring type category:service-application service monitoring db-database monitoring mid-middleware custom-custom monitoring os-operating system monitoring
|
||||
category: service
|
||||
# The monitoring type eg: linux windows tomcat mysql aws...
|
||||
app: httpsd
|
||||
app: registry
|
||||
# The monitoring i18n name
|
||||
name:
|
||||
zh-CN: HTTP SD监控
|
||||
en-US: HTTP SD MONITORS
|
||||
zh-CN: 注册中心监控
|
||||
en-US: REGISTRY MONITORS
|
||||
# The description and help of this monitoring type
|
||||
help:
|
||||
zh-CN: HertzBeat 对 HTTP SD 的相关指标进行监测。
|
||||
en-US: HertzBeat monitors related indicators of HTTP SD.
|
||||
zh-TW: HertzBeat對HTTP SD相關名額進行監測。
|
||||
zh-CN: HertzBeat对注册中心的相关指标进行监测。
|
||||
en-US: HertzBeat monitors related indicators of REGISTRY.
|
||||
zh-TW: HertzBeat對注冊中心相關名額進行監測。
|
||||
# Input params define for monitoring(render web ui by the definition)
|
||||
params:
|
||||
# field-param field key
|
||||
@@ -89,8 +89,8 @@ metrics:
|
||||
i18n:
|
||||
zh-CN: 响应时间
|
||||
en-US: Response Time
|
||||
protocol: httpsd
|
||||
httpsd:
|
||||
protocol: registry
|
||||
registry:
|
||||
host: ^_^host^_^
|
||||
port: ^_^port^_^
|
||||
discoveryClientTypeName: ^_^discoveryClientTypeName^_^
|
||||
@@ -127,8 +127,8 @@ metrics:
|
||||
i18n:
|
||||
zh-CN: 服务健康状态
|
||||
en-US: Health Status
|
||||
protocol: httpsd
|
||||
httpsd:
|
||||
protocol: registry
|
||||
registry:
|
||||
host: ^_^host^_^
|
||||
port: ^_^port^_^
|
||||
discoveryClientTypeName: ^_^discoveryClientTypeName^_^
|
||||
@@ -1,13 +1,13 @@
|
||||
---
|
||||
id: httpsd
|
||||
title: Monitoring Httpsd
|
||||
sidebar_label: Httpsd Monitor
|
||||
keywords: [open source monitoring tool, open source java monitoring tool, monitoring httpsd metrics]
|
||||
id: registry
|
||||
title: Monitoring Registry
|
||||
sidebar_label: Registry Monitor
|
||||
keywords: [open source monitoring tool, open source java monitoring tool, monitoring registry metrics]
|
||||
---
|
||||
|
||||
> Collect and monitor the general performance Metrics of Httpsd.
|
||||
> Collect and monitor the general performance Metrics of Registry.
|
||||
|
||||
**Protocol Use:httpsd**
|
||||
**Protocol Use:registry**
|
||||
|
||||
## Steps to monitor micro services
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
---
|
||||
id: httpsd
|
||||
title: Monitoring Httpsd
|
||||
sidebar_label: Httpsd Monitor
|
||||
keywords: [open source monitoring tool, open source java monitoring tool, monitoring httpsd metrics]
|
||||
id: registry
|
||||
title: Monitoring Registry
|
||||
sidebar_label: Registry Monitor
|
||||
keywords: [open source monitoring tool, open source java monitoring tool, monitoring registry metrics]
|
||||
---
|
||||
|
||||
> Collect and monitor the general performance Metrics of Httpsd.
|
||||
> Collect and monitor the general performance Metrics of Registry.
|
||||
|
||||
**Protocol Use:httpsd**
|
||||
**Protocol Use:registry**
|
||||
|
||||
## Steps to monitor micro services
|
||||
|
||||
Reference in New Issue
Block a user