You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2021/01/06 08:37:44 UTC
[GitHub] [skywalking-nginx-lua] spacewander opened a new pull request #58: feat: add destroyBackendTimer to stop reporting metrics
spacewander opened a new pull request #58:
URL: https://github.com/apache/skywalking-nginx-lua/pull/58
Close https://github.com/apache/skywalking/issues/6101
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [skywalking-nginx-lua] spacewander commented on a change in pull request #58: feat: add destroyBackendTimer to stop reporting metrics
Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #58:
URL: https://github.com/apache/skywalking-nginx-lua/pull/58#discussion_r552643223
##########
File path: README.md
##########
@@ -123,6 +123,7 @@ The following APIs are for developers or using this lib out of the Nginx case.
## Nginx APIs
- **startTimer**, `require("skywalking.client"):startBackendTimer("http://127.0.0.1:8080")`. Start the backend timer. This timer register the metadata and report traces to the backend.
+- **destroyBackendTimer**, `require("skywalking.client"):destroyBackendTimer()`. Stop the timer created by `startBackendTimer`, and clean unreported data.
Review comment:
@wu-sheng
Added in the new commit.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [skywalking-nginx-lua] wu-sheng commented on a change in pull request #58: feat: add destroyBackendTimer to stop reporting metrics
Posted by GitBox <gi...@apache.org>.
wu-sheng commented on a change in pull request #58:
URL: https://github.com/apache/skywalking-nginx-lua/pull/58#discussion_r552544976
##########
File path: t/client.t
##########
@@ -0,0 +1,100 @@
+use Test::Nginx::Socket 'no_plan';
+
+use Cwd qw(cwd);
+my $pwd = cwd();
+
+repeat_each(1);
+no_long_string();
+no_shuffle();
+no_root_location();
+log_level('info');
+
+add_block_preprocessor(sub {
+ my ($block) = @_;
+
+ if (!$block->request) {
+ $block->set_value("request", "GET /t");
+ }
+
+ if (!$block->no_error_log) {
+ $block->set_value("no_error_log", "[error]\n[alert]");
+ }
+
+ my $http_config = $block->http_config // '';
+ my $default_http_config = <<_EOC_;
+ lua_package_path "$pwd/lib/?.lua;;";
+ lua_shared_dict tracing_buffer 100m;
+ $http_config
+_EOC_
+
+ $block->set_value("http_config", $default_http_config);
+
+ my $config = $block->config;
+ my $default_config = <<_EOC_;
+ $config
+ location = /v3/management/reportProperties {
+ content_by_lua_block {
+ ngx.req.read_body()
+ local data = ngx.req.get_body_data()
+ if data then
+ data = require("cjson.safe").decode(data)
+ ngx.log(ngx.WARN, "language: ", data.properties[1].value)
+ end
+ }
+ }
+
+ location = /v3/management/keepAlive {
+ content_by_lua_block {
+ ngx.log(ngx.WARN, "Go keepAlive")
+ ngx.exit(200)
+ }
+ }
+_EOC_
+
+ $block->set_value("config", $default_config);
+});
+
+run_tests;
+
+__DATA__
+
+=== TEST 1: start backend timer
Review comment:
Why the following commented?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [skywalking-nginx-lua] wu-sheng merged pull request #58: feat: add destroyBackendTimer to stop reporting metrics
Posted by GitBox <gi...@apache.org>.
wu-sheng merged pull request #58:
URL: https://github.com/apache/skywalking-nginx-lua/pull/58
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [skywalking-nginx-lua] spacewander commented on a change in pull request #58: feat: add destroyBackendTimer to stop reporting metrics
Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #58:
URL: https://github.com/apache/skywalking-nginx-lua/pull/58#discussion_r552636367
##########
File path: t/client.t
##########
@@ -0,0 +1,100 @@
+use Test::Nginx::Socket 'no_plan';
+
+use Cwd qw(cwd);
+my $pwd = cwd();
+
+repeat_each(1);
+no_long_string();
+no_shuffle();
+no_root_location();
+log_level('info');
+
+add_block_preprocessor(sub {
+ my ($block) = @_;
+
+ if (!$block->request) {
+ $block->set_value("request", "GET /t");
+ }
+
+ if (!$block->no_error_log) {
+ $block->set_value("no_error_log", "[error]\n[alert]");
+ }
+
+ my $http_config = $block->http_config // '';
+ my $default_http_config = <<_EOC_;
+ lua_package_path "$pwd/lib/?.lua;;";
+ lua_shared_dict tracing_buffer 100m;
+ $http_config
+_EOC_
+
+ $block->set_value("http_config", $default_http_config);
+
+ my $config = $block->config;
+ my $default_config = <<_EOC_;
+ $config
+ location = /v3/management/reportProperties {
+ content_by_lua_block {
+ ngx.req.read_body()
+ local data = ngx.req.get_body_data()
+ if data then
+ data = require("cjson.safe").decode(data)
+ ngx.log(ngx.WARN, "language: ", data.properties[1].value)
+ end
+ }
+ }
+
+ location = /v3/management/keepAlive {
+ content_by_lua_block {
+ ngx.log(ngx.WARN, "Go keepAlive")
+ ngx.exit(200)
+ }
+ }
+_EOC_
+
+ $block->set_value("config", $default_config);
+});
+
+run_tests;
+
+__DATA__
+
+=== TEST 1: start backend timer
Review comment:
What do you mean for `commented`? It is syntax for `.t` file, not the Lua.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [skywalking-nginx-lua] wu-sheng commented on a change in pull request #58: feat: add destroyBackendTimer to stop reporting metrics
Posted by GitBox <gi...@apache.org>.
wu-sheng commented on a change in pull request #58:
URL: https://github.com/apache/skywalking-nginx-lua/pull/58#discussion_r552545216
##########
File path: README.md
##########
@@ -123,6 +123,7 @@ The following APIs are for developers or using this lib out of the Nginx case.
## Nginx APIs
- **startTimer**, `require("skywalking.client"):startBackendTimer("http://127.0.0.1:8080")`. Start the backend timer. This timer register the metadata and report traces to the backend.
+- **destroyBackendTimer**, `require("skywalking.client"):destroyBackendTimer()`. Stop the timer created by `startBackendTimer`, and clean unreported data.
Review comment:
We need document to explain when and how to use this API.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org