Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: rocketmq logger #5653

Merged
merged 24 commits into from
Dec 7, 2021
Merged

feat: rocketmq logger #5653

merged 24 commits into from
Dec 7, 2021

Conversation

yuz10
Copy link
Member

@yuz10 yuz10 commented Nov 30, 2021

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
Copy link
Member

@spacewander spacewander left a comment

Choose a reason for hiding this comment

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

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

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


repeat_each(1);
no_long_string();
no_root_location();
Copy link
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.

t/plugin/rocketmq-logger.t Outdated Show resolved Hide resolved
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
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?

Copy link
Member Author

@yuz10 yuz10 Dec 6, 2021

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
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
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.

t/plugin/rocketmq-logger.t Show resolved Hide resolved
apisix/plugins/rocketmq-logger.lua Show resolved Hide resolved
@spacewander spacewander merged commit 49762bc into apache:master Dec 7, 2021
@membphis
Copy link
Member

membphis commented Dec 7, 2021

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