-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
fix(plugins/statsd & opentelemetry): add return values for funcs called in batch queue #10052
fix(plugins/statsd & opentelemetry): add return values for funcs called in batch queue #10052
Conversation
opentelemetry always creates a batch queue with retry_count=0, I didn't find a way to write a test case for it. |
Tests are still failing. |
Notice: we should use the correct PR title, it is important for reviewers. |
8fad2ec
to
5423842
Compare
478822b
to
db86ed4
Compare
66c59d3
to
6e73663
Compare
assert(#metrics == metrics_count, err) | ||
end) | ||
|
||
-- wait until shdict metrics could be sent again |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this introduce flakiness? I am good if it isn't. 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test case aims to ensure the changes(add return values) for functions of statsd plugins called in batch_queue won't be called repeatedly when the functions executed successfully. In this test case, I try to wait more metrics than it should be, actually , it should timeout as expected (because no more metrics then expected).
The next one is waiting for the shdict metrics being refreshed so that the third test case can pass.
I tried several times in my local environment successfully, so I think it won't be flaky.
In that case, it shouldn't be a critical problem in the opentelemetry plugin, it causes no effects. |
The DataDog plugin also uses the batch queue and returns a falsey value in it's log function: kong/kong/plugins/datadog/handler.lua Line 105 in 62adb14
|
@rspurgeon I have another PR #10044 for datadog |
that will be processed in batch queue for these two plugins. Batch queue considers the result of processing falsy without return value, namely nil, resulting the batch being reprocessed. FTI-4645
…t to the first test case
eee869f
to
bf0d789
Compare
62ffbdb
to
f4a6a52
Compare
…0126) * fix(plugins/datadog): add return value for log function in batch queue (#10044) The log function in Datadog is called by the batch queue when a batch is processed, and batch queue relys on the return value of the callback. The return value of log function in Datadog always return `nil`, this makes batch queue consider the result of processing as failed. In this commit, the correct return value indicating the success in processing to fix this bug. * fix(plugins/statsd & opentelemetry): add return values for batch queue callback functions (#10052) Add return values for functions that will be processed in batch queue for these two plugins. Batch queue considers the result of processing unsuccessful without a return value, resulting the batch being reprocessed incorrectly. FTI-4645 Co-authored-by: Robin Xiang <[email protected]>
Summary
fix(plugins/statsd & opentelemetry): add return values for functions that will be processed in batch queue for these two plugins. Batch queue considers the result of processing falsy without return value, resulting the batch in being reprocessed.
Checklist
Issue reference
FTI-4645