Repository navigation
Conversation
Signed-off-by: Yuchen Dai <[email protected]>
Signed-off-by: Yuchen Dai <[email protected]>
|
/retest |
|
Retrying Azure Pipelines: |
|
Is the idea to have a tree of stat scopes where parent stats will also return stats of all its currently alive children? CI failures should resolve If you merge the changes in main. |
Signed-off-by: Yuchen Dai <[email protected]>
That's interesting. I have no idea of this topic. It stays what they were. The background is that the stats create in the scope is destroyed when the scope is destroyed. There are stats attached to the scope that stay alive much longer than the stats should. And the API for the stat itself to select its desired scope. This PR is introducing a new per-filter-chain scope which is shorter than the its owner listener scope.
Thanks! merged |
| * is the smallest scope to accommodate the per filter stats. Use listenerScope() or scope() if | ||
| * longer life time is needed. | ||
| */ | ||
| virtual Stats::Scope& leafScope() PURE; |
There was a problem hiding this comment.
Is there a need for access to a different scope? I haven't looked at the details, but I think it may be better to pass a different factory_context to filters, where the scope() returned is the correct one for that filter-chain, instead of giving them access to both and hoping they pick the correct one.
There was a problem hiding this comment.
Somewhat related: I found it was hard for me to figure out what the current scope is; I know what it should be, but I had to check the call sites to verify it was indeed correct. @ggreenway's suggestion sounds great in that context.
There was a problem hiding this comment.
- scope() is currently referred to "global scope". My hunch is that it's not worth a renaming or change the semantic.
- Upper scopes are desired, we do have
a. listenerScope() called by HCM and other network filters
b. global stats(e.g. a RDS config stat that created by a HCM config but shared by the HCMs outside this listener).
So barely one scope() might not work. Are you saying we pass two context, filter-chain-factory-context + listener-factory-context instead of a "factory-context"? That should work, at the cost that touching each network filter, maybe sub filters such as http/thrift...
There was a problem hiding this comment.
It seems like any scope accessible to the filter should have a lifetime that ends when the filterchain is removed.
I think we can leave all interfaces the same, and in PerFilterChainFactoryContextImpl, create new scopes for both scope() and listenerScope(). The factory will own these new scopes, and only the newly created scopes (not the parent scopes) can be accessed via that factorycontext (which is all the filter gets).
cc @jmarantz @mattklein123 can you double-check that my statements/suggestions are correct?
There was a problem hiding this comment.
That's interesting. So the global scope and listener scope life is shorter than it declared as "global" and "listener" correspondingly, am I understanding it correctly?
There was a problem hiding this comment.
scope() is not truly global, I don't think. It has no prefix, but I think it is lifetime'd to the listener currently. See
envoy/source/server/listener_impl.cc
Line 211 in d9cbb7e
There was a problem hiding this comment.
Yeah that makes more sense, I think it's just about the prefix or not. I think just changing listenerScope() in the filter chain factory to be per filter chain is the correct fix.
There was a problem hiding this comment.
Got it. I will create another PR with the new listenerScope() impl in filter chain factory context
There was a problem hiding this comment.
No, I think both scope() and listenerScope() need to be per filter chain. Otherwise stats not namespaced under the listener will have the wrong lifetime.
There was a problem hiding this comment.
Sorry yes I think ^ is correct, however as I said previously we probably still have to have a listener scoped one and use that for internal listener stats as well as listener filter stats, so you might need to spit the contexts if not already split.
|
Close this one in favor of #17931 |
Commit Message:
Create the stats scope for each filter chain factory context.
Add a leafScope() into FactoryContext interace to return the above conditionally.
#17690 Fix 1 of 2
Signed-off-by: Yuchen Dai [email protected]
Additional Description:
Alternatively, I can addd filterChainScope() but not all the factory context impl has filter chain scope. Some factory contexts were designed to build listener filter chain only.
If this is the right direction, I can go through the listenerScope() usage to switch to the new scope.
Risk Level:
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Deprecated:]
[Optional API Considerations:]