You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by "xcsnx (via GitHub)" <gi...@apache.org> on 2023/07/06 07:25:04 UTC

[GitHub] [shenyu] xcsnx opened a new pull request, #4812: feature shenyu-plugin:add shenyu-plugin-logging-huawei-lts

xcsnx opened a new pull request, #4812:
URL: https://github.com/apache/shenyu/pull/4812

   <!-- Describe your PR here; eg. Fixes #issueNo -->
   
   <!--
   Thank you for proposing a pull request. This template will guide you through the essential steps necessary for a pull request.
   -->
   Make sure that:
   
   - [ ] You have read the [contribution guidelines](https://shenyu.apache.org/community/contributor-guide).
   - [ ] You submit test cases (unit or integration tests) that back your changes.
   - [ ] Your local test passed `./mvnw clean install -Dmaven.javadoc.skip=true`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shenyu] moremind commented on a diff in pull request #4812: feature shenyu-plugin:add shenyu-plugin-logging-huawei-lts

Posted by "moremind (via GitHub)" <gi...@apache.org>.
moremind commented on code in PR #4812:
URL: https://github.com/apache/shenyu/pull/4812#discussion_r1255081135


##########
shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-logging-huawei-lts/src/test/java/org/apache/shenyu/springboot/starter/plugin/logging/huawei/lts/LoggingTencentClsPluginConfigurationTest.java:
##########
@@ -0,0 +1,46 @@
+/*
+ * 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.shenyu.springboot.starter.plugin.logging.huawei.lts;
+
+import org.apache.shenyu.common.enums.PluginEnum;
+import org.apache.shenyu.plugin.api.ShenyuPlugin;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.autoconfigure.AutoConfigurations;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.boot.test.context.runner.ApplicationContextRunner;
+import org.springframework.context.annotation.Configuration;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+@Configuration
+@EnableConfigurationProperties
+public class LoggingTencentClsPluginConfigurationTest {

Review Comment:
   cls?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shenyu] codecov-commenter commented on pull request #4812: feature shenyu-plugin:add shenyu-plugin-logging-huawei-lts

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #4812:
URL: https://github.com/apache/shenyu/pull/4812#issuecomment-1623240261

   ## [Codecov](https://app.codecov.io/gh/apache/shenyu/pull/4812?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   > Merging [#4812](https://app.codecov.io/gh/apache/shenyu/pull/4812?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (271f3b5) into [master](https://app.codecov.io/gh/apache/shenyu/commit/92966fd1d44279401a106d18f871fb506774c929?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (92966fd) will **decrease** coverage by `0.18%`.
   > The diff coverage is `76.84%`.
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #4812      +/-   ##
   ============================================
   - Coverage     65.29%   65.12%   -0.18%     
   - Complexity     8184     8194      +10     
   ============================================
     Files          1138     1144       +6     
     Lines         33476    33654     +178     
     Branches       2975     2994      +19     
   ============================================
   + Hits          21858    21917      +59     
   - Misses         9893     9989      +96     
   - Partials       1725     1748      +23     
   ```
   
   
   | [Impacted Files](https://app.codecov.io/gh/apache/shenyu/pull/4812?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [...ugin/huawei/lts/config/HuaweiLogCollectConfig.java](https://app.codecov.io/gh/apache/shenyu/pull/4812?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWxvZ2dpbmcvc2hlbnl1LXBsdWdpbi1sb2dnaW5nLWh1YXdlaS1sdHMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoZW55dS9wbHVnaW4vaHVhd2VpL2x0cy9jb25maWcvSHVhd2VpTG9nQ29sbGVjdENvbmZpZy5qYXZh) | `72.52% <72.52%> (ø)` | |
   | [...n/huawei/lts/client/HuaweiLtsLogCollectClient.java](https://app.codecov.io/gh/apache/shenyu/pull/4812?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWxvZ2dpbmcvc2hlbnl1LXBsdWdpbi1sb2dnaW5nLWh1YXdlaS1sdHMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoZW55dS9wbHVnaW4vaHVhd2VpL2x0cy9jbGllbnQvSHVhd2VpTHRzTG9nQ29sbGVjdENsaWVudC5qYXZh) | `76.92% <76.92%> (ø)` | |
   | [...in/huawei/lts/collector/HuaweiLtsLogCollector.java](https://app.codecov.io/gh/apache/shenyu/pull/4812?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWxvZ2dpbmcvc2hlbnl1LXBsdWdpbi1sb2dnaW5nLWh1YXdlaS1sdHMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoZW55dS9wbHVnaW4vaHVhd2VpL2x0cy9jb2xsZWN0b3IvSHVhd2VpTHRzTG9nQ29sbGVjdG9yLmphdmE=) | `80.00% <80.00%> (ø)` | |
   | [...ava/org/apache/shenyu/common/enums/PluginEnum.java](https://app.codecov.io/gh/apache/shenyu/pull/4812?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c2hlbnl1LWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hlbnl1L2NvbW1vbi9lbnVtcy9QbHVnaW5FbnVtLmphdmE=) | `100.00% <100.00%> (ø)` | |
   | [...enyu/plugin/huawei/lts/LoggingHuaweiLtsPlugin.java](https://app.codecov.io/gh/apache/shenyu/pull/4812?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWxvZ2dpbmcvc2hlbnl1LXBsdWdpbi1sb2dnaW5nLWh1YXdlaS1sdHMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoZW55dS9wbHVnaW4vaHVhd2VpL2x0cy9Mb2dnaW5nSHVhd2VpTHRzUGx1Z2luLmphdmE=) | `100.00% <100.00%> (ø)` | |
   | [...lts/handler/LoggingHuaweiLtsPluginDataHandler.java](https://app.codecov.io/gh/apache/shenyu/pull/4812?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWxvZ2dpbmcvc2hlbnl1LXBsdWdpbi1sb2dnaW5nLWh1YXdlaS1sdHMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoZW55dS9wbHVnaW4vaHVhd2VpL2x0cy9oYW5kbGVyL0xvZ2dpbmdIdWF3ZWlMdHNQbHVnaW5EYXRhSGFuZGxlci5qYXZh) | `100.00% <100.00%> (ø)` | |
   | [...uawei/lts/LoggingHuaweiLtsPluginConfiguration.java](https://app.codecov.io/gh/apache/shenyu/pull/4812?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c2hlbnl1LXNwcmluZy1ib290LXN0YXJ0ZXIvc2hlbnl1LXNwcmluZy1ib290LXN0YXJ0ZXItcGx1Z2luL3NoZW55dS1zcHJpbmctYm9vdC1zdGFydGVyLXBsdWdpbi1sb2dnaW5nLWh1YXdlaS1sdHMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoZW55dS9zcHJpbmdib290L3N0YXJ0ZXIvcGx1Z2luL2xvZ2dpbmcvaHVhd2VpL2x0cy9Mb2dnaW5nSHVhd2VpTHRzUGx1Z2luQ29uZmlndXJhdGlvbi5qYXZh) | `100.00% <100.00%> (ø)` | |
   
   ... and [25 files with indirect coverage changes](https://app.codecov.io/gh/apache/shenyu/pull/4812/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shenyu] xcsnx commented on pull request #4812: feature shenyu-plugin:add shenyu-plugin-logging-huawei-lts

Posted by "xcsnx (via GitHub)" <gi...@apache.org>.
xcsnx commented on PR #4812:
URL: https://github.com/apache/shenyu/pull/4812#issuecomment-1630252276

   > pls add data. -> `./db/upgrade/2.5.1-upgrade-2.6.0-*.sql` @xcsnx
   ok
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shenyu] moremind commented on a diff in pull request #4812: feature shenyu-plugin:add shenyu-plugin-logging-huawei-lts

Posted by "moremind (via GitHub)" <gi...@apache.org>.
moremind commented on code in PR #4812:
URL: https://github.com/apache/shenyu/pull/4812#discussion_r1254394684


##########
shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-huawei-lts/src/main/java/org/apache/shenyu/plugin/huawei/lts/client/HuaweiLtsLogCollectClient.java:
##########
@@ -0,0 +1,206 @@
+/*
+ * 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.shenyu.plugin.huawei.lts.client;
+
+import com.alibaba.fastjson.JSONObject;
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.huaweicloud.lts.appender.JavaSDKAppender;
+import com.huaweicloud.lts.producer.Producer;
+import com.huaweicloud.lts.producer.Result;
+import com.huaweicloud.lts.producer.exception.ProducerException;
+import com.huaweicloud.lts.producer.exception.ResultFailedException;
+import com.huaweicloud.lts.producer.model.log.LogContent;
+import com.huaweicloud.lts.producer.model.log.LogItem;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shenyu.common.concurrent.ShenyuThreadFactory;
+import org.apache.shenyu.plugin.huawei.lts.config.HuaweiLogCollectConfig;
+import org.apache.shenyu.plugin.logging.common.client.AbstractLogConsumeClient;
+import org.apache.shenyu.plugin.logging.common.constant.GenericLoggingConstant;
+import org.apache.shenyu.plugin.logging.common.entity.ShenyuRequestLog;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.lang.NonNull;
+
+import javax.annotation.Nullable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Objects;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+public class HuaweiLtsLogCollectClient extends AbstractLogConsumeClient<HuaweiLogCollectConfig.HuaweiLtsLogConfig, ShenyuRequestLog> {
+
+    private Producer producer;
+
+    private String logGroupId;
+
+    private String logStreamId;
+
+    private String projectId;
+
+    private ThreadPoolExecutor threadExecutor;
+
+    @Override
+    public void initClient0(@NonNull final HuaweiLogCollectConfig.HuaweiLtsLogConfig huaweiLtsLogConfig) {
+        final String accessKeyId = huaweiLtsLogConfig.getAccessKeyId();
+        final String accessKeySecret = huaweiLtsLogConfig.getAccessKeySecret();
+        final String regionName = huaweiLtsLogConfig.getRegionName();
+        this.projectId = huaweiLtsLogConfig.getProjectId();
+        this.logGroupId = huaweiLtsLogConfig.getLogGroupId();
+        this.logStreamId = huaweiLtsLogConfig.getLogStreamId();
+        if (StringUtils.isBlank(accessKeyId) || StringUtils.isBlank(accessKeySecret) || StringUtils.isBlank(projectId)
+                || StringUtils.isBlank(regionName) || StringUtils.isBlank(logGroupId) || StringUtils.isBlank(logStreamId)) {
+            LOG.error("init Huawei lts client error, please check projectId, accessKeyId, accessKeySecret, regionName, logGroupId or logStreamId");
+            return;
+        }
+        JavaSDKAppender appender = JavaSDKAppender.custom()
+                // 华为云帐号的项目ID(project id)
+                .setProjectId(projectId)
+                // 华为云帐号的AK
+                .setAccessKeyId(accessKeyId)
+                // 华为云帐号的SK
+                .setAccessKeySecret(accessKeySecret)
+                // 云日志服务的区域
+                .setRegionName(regionName)
+                // 单个Appender能缓存的日志大小上限
+                .setTotalSizeInBytes(huaweiLtsLogConfig.getTotalSizeInBytes())
+                // producer发送日志时阻塞时间
+                .setMaxBlockMs(huaweiLtsLogConfig.getMaxBlockMs())
+                // producer发送单批日志量上限
+                .setBatchSizeThresholdInBytes(huaweiLtsLogConfig.getBatchSizeThresholdInBytes())
+                // producer发送单批日志条数上限

Review Comment:
   not comment with .



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shenyu] xcsnx commented on a diff in pull request #4812: feature shenyu-plugin:add shenyu-plugin-logging-huawei-lts

Posted by "xcsnx (via GitHub)" <gi...@apache.org>.
xcsnx commented on code in PR #4812:
URL: https://github.com/apache/shenyu/pull/4812#discussion_r1255147218


##########
shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-logging-huawei-lts/src/test/java/org/apache/shenyu/springboot/starter/plugin/logging/huawei/lts/LoggingTencentClsPluginConfigurationTest.java:
##########
@@ -0,0 +1,46 @@
+/*
+ * 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.shenyu.springboot.starter.plugin.logging.huawei.lts;
+
+import org.apache.shenyu.common.enums.PluginEnum;
+import org.apache.shenyu.plugin.api.ShenyuPlugin;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.autoconfigure.AutoConfigurations;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.boot.test.context.runner.ApplicationContextRunner;
+import org.springframework.context.annotation.Configuration;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+@Configuration
+@EnableConfigurationProperties
+public class LoggingTencentClsPluginConfigurationTest {

Review Comment:
   Thanks, I will improve the code



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shenyu] yunlongn commented on pull request #4812: feature shenyu-plugin:add shenyu-plugin-logging-huawei-lts

Posted by "yunlongn (via GitHub)" <gi...@apache.org>.
yunlongn commented on PR #4812:
URL: https://github.com/apache/shenyu/pull/4812#issuecomment-1630196038

   pls add data.  -> `./db/upgrade/2.5.1-upgrade-2.6.0-*.sql`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shenyu] moremind merged pull request #4812: feature shenyu-plugin:add shenyu-plugin-logging-huawei-lts

Posted by "moremind (via GitHub)" <gi...@apache.org>.
moremind merged PR #4812:
URL: https://github.com/apache/shenyu/pull/4812


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shenyu] moremind commented on a diff in pull request #4812: feature shenyu-plugin:add shenyu-plugin-logging-huawei-lts

Posted by "moremind (via GitHub)" <gi...@apache.org>.
moremind commented on code in PR #4812:
URL: https://github.com/apache/shenyu/pull/4812#discussion_r1254387493


##########
shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-huawei-lts/src/main/java/org/apache/shenyu/plugin/huawei/lts/client/HuaweiLtsLogCollectClient.java:
##########
@@ -0,0 +1,206 @@
+/*
+ * 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.shenyu.plugin.huawei.lts.client;
+
+import com.alibaba.fastjson.JSONObject;
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.huaweicloud.lts.appender.JavaSDKAppender;
+import com.huaweicloud.lts.producer.Producer;
+import com.huaweicloud.lts.producer.Result;
+import com.huaweicloud.lts.producer.exception.ProducerException;
+import com.huaweicloud.lts.producer.exception.ResultFailedException;
+import com.huaweicloud.lts.producer.model.log.LogContent;
+import com.huaweicloud.lts.producer.model.log.LogItem;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shenyu.common.concurrent.ShenyuThreadFactory;
+import org.apache.shenyu.plugin.huawei.lts.config.HuaweiLogCollectConfig;
+import org.apache.shenyu.plugin.logging.common.client.AbstractLogConsumeClient;
+import org.apache.shenyu.plugin.logging.common.constant.GenericLoggingConstant;
+import org.apache.shenyu.plugin.logging.common.entity.ShenyuRequestLog;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.lang.NonNull;
+
+import javax.annotation.Nullable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Objects;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+public class HuaweiLtsLogCollectClient extends AbstractLogConsumeClient<HuaweiLogCollectConfig.HuaweiLtsLogConfig, ShenyuRequestLog> {
+
+    private Producer producer;
+
+    private String logGroupId;
+
+    private String logStreamId;
+
+    private String projectId;
+
+    private ThreadPoolExecutor threadExecutor;
+
+    @Override
+    public void initClient0(@NonNull final HuaweiLogCollectConfig.HuaweiLtsLogConfig huaweiLtsLogConfig) {
+        final String accessKeyId = huaweiLtsLogConfig.getAccessKeyId();
+        final String accessKeySecret = huaweiLtsLogConfig.getAccessKeySecret();
+        final String regionName = huaweiLtsLogConfig.getRegionName();
+        this.projectId = huaweiLtsLogConfig.getProjectId();
+        this.logGroupId = huaweiLtsLogConfig.getLogGroupId();
+        this.logStreamId = huaweiLtsLogConfig.getLogStreamId();
+        if (StringUtils.isBlank(accessKeyId) || StringUtils.isBlank(accessKeySecret) || StringUtils.isBlank(projectId)
+                || StringUtils.isBlank(regionName) || StringUtils.isBlank(logGroupId) || StringUtils.isBlank(logStreamId)) {
+            LOG.error("init Huawei lts client error, please check projectId, accessKeyId, accessKeySecret, regionName, logGroupId or logStreamId");
+            return;
+        }
+        JavaSDKAppender appender = JavaSDKAppender.custom()
+                // 华为云帐号的项目ID(project id)
+                .setProjectId(projectId)
+                // 华为云帐号的AK
+                .setAccessKeyId(accessKeyId)
+                // 华为云帐号的SK
+                .setAccessKeySecret(accessKeySecret)
+                // 云日志服务的区域
+                .setRegionName(regionName)
+                // 单个Appender能缓存的日志大小上限
+                .setTotalSizeInBytes(huaweiLtsLogConfig.getTotalSizeInBytes())
+                // producer发送日志时阻塞时间
+                .setMaxBlockMs(huaweiLtsLogConfig.getMaxBlockMs())
+                // producer发送单批日志量上限
+                .setBatchSizeThresholdInBytes(huaweiLtsLogConfig.getBatchSizeThresholdInBytes())
+                // producer发送单批日志条数上限
+                .setBatchCountThreshold(huaweiLtsLogConfig.getBatchCountThreshold())
+                // producer发送单批日志等待时间
+                .setLingerMs(huaweiLtsLogConfig.getLingerMs())
+                // producer发送日志失败后重试次数
+                .setRetries(huaweiLtsLogConfig.getRetries())
+                // 首次重试的退避时间
+                .setBaseRetryBackoffMs(huaweiLtsLogConfig.getBaseRetryBackoffMs())
+                // 重试的最大退避时间

Review Comment:
   same



##########
shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-huawei-lts/pom.xml:
##########
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>shenyu-plugin-logging</artifactId>
+        <groupId>org.apache.shenyu</groupId>
+        <version>2.6.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>shenyu-plugin-logging-huawei-lts</artifactId>
+
+    <properties>
+        <maven.compiler.source>8</maven.compiler.source>
+        <maven.compiler.target>8</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.shenyu</groupId>
+            <artifactId>shenyu-plugin-logging-common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.github.huaweicloud</groupId>
+            <artifactId>lts-sdk-java</artifactId>
+            <version>1.0.1</version>

Review Comment:
   use common properties



##########
shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-huawei-lts/src/test/java/org/apache/shenyu/plugin/huawei/lts/handler/LoggingHuaweiLtsPluginDataHandlerTest.java:
##########
@@ -0,0 +1,68 @@
+/*
+ * 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.shenyu.plugin.huawei.lts.handler;
+
+import org.apache.shenyu.common.dto.PluginData;
+import org.apache.shenyu.common.enums.PluginEnum;
+import org.apache.shenyu.plugin.huawei.lts.client.HuaweiLtsLogCollectClient;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.lang.reflect.Field;
+
+public class LoggingHuaweiLtsPluginDataHandlerTest {
+
+    private LoggingHuaweiLtsPluginDataHandler loggingHuaweiLtsPluginDataHandler;
+
+    private final PluginData pluginData = new PluginData();
+
+    @BeforeEach
+    private void setUp() {
+        this.loggingHuaweiLtsPluginDataHandler = new LoggingHuaweiLtsPluginDataHandler();
+        pluginData.setEnabled(true);
+        pluginData.setConfig("{\n"
+                + "    \"projectId\": \"3d696d796b9647f982b5ec787b2ca249\",\n"
+                + "    \"logGroupId\": \"8285fbe3-9c73-4deb-a8d0-96ec06c4af3a\",\n"
+                + "    \"logStreamId\": \"8b4fe176-4a7e-4bd5-8bb7-17d0ec6730b2\",\n"

Review Comment:
   use your accessId and secret key



##########
shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-huawei-lts/src/main/java/org/apache/shenyu/plugin/huawei/lts/client/HuaweiLtsLogCollectClient.java:
##########
@@ -0,0 +1,206 @@
+/*
+ * 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.shenyu.plugin.huawei.lts.client;
+
+import com.alibaba.fastjson.JSONObject;
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.huaweicloud.lts.appender.JavaSDKAppender;
+import com.huaweicloud.lts.producer.Producer;
+import com.huaweicloud.lts.producer.Result;
+import com.huaweicloud.lts.producer.exception.ProducerException;
+import com.huaweicloud.lts.producer.exception.ResultFailedException;
+import com.huaweicloud.lts.producer.model.log.LogContent;
+import com.huaweicloud.lts.producer.model.log.LogItem;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shenyu.common.concurrent.ShenyuThreadFactory;
+import org.apache.shenyu.plugin.huawei.lts.config.HuaweiLogCollectConfig;
+import org.apache.shenyu.plugin.logging.common.client.AbstractLogConsumeClient;
+import org.apache.shenyu.plugin.logging.common.constant.GenericLoggingConstant;
+import org.apache.shenyu.plugin.logging.common.entity.ShenyuRequestLog;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.lang.NonNull;
+
+import javax.annotation.Nullable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Objects;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+public class HuaweiLtsLogCollectClient extends AbstractLogConsumeClient<HuaweiLogCollectConfig.HuaweiLtsLogConfig, ShenyuRequestLog> {
+
+    private Producer producer;
+
+    private String logGroupId;
+
+    private String logStreamId;
+
+    private String projectId;
+
+    private ThreadPoolExecutor threadExecutor;
+
+    @Override
+    public void initClient0(@NonNull final HuaweiLogCollectConfig.HuaweiLtsLogConfig huaweiLtsLogConfig) {
+        final String accessKeyId = huaweiLtsLogConfig.getAccessKeyId();
+        final String accessKeySecret = huaweiLtsLogConfig.getAccessKeySecret();
+        final String regionName = huaweiLtsLogConfig.getRegionName();
+        this.projectId = huaweiLtsLogConfig.getProjectId();
+        this.logGroupId = huaweiLtsLogConfig.getLogGroupId();
+        this.logStreamId = huaweiLtsLogConfig.getLogStreamId();
+        if (StringUtils.isBlank(accessKeyId) || StringUtils.isBlank(accessKeySecret) || StringUtils.isBlank(projectId)
+                || StringUtils.isBlank(regionName) || StringUtils.isBlank(logGroupId) || StringUtils.isBlank(logStreamId)) {
+            LOG.error("init Huawei lts client error, please check projectId, accessKeyId, accessKeySecret, regionName, logGroupId or logStreamId");
+            return;
+        }
+        JavaSDKAppender appender = JavaSDKAppender.custom()
+                // 华为云帐号的项目ID(project id)
+                .setProjectId(projectId)
+                // 华为云帐号的AK
+                .setAccessKeyId(accessKeyId)
+                // 华为云帐号的SK
+                .setAccessKeySecret(accessKeySecret)
+                // 云日志服务的区域
+                .setRegionName(regionName)
+                // 单个Appender能缓存的日志大小上限
+                .setTotalSizeInBytes(huaweiLtsLogConfig.getTotalSizeInBytes())
+                // producer发送日志时阻塞时间
+                .setMaxBlockMs(huaweiLtsLogConfig.getMaxBlockMs())
+                // producer发送单批日志量上限
+                .setBatchSizeThresholdInBytes(huaweiLtsLogConfig.getBatchSizeThresholdInBytes())
+                // producer发送单批日志条数上限
+                .setBatchCountThreshold(huaweiLtsLogConfig.getBatchCountThreshold())
+                // producer发送单批日志等待时间
+                .setLingerMs(huaweiLtsLogConfig.getLingerMs())
+                // producer发送日志失败后重试次数
+                .setRetries(huaweiLtsLogConfig.getRetries())
+                // 首次重试的退避时间
+                .setBaseRetryBackoffMs(huaweiLtsLogConfig.getBaseRetryBackoffMs())
+                // 重试的最大退避时间
+                .setMaxRetryBackoffMs(huaweiLtsLogConfig.getMaxRetryBackoffMs())
+                // 默认false, true: 可以跨云上报日志, false: 仅能在华为云ecs主机上报日志
+                .setEnableLocalTest(Boolean.parseBoolean(huaweiLtsLogConfig.getEnableLocalTest()))
+                // 超过1M的日志, 拆分后丢弃大于1M的数据
+                .setGiveUpExtraLongSingleLog(Boolean.parseBoolean(huaweiLtsLogConfig.getEnableLocalTest()))
+                .builder();
+        this.producer = appender.getProducer();
+
+        threadExecutor = createThreadPoolExecutor(huaweiLtsLogConfig.getIoThreadCount());
+    }
+
+    @Override
+    public void consume0(@NonNull final List<ShenyuRequestLog> logs) throws Exception {
+        logs.forEach(this::sendLog);
+    }
+
+    @Override
+    public void close0() throws Exception {
+        if (Objects.nonNull(producer)) {
+            try {
+                producer.close();
+
+            } catch (InterruptedException | ProducerException e) {
+                LOG.error("Close producer error.");
+            }
+        }
+    }
+
+    /**
+     * send log to Tencent cls.
+     *
+     * @param log log
+     */
+    private void sendLog(final ShenyuRequestLog log) {
+        final List<LogItem> logItems = new ArrayList<>();
+        final List<LogItem> logItemList = new ArrayList<>();
+        LogItem logItem = new LogItem();
+        logItem.setTenantProjectId(projectId);
+        logItems.add(logItem);
+        logItem.setLabels(JSONObject.toJSONString(new HashMap<>()));
+        List<LogContent> contents = new ArrayList<>();
+        LogContent logContent = new LogContent();
+        logContent.setLogTimeNs(System.currentTimeMillis() * 1000000L + System.nanoTime() % 1000000L);
+        logContent.setLog(log.toString());
+        contents.add(logContent);
+
+        logItem.setContents(contents);
+        logItemList.add(logItem);
+
+        try {
+            final ListenableFuture<Result> f = producer.send(logGroupId, logStreamId, logItemList);
+            Futures.addCallback(f, new ProducerFutureCallback(logGroupId, logStreamId), threadExecutor);
+        } catch (InterruptedException e) {
+            throw new RuntimeException(e);

Review Comment:
   not throw runtime exception



##########
shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-huawei-lts/src/main/java/org/apache/shenyu/plugin/huawei/lts/client/HuaweiLtsLogCollectClient.java:
##########
@@ -0,0 +1,206 @@
+/*
+ * 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.shenyu.plugin.huawei.lts.client;
+
+import com.alibaba.fastjson.JSONObject;
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.huaweicloud.lts.appender.JavaSDKAppender;
+import com.huaweicloud.lts.producer.Producer;
+import com.huaweicloud.lts.producer.Result;
+import com.huaweicloud.lts.producer.exception.ProducerException;
+import com.huaweicloud.lts.producer.exception.ResultFailedException;
+import com.huaweicloud.lts.producer.model.log.LogContent;
+import com.huaweicloud.lts.producer.model.log.LogItem;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shenyu.common.concurrent.ShenyuThreadFactory;
+import org.apache.shenyu.plugin.huawei.lts.config.HuaweiLogCollectConfig;
+import org.apache.shenyu.plugin.logging.common.client.AbstractLogConsumeClient;
+import org.apache.shenyu.plugin.logging.common.constant.GenericLoggingConstant;
+import org.apache.shenyu.plugin.logging.common.entity.ShenyuRequestLog;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.lang.NonNull;
+
+import javax.annotation.Nullable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Objects;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+public class HuaweiLtsLogCollectClient extends AbstractLogConsumeClient<HuaweiLogCollectConfig.HuaweiLtsLogConfig, ShenyuRequestLog> {
+
+    private Producer producer;
+
+    private String logGroupId;
+
+    private String logStreamId;
+
+    private String projectId;
+
+    private ThreadPoolExecutor threadExecutor;
+
+    @Override
+    public void initClient0(@NonNull final HuaweiLogCollectConfig.HuaweiLtsLogConfig huaweiLtsLogConfig) {
+        final String accessKeyId = huaweiLtsLogConfig.getAccessKeyId();
+        final String accessKeySecret = huaweiLtsLogConfig.getAccessKeySecret();
+        final String regionName = huaweiLtsLogConfig.getRegionName();
+        this.projectId = huaweiLtsLogConfig.getProjectId();
+        this.logGroupId = huaweiLtsLogConfig.getLogGroupId();
+        this.logStreamId = huaweiLtsLogConfig.getLogStreamId();
+        if (StringUtils.isBlank(accessKeyId) || StringUtils.isBlank(accessKeySecret) || StringUtils.isBlank(projectId)
+                || StringUtils.isBlank(regionName) || StringUtils.isBlank(logGroupId) || StringUtils.isBlank(logStreamId)) {
+            LOG.error("init Huawei lts client error, please check projectId, accessKeyId, accessKeySecret, regionName, logGroupId or logStreamId");
+            return;
+        }
+        JavaSDKAppender appender = JavaSDKAppender.custom()
+                // 华为云帐号的项目ID(project id)

Review Comment:
   use english comment



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org