-
Notifications
You must be signed in to change notification settings - Fork 5.5k
listener: create per network filter chain stats scope #17931
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
Changes from 3 commits
1db18d2
e3ed57c
fe7b123
11459f9
a69db69
6db5721
08b6fa3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -238,6 +238,26 @@ AssertionResult TestUtility::waitForGaugeEq(Stats::Store& store, const std::stri | |
| return AssertionSuccess(); | ||
| } | ||
|
|
||
| AssertionResult TestUtility::waitForGaugeDestroyed(Stats::Store& store, const std::string& name, | ||
| Event::TestTimeSystem& time_system, | ||
| std::chrono::milliseconds timeout) { | ||
|
lambdai marked this conversation as resolved.
Outdated
|
||
| Event::TestTimeSystem::RealTimeBound bound(timeout); | ||
| while (findGauge(store, name) != nullptr) { | ||
| time_system.advanceTimeWait(std::chrono::milliseconds(10)); | ||
| if (timeout != std::chrono::milliseconds::zero() && !bound.withinBound()) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there's a much better pattern for waiting for things to happen with stats. See NotifyingAllocatorImpl::waitForCounterExists. It uses a condvar rather than a spin-loop, which in my experience is inherently flaky. It looks like in the context where you are calling this, you can use NotifyingAllocatorImpl so this should be a straightforward extension.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think NotifyingAllocatorImpl is not available when I use real_stats I choose real_stats only because real_stats support stat destroy. Am I understanding it correctly?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No idea. Did you just see that in the code or did you get that failure during a test?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just took another look. At this level, your impl parallels another one. I have general flakiness concerns about this so it'd be better if we didn't need it. However in test/integration/server.h you are implementing a virtual method that calls this one. However if you look right above that, in the impl of waitForCounterExists, you can see it using the notifyingStatsAllocator(), which is the better way to go. It's possible the condvars are hooked up in that for counters and not gauges (I haven't checked) but it should be straightforward to replicate for gauges.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i see the failure when I use real stats. Reason here Below is what I call waitForCounterExist b/c waitForGauge{Exist,Destroyed} is not implemented yet.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. That's just a bool arg to IntegrationTestServerImpl. Switch that bool to false so you can do these tests without risking flakes?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the default is actually false, so I guess we need to figure out first why someone decided to set it to true.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's me in this PR :( I jump to integration test from unit test because the mocked store doesn't support query for destroy. Maybe the non-real stats support query for destroy? Let me give it a try.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, confirmed real stats is not needed. The notified version of waitForGaugeDestroyed need a bunch notification for Gauge while currently only Counter type support the notification way. Can I (or anyone else) add the notification for Gauge in another PR? |
||
| std::string current_value; | ||
| if (findGauge(store, name)) { | ||
| current_value = absl::StrCat(findGauge(store, name)->value()); | ||
| } else { | ||
|
lambdai marked this conversation as resolved.
Outdated
|
||
| current_value = "nil"; | ||
| } | ||
| return AssertionFailure() << fmt::format( | ||
| "timed out waiting for {} destroyed, current value {}", name, current_value); | ||
| } | ||
| } | ||
| return AssertionSuccess(); | ||
| } | ||
|
|
||
| AssertionResult TestUtility::waitUntilHistogramHasSamples(Stats::Store& store, | ||
| const std::string& name, | ||
| Event::TestTimeSystem& time_system, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.