This is an automated email from the ASF dual-hosted git repository.

shushengzhou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hertzbeat.git


The following commit(s) were added to refs/heads/master by this push:
     new d88851d7e [improve] Fix typo ReqStatusResponse (#1811)
d88851d7e is described below

commit d88851d7ea20226735341edbb80926df6c23bacf
Author: crossoverJie <[email protected]>
AuthorDate: Mon Apr 22 21:12:17 2024 +0800

    [improve] Fix typo ReqStatusResponse (#1811)
    
    Signed-off-by: 淞筱 <[email protected]>
    Co-authored-by: 淞筱 <[email protected]>
---
 .../collector/collect/nginx/NginxCollectImpl.java  | 32 +++++++++++-----------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git 
a/collector/src/main/java/org/apache/hertzbeat/collector/collect/nginx/NginxCollectImpl.java
 
b/collector/src/main/java/org/apache/hertzbeat/collector/collect/nginx/NginxCollectImpl.java
index 41c258562..930098492 100644
--- 
a/collector/src/main/java/org/apache/hertzbeat/collector/collect/nginx/NginxCollectImpl.java
+++ 
b/collector/src/main/java/org/apache/hertzbeat/collector/collect/nginx/NginxCollectImpl.java
@@ -76,7 +76,7 @@ public class NginxCollectImpl extends AbstractCollect {
 
 
     public NginxCollectImpl() {
-
+        
     }
 
     @Override
@@ -135,9 +135,9 @@ public class NginxCollectImpl extends AbstractCollect {
         if (metrics == null || (nginxProtocol = metrics.getNginx()) == null || 
nginxProtocol.isInValid()) {
             throw new Exception("Nginx collect must has nginx params");
         }
-        
+
         if (nginxProtocol.getUrl() == null
-                || "".equals(nginxProtocol.getUrl())
+                || nginxProtocol.getUrl().isEmpty()
                 || !nginxProtocol.getUrl().startsWith(RIGHT_DASH)) {
             nginxProtocol.setUrl(nginxProtocol.getUrl() == null ? RIGHT_DASH : 
RIGHT_DASH + nginxProtocol.getUrl().trim());
         }
@@ -238,18 +238,18 @@ public class NginxCollectImpl extends AbstractCollect {
         //server_name     d.123.sogou.com 478     115M    2850G   30218726     
   115     39M
         //server_name     dl.pinyin.sogou.com     913     312M    8930G   
35345453        225     97M
         //server_name     download.ie.sogou.com   964     275M    7462G   
7979817 297     135M
-        List<ReqSatusResponse> reqSatusResponses = regexReqStatusMatch(resp);
+        List<ReqStatusResponse> reqStatusResponses = regexReqStatusMatch(resp);
         List<String> aliasFields = metrics.getAliasFields();
 
-        for (ReqSatusResponse reqSatusResponse : reqSatusResponses) {
+        for (ReqStatusResponse reqStatusResponse : reqStatusResponses) {
             CollectRep.ValueRow.Builder valueRowBuilder = 
CollectRep.ValueRow.newBuilder();
             for (String alias : aliasFields) {
                 if (CollectorConstants.RESPONSE_TIME.equals(alias)) {
                     valueRowBuilder.addColumns(String.valueOf(responseTime));
                 } else {
                     try {
-                        String methodName = 
reqSatusResponse.getFieldMethodName(alias);
-                        Object value = reflect(reqSatusResponse, methodName);
+                        String methodName = 
reqStatusResponse.getFieldMethodName(alias);
+                        Object value = reflect(reqStatusResponse, methodName);
                         value = value == null ? CommonConstants.NULL_VALUE : 
value;
                         valueRowBuilder.addColumns(String.valueOf(value));
                     } catch (Exception e) {
@@ -264,10 +264,10 @@ public class NginxCollectImpl extends AbstractCollect {
         }
     }
 
-    private Object reflect(ReqSatusResponse reqSatusResponse, String 
methodName) throws NoSuchMethodException, InvocationTargetException, 
IllegalAccessException {
-        Class<?> clazz = reqSatusResponse.getClass();
+    private Object reflect(ReqStatusResponse reqStatusResponse, String 
methodName) throws NoSuchMethodException, InvocationTargetException, 
IllegalAccessException {
+        Class<?> clazz = reqStatusResponse.getClass();
         Method method = clazz.getMethod(methodName);
-        return method.invoke(reqSatusResponse);
+        return method.invoke(reqStatusResponse);
     }
 
     private Map<String, Object> regexNginxStatusMatch(String resp, Integer 
aliasFieldsSize) {
@@ -292,13 +292,13 @@ public class NginxCollectImpl extends AbstractCollect {
         return metricsMap;
     }
 
-    private List<ReqSatusResponse> regexReqStatusMatch(String resp) {
-        List<ReqSatusResponse> reqSatusResponses = new ArrayList<>();
+    private List<ReqStatusResponse> regexReqStatusMatch(String resp) {
+        List<ReqStatusResponse> reqStatusResponses = new ArrayList<>();
 
         String[] lines = resp.split(REGEX_SPLIT);
         for (int i = 1; i < lines.length; i++) {
             String[] values = lines[i].split(REGEX_LINE_SPLIT);
-            ReqSatusResponse reqSatusResponse = ReqSatusResponse.builder()
+            ReqStatusResponse reqStatusResponse = ReqStatusResponse.builder()
                     .zoneName(values[0])
                     .key(values[1])
                     .maxActive(values[2])
@@ -308,16 +308,16 @@ public class NginxCollectImpl extends AbstractCollect {
                     .active(values[6])
                     .bandwidth(values[7])
                     .build();
-            reqSatusResponses.add(reqSatusResponse);
+            reqStatusResponses.add(reqStatusResponse);
         }
-        return reqSatusResponses;
+        return reqStatusResponses;
     }
 
     @Data
     @Builder
     @AllArgsConstructor
     @NoArgsConstructor
-    static class ReqSatusResponse {
+    static class ReqStatusResponse {
         private String zoneName; // zone_name
 
         private String maxActive; // max_active


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to