未验证 提交 42d79bf0 编写于 作者: J Jared Tan 提交者: GitHub

Fix too many mang ipv4 records reported by the agent when deployed in container. (#4817)

上级 edd8305f
...@@ -109,6 +109,14 @@ public class Config { ...@@ -109,6 +109,14 @@ public class Config {
* Keep tracing even the backend is not available. * Keep tracing even the backend is not available.
*/ */
public static boolean KEEP_TRACING = false; public static boolean KEEP_TRACING = false;
}
public static class OsInfo {
/**
* Limit the length of the ipv4 list size.
*/
public static int IPV4_LIST_SIZE = 10;
} }
public static class Collector { public static class Collector {
......
...@@ -57,7 +57,7 @@ public class OSUtil { ...@@ -57,7 +57,7 @@ public class OSUtil {
public static List<String> getAllIPV4() { public static List<String> getAllIPV4() {
if (IPV4_LIST == null) { if (IPV4_LIST == null) {
IPV4_LIST = new LinkedList<String>(); IPV4_LIST = new LinkedList<>();
try { try {
Enumeration<NetworkInterface> interfs = NetworkInterface.getNetworkInterfaces(); Enumeration<NetworkInterface> interfs = NetworkInterface.getNetworkInterfaces();
while (interfs.hasMoreElements()) { while (interfs.hasMoreElements()) {
...@@ -103,8 +103,8 @@ public class OSUtil { ...@@ -103,8 +103,8 @@ public class OSUtil {
return PROCESS_NO; return PROCESS_NO;
} }
public static List<KeyStringValuePair> buildOSInfo() { public static List<KeyStringValuePair> buildOSInfo(int ipv4Size) {
List<KeyStringValuePair> osInfo = new ArrayList<KeyStringValuePair>(); List<KeyStringValuePair> osInfo = new ArrayList<>();
String osName = getOsName(); String osName = getOsName();
if (osName != null) { if (osName != null) {
...@@ -116,6 +116,9 @@ public class OSUtil { ...@@ -116,6 +116,9 @@ public class OSUtil {
} }
List<String> allIPV4 = getAllIPV4(); List<String> allIPV4 = getAllIPV4();
if (allIPV4.size() > 0) { if (allIPV4.size() > 0) {
if (allIPV4.size() > ipv4Size) {
allIPV4 = allIPV4.subList(0, ipv4Size);
}
for (String ipv4 : allIPV4) { for (String ipv4 : allIPV4) {
osInfo.add(KeyStringValuePair.newBuilder().setKey("ipv4").setValue(ipv4).build()); osInfo.add(KeyStringValuePair.newBuilder().setKey("ipv4").setValue(ipv4).build());
} }
......
...@@ -119,7 +119,8 @@ public class ServiceManagementClient implements BootService, Runnable, GRPCChann ...@@ -119,7 +119,8 @@ public class ServiceManagementClient implements BootService, Runnable, GRPCChann
.reportInstanceProperties(InstanceProperties.newBuilder() .reportInstanceProperties(InstanceProperties.newBuilder()
.setService(Config.Agent.SERVICE_NAME) .setService(Config.Agent.SERVICE_NAME)
.setServiceInstance(Config.Agent.INSTANCE_NAME) .setServiceInstance(Config.Agent.INSTANCE_NAME)
.addAllProperties(OSUtil.buildOSInfo()) .addAllProperties(OSUtil.buildOSInfo(
Config.OsInfo.IPV4_LIST_SIZE))
.addAllProperties(SERVICE_INSTANCE_PROPERTIES) .addAllProperties(SERVICE_INSTANCE_PROPERTIES)
.build()); .build());
instancePropertiesSubmitted = true; instancePropertiesSubmitted = true;
......
...@@ -84,6 +84,7 @@ property key | Description | Default | ...@@ -84,6 +84,7 @@ property key | Description | Default |
`agent.force_reconnection_period `|Force reconnection period of grpc, based on grpc_channel_check_interval.|`1`| `agent.force_reconnection_period `|Force reconnection period of grpc, based on grpc_channel_check_interval.|`1`|
`agent.operation_name_threshold `|The operationName max length, setting this value > 190 is not recommended.|`150`| `agent.operation_name_threshold `|The operationName max length, setting this value > 190 is not recommended.|`150`|
`agent.keep_tracing`|Keep tracing even the backend is not available if this value is `true`.|`false`| `agent.keep_tracing`|Keep tracing even the backend is not available if this value is `true`.|`false`|
`osinfo.ipv4_list_size`| Limit the length of the ipv4 list size. |`10`|
`collector.grpc_channel_check_interval`|grpc channel status check interval.|`30`| `collector.grpc_channel_check_interval`|grpc channel status check interval.|`30`|
`collector.heartbeat_period`|agent heartbeat report period. Unit, second.|`30`| `collector.heartbeat_period`|agent heartbeat report period. Unit, second.|`30`|
`collector.backend_service`|Collector SkyWalking trace receiver service addresses.|`127.0.0.1:11800`| `collector.backend_service`|Collector SkyWalking trace receiver service addresses.|`127.0.0.1:11800`|
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册