You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by GitBox <gi...@apache.org> on 2022/05/02 14:29:12 UTC
[GitHub] [incubator-shenyu] erdengk opened a new pull request, #3372: [type:Integration Test] Add metrics-plugin Integration Test
erdengk opened a new pull request, #3372:
URL: https://github.com/apache/incubator-shenyu/pull/3372
This pr is an integration test written for the metrics plugin.
Currently, there is only one use case, which is to test whether metrics are enabled normally.
If accessing the corresponding URL has correct return information, it proves that the metrics are working properly.
Users can choose the monitoring tools (such as Prometheus and Grafana) they want to collect Shenyu information.
--
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] [incubator-shenyu] codecov-commenter commented on pull request #3372: [type:Integration Test] Add metrics-plugin Integration Test
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #3372:
URL: https://github.com/apache/incubator-shenyu/pull/3372#issuecomment-1115018230
# [Codecov](https://codecov.io/gh/apache/incubator-shenyu/pull/3372?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#3372](https://codecov.io/gh/apache/incubator-shenyu/pull/3372?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f1c15cf) into [master](https://codecov.io/gh/apache/incubator-shenyu/commit/24b299b1773c40bcf488a057536a138f99e618c6?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (24b299b) will **decrease** coverage by `0.16%`.
> The diff coverage is `n/a`.
```diff
@@ Coverage Diff @@
## master #3372 +/- ##
============================================
- Coverage 65.23% 65.06% -0.17%
+ Complexity 5240 5233 -7
============================================
Files 760 760
Lines 21224 21224
Branches 1932 1932
============================================
- Hits 13846 13810 -36
- Misses 6090 6123 +33
- Partials 1288 1291 +3
```
| [Impacted Files](https://codecov.io/gh/apache/incubator-shenyu/pull/3372?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...plugin/logging/rocketmq/LoggingRocketMQPlugin.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3372/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWxvZ2dpbmcvc2hlbnl1LXBsdWdpbi1sb2dnaW5nLXJvY2tldG1xL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvcGx1Z2luL2xvZ2dpbmcvcm9ja2V0bXEvTG9nZ2luZ1JvY2tldE1RUGx1Z2luLmphdmE=) | `22.72% <0.00%> (-72.73%)` | :arrow_down: |
| [...ogging/rocketmq/body/LoggingServerHttpRequest.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3372/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWxvZ2dpbmcvc2hlbnl1LXBsdWdpbi1sb2dnaW5nLXJvY2tldG1xL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvcGx1Z2luL2xvZ2dpbmcvcm9ja2V0bXEvYm9keS9Mb2dnaW5nU2VydmVySHR0cFJlcXVlc3QuamF2YQ==) | `0.00% <0.00%> (-20.00%)` | :arrow_down: |
| [...ache/shenyu/plugin/grpc/cache/GrpcClientCache.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3372/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWdycGMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoZW55dS9wbHVnaW4vZ3JwYy9jYWNoZS9HcnBjQ2xpZW50Q2FjaGUuamF2YQ==) | `87.50% <0.00%> (-12.50%)` | :arrow_down: |
| [...henyu/plugin/grpc/resolver/ShenyuNameResolver.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3372/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWdycGMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoZW55dS9wbHVnaW4vZ3JwYy9yZXNvbHZlci9TaGVueXVOYW1lUmVzb2x2ZXIuamF2YQ==) | `54.25% <0.00%> (-8.52%)` | :arrow_down: |
| [.../logging/rocketmq/utils/LogCollectConfigUtils.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3372/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWxvZ2dpbmcvc2hlbnl1LXBsdWdpbi1sb2dnaW5nLXJvY2tldG1xL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvcGx1Z2luL2xvZ2dpbmcvcm9ja2V0bXEvdXRpbHMvTG9nQ29sbGVjdENvbmZpZ1V0aWxzLmphdmE=) | `71.11% <0.00%> (-4.45%)` | :arrow_down: |
| [...he/shenyu/plugin/grpc/client/ShenyuGrpcClient.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3372/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWdycGMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoZW55dS9wbHVnaW4vZ3JwYy9jbGllbnQvU2hlbnl1R3JwY0NsaWVudC5qYXZh) | `8.00% <0.00%> (-4.00%)` | :arrow_down: |
| [...ng/rocketmq/rocketmq/RocketMQLogCollectClient.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3372/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWxvZ2dpbmcvc2hlbnl1LXBsdWdpbi1sb2dnaW5nLXJvY2tldG1xL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvcGx1Z2luL2xvZ2dpbmcvcm9ja2V0bXEvcm9ja2V0bXEvUm9ja2V0TVFMb2dDb2xsZWN0Q2xpZW50LmphdmE=) | `70.00% <0.00%> (-2.00%)` | :arrow_down: |
| [...henyu/admin/service/impl/UpstreamCheckService.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3372/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vc2VydmljZS9pbXBsL1Vwc3RyZWFtQ2hlY2tTZXJ2aWNlLmphdmE=) | `70.14% <0.00%> (-1.50%)` | :arrow_down: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-shenyu/pull/3372?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-shenyu/pull/3372?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [24b299b...f1c15cf](https://codecov.io/gh/apache/incubator-shenyu/pull/3372?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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] [incubator-shenyu] erdengk closed pull request #3372: [type:Integration Test] Add metrics-plugin Integration Test
Posted by GitBox <gi...@apache.org>.
erdengk closed pull request #3372: [type:Integration Test] Add metrics-plugin Integration Test
URL: https://github.com/apache/incubator-shenyu/pull/3372
--
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] [incubator-shenyu] JooKS-me commented on a diff in pull request #3372: [type:Integration Test] Add metrics-plugin Integration Test
Posted by GitBox <gi...@apache.org>.
JooKS-me commented on code in PR #3372:
URL: https://github.com/apache/incubator-shenyu/pull/3372#discussion_r865520543
##########
shenyu-integrated-test/shenyu-integrated-test-http/prometheus.yml:
##########
@@ -0,0 +1,26 @@
+# 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.
+
+global:
+ scrape_interval: 15s
Review Comment:
```suggestion
scrape_interval: 15s
```
##########
shenyu-integrated-test/shenyu-integrated-test-common/src/main/java/org/apache/shenyu/integratedtest/common/helper/HttpHelper.java:
##########
@@ -48,6 +48,11 @@ public class HttpHelper {
*/
public static final String GATEWAY_END_POINT = "http://localhost:9195";
+ /**
+ * The constant test metrics plugin.
+ */
+ public static final String METRICS_END_POINT = "http://localhost:8090";
Review Comment:
Pls remove this.
##########
shenyu-integrated-test/shenyu-integrated-test-common/src/main/java/org/apache/shenyu/integratedtest/common/helper/HttpHelper.java:
##########
@@ -236,6 +241,26 @@ public <S> S getFromGateway(final String path, final Map<String, Object> headers
}
}
+ /**
+ * Send a get http request to shenyu gateway .
+ *
+ * @param <S> response type
+ * @param path path
+ * @param type type of response passed to {@link Gson#fromJson(String, Type)}
+ * @return response from gateway
+ * @throws IOException IO exception
+ */
+ public <S> S testMetricsPluginFromGateway(final String path, final Type type) throws IOException {
Review Comment:
We can rename `testMetricsPluginFromGateway` to `getHttpService`, and a param `headers` can be added for more general use.
##########
shenyu-integrated-test/shenyu-integrated-test-http/src/test/java/org/apache/shenyu/integrated/test/http/combination/MetricsPluginTest.java:
##########
@@ -0,0 +1,39 @@
+/*
+ * 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.integrated.test.http.combination;
+
+import org.apache.shenyu.integratedtest.common.AbstractPluginDataInit;
+import org.apache.shenyu.integratedtest.common.helper.HttpHelper;
+import org.junit.jupiter.api.Test;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+
+public final class MetricsPluginTest extends AbstractPluginDataInit {
+
+ private static final String TEST_CACHE_PATH = "/metrics";
+
+ @Test
+ public void testPass() throws ExecutionException, InterruptedException {
+ Future<String> resp = this.getService().submit(() -> HttpHelper.INSTANCE.testMetricsPluginFromGateway("http://shenyu-integrated-test-http:9090/api/v1/targets", String.class));
Review Comment:
Maybe there should not be `shenyu-integrated-test-http` :)
```suggestion
Future<String> resp = this.getService().submit(() -> HttpHelper.INSTANCE.testMetricsPluginFromGateway("http://localhost:9090/api/v1/targets", String.class));
```
##########
shenyu-integrated-test/shenyu-integrated-test-http/docker-compose.yml:
##########
@@ -87,13 +87,29 @@ services:
condition: service_healthy
ports:
- "9195:9195"
+ - "8090:8090"
networks:
- shenyu
healthcheck:
test: [ "CMD", "wget", "http://shenyu-integrated-test-http:9195/actuator/health" ]
timeout: 2s
retries: 30
+ prometheus:
+ image: prom/prometheus:latest
Review Comment:
We'd better use a fixed version to avoid problems that may occur in the future.
--
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] [incubator-shenyu] erdengk commented on a diff in pull request #3372: [type:Integration Test] Add metrics-plugin Integration Test
Posted by GitBox <gi...@apache.org>.
erdengk commented on code in PR #3372:
URL: https://github.com/apache/incubator-shenyu/pull/3372#discussion_r865525926
##########
shenyu-integrated-test/shenyu-integrated-test-http/docker-compose.yml:
##########
@@ -87,13 +87,29 @@ services:
condition: service_healthy
ports:
- "9195:9195"
+ - "8090:8090"
networks:
- shenyu
healthcheck:
test: [ "CMD", "wget", "http://shenyu-integrated-test-http:9195/actuator/health" ]
timeout: 2s
retries: 30
+ prometheus:
+ image: prom/prometheus:latest
Review Comment:
ok,I get
--
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] [incubator-shenyu] erdengk commented on a diff in pull request #3372: [type:Integration Test] Add metrics-plugin Integration Test
Posted by GitBox <gi...@apache.org>.
erdengk commented on code in PR #3372:
URL: https://github.com/apache/incubator-shenyu/pull/3372#discussion_r865526658
##########
shenyu-integrated-test/shenyu-integrated-test-common/src/main/java/org/apache/shenyu/integratedtest/common/helper/HttpHelper.java:
##########
@@ -236,6 +241,26 @@ public <S> S getFromGateway(final String path, final Map<String, Object> headers
}
}
+ /**
+ * Send a get http request to shenyu gateway .
+ *
+ * @param <S> response type
+ * @param path path
+ * @param type type of response passed to {@link Gson#fromJson(String, Type)}
+ * @return response from gateway
+ * @throws IOException IO exception
+ */
+ public <S> S testMetricsPluginFromGateway(final String path, final Type type) throws IOException {
Review Comment:
good idea,thanks~
--
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] [incubator-shenyu] erdengk commented on a diff in pull request #3372: [type:Integration Test] Add metrics-plugin Integration Test
Posted by GitBox <gi...@apache.org>.
erdengk commented on code in PR #3372:
URL: https://github.com/apache/incubator-shenyu/pull/3372#discussion_r865526155
##########
shenyu-integrated-test/shenyu-integrated-test-common/src/main/java/org/apache/shenyu/integratedtest/common/helper/HttpHelper.java:
##########
@@ -48,6 +48,11 @@ public class HttpHelper {
*/
public static final String GATEWAY_END_POINT = "http://localhost:9195";
+ /**
+ * The constant test metrics plugin.
+ */
+ public static final String METRICS_END_POINT = "http://localhost:8090";
Review Comment:
Ok. I'm still testing it, and I'll clean up the code before the final review.
--
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] [incubator-shenyu] JooKS-me commented on pull request #3372: [type:Integration Test] Add metrics-plugin Integration Test
Posted by GitBox <gi...@apache.org>.
JooKS-me commented on PR #3372:
URL: https://github.com/apache/incubator-shenyu/pull/3372#issuecomment-1115791565
I suggest starting prometheus in docker-compose, then requesting prometheus http endpoint and seeing if you get the expected metrics.
--
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] [incubator-shenyu] erdengk commented on pull request #3372: [type:Integration Test] Add metrics-plugin Integration Test
Posted by GitBox <gi...@apache.org>.
erdengk commented on PR #3372:
URL: https://github.com/apache/incubator-shenyu/pull/3372#issuecomment-1115812310
> I suggest starting prometheus in docker-compose, then requesting prometheus http endpoint and seeing if you get the expected metrics.
thanks~
--
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] [incubator-shenyu] erdengk commented on a diff in pull request #3372: [type:Integration Test] Add metrics-plugin Integration Test
Posted by GitBox <gi...@apache.org>.
erdengk commented on code in PR #3372:
URL: https://github.com/apache/incubator-shenyu/pull/3372#discussion_r865525674
##########
shenyu-integrated-test/shenyu-integrated-test-http/src/test/java/org/apache/shenyu/integrated/test/http/combination/MetricsPluginTest.java:
##########
@@ -0,0 +1,39 @@
+/*
+ * 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.integrated.test.http.combination;
+
+import org.apache.shenyu.integratedtest.common.AbstractPluginDataInit;
+import org.apache.shenyu.integratedtest.common.helper.HttpHelper;
+import org.junit.jupiter.api.Test;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+
+public final class MetricsPluginTest extends AbstractPluginDataInit {
+
+ private static final String TEST_CACHE_PATH = "/metrics";
+
+ @Test
+ public void testPass() throws ExecutionException, InterruptedException {
+ Future<String> resp = this.getService().submit(() -> HttpHelper.INSTANCE.testMetricsPluginFromGateway("http://shenyu-integrated-test-http:9090/api/v1/targets", String.class));
Review Comment:
ok,I'll try
--
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