Skip to content

feat: rocketmq logger#5653

Merged
spacewander merged 24 commits into
apache:masterfrom
yuz10:master
Dec 7, 2021
Merged

feat: rocketmq logger#5653
spacewander merged 24 commits into
apache:masterfrom
yuz10:master

Conversation

@yuz10

@yuz10 yuz10 commented Nov 30, 2021

Copy link
Copy Markdown
Member

What this PR does / why we need it:

feature: add rocketmq-logger plugin
which send log to rocketmq.

Pre-submission checklist:

  • Did you explain what problem does this PR solve? Or what new features have been added?
  • Have you added corresponding test cases?
  • Have you modified the corresponding document?
  • Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first

@yuz10
yuz10 force-pushed the master branch 3 times, most recently from 5b1819d to d99eb83 Compare November 30, 2021 18:36

@spacewander spacewander left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread docs/en/latest/plugins/rocketmq-logger.md Outdated
Comment thread docs/zh/latest/plugins/rocketmq-logger.md Outdated
@yuz10
yuz10 force-pushed the master branch 4 times, most recently from 0f5e698 to 0a58971 Compare December 1, 2021 17:06
Comment thread apisix/plugins/rocketmq-logger.lua Outdated
Comment thread ci/pod/docker-compose.yml Outdated
Comment thread ci/pod/docker-compose.yml Outdated
Comment thread apisix/plugins/rocketmq-logger.lua Outdated
Comment thread apisix/plugins/rocketmq-logger.lua Outdated
Comment thread ci/pod/docker-compose.yml Outdated
Comment thread docs/en/latest/plugins/rocketmq-logger.md Outdated
Comment thread docs/en/latest/plugins/rocketmq-logger.md Outdated
Comment thread docs/zh/latest/plugins/rocketmq-logger.md Outdated
Comment thread apisix/plugins/rocketmq-logger.lua Outdated
@vongosling

Copy link
Copy Markdown
Member

Pls keep going:-) I'd like to see this feature ready for both community cooperation.

Comment thread docs/en/latest/plugins/rocketmq-logger.md Outdated
Comment thread docs/zh/latest/plugins/rocketmq-logger.md Outdated
@yuz10
yuz10 requested a review from spacewander December 3, 2021 08:29

repeat_each(1);
no_long_string();
no_root_location();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. We can improve the test in a separate PR:

The newly added test file should use a preprocessor to reduce duplicate --- request & --- no_error_log section. You can take a look at:

https://github.com/apache/apisix/blob/11433d740c5e19b757c61f59842d6de64e27fba8/t/plugin/gzip.t#L33=L42

And please split it into rocketmq-logger.t & rocketmq-logger2.t. Each test file should be smaller than 800L.

Comment thread apisix/plugins/rocketmq-logger.lua Outdated
Comment thread apisix/plugins/rocketmq-logger.lua
Comment thread t/plugin/rocketmq-logger.t Outdated
Comment on lines +154 to +155
return false, "failed to send data to rocketmq topic: " .. err ..
", nameserver_list: " .. core.json.encode(conf.nameserver_list)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we get the nameserver for the current error?

@yuz10 yuz10 Dec 6, 2021

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I dont understand what you mean. the nameserver is add to err and test case will verify the error log if send fail. such as https://github.com/yuz10/apisix/blob/master/t/plugin/rocketmq-logger.t#L862

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we have more nameservers in nameserver_list, one of them is unavailable and this message is sent to the unavailable nameserver, can the log here only print out the unavailable nameserver?

Ok, if this is not convenient to do in this PR, we can optimise it later.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which nameserver is error can be returned from the lua-resty-rocketmq library, We can create an issue there.

Comment thread t/plugin/rocketmq-logger.t
Comment thread apisix/plugins/rocketmq-logger.lua
@spacewander
spacewander merged commit 49762bc into apache:master Dec 7, 2021
@membphis

membphis commented Dec 7, 2021

Copy link
Copy Markdown
Member

Thank you very much for your outstanding contribution @yuz10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants