-
Notifications
You must be signed in to change notification settings - Fork 5.1k
stats: cleanup APIs and avoid extra conversions between StatName and string. #10165
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
Conversation
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
…kes. Signed-off-by: Joshua Marantz <jmarantz@google.com>
… to StatName. Signed-off-by: Joshua Marantz <jmarantz@google.com>
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.
Thanks for this, just a few questions
void SymbolTableImpl::Encoding::appendToMemBlock(StatName stat_name, | ||
MemBlockBuilder<uint8_t>& mem_block) { | ||
const uint8_t* data = stat_name.dataIncludingSize(); | ||
if (data == nullptr) { |
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.
what's the use case for appending a stat name with no data? is this just to make it easier in test?
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.
no, empty constructor for null-stats and for when there is no tag-extracted-name.
This wasn't necessary before because a StatName constructed from ""
didn't require this special-casing, but I wanted to allow StatName() to also work; without this it crashes.
@@ -516,7 +526,9 @@ void StatNameStorageSet::free(SymbolTable& symbol_table) { | |||
SymbolTable::StoragePtr SymbolTableImpl::join(const StatNameVec& stat_names) const { | |||
uint64_t num_bytes = 0; | |||
for (StatName stat_name : stat_names) { | |||
num_bytes += stat_name.dataSize(); | |||
if (!stat_name.empty()) { |
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.
why do we need this now?
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.
There are places in the code where elements being join()ed are empty, and we have been skipping these.
Here though we just have another case of an empty-constructed StatName() will crash now if we don't special-case this.
Signed-off-by: Lizan Zhou <lizan@tetrate.io>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
@@ -43,6 +43,13 @@ class MockDecoder : public Decoder { | |||
MOCK_METHOD(void, onData, (Buffer::Instance & data)); | |||
}; | |||
|
|||
class TestStatStore : public Stats::SymbolTableProvider, public Stats::IsolatedStoreImpl { |
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.
not used?
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.
done.
Signed-off-by: Joshua Marantz <jmarantz@google.com>
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.
LGTM, thanks. Do you want to merge master?
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Description: Now that we take tags as a vector of StatName pairs, change the other args to also pass via StatName. This will reduce redundant converstions between string and StatName and also reduce acquisition of the symbol table lock.
Risk Level: low
Testing: //test/...
Docs Changes: n/a
Release Notes: n/a