-
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
stats: add built-in log linear histogram support #3130
Merged
mattklein123
merged 16 commits into
envoyproxy:master
from
ramaraochavali:envoy_native_histogram_impl
Apr 23, 2018
Merged
Changes from 9 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
53b7333
native log linear implementation
ramaraochavali 5ba7949
addressed review comments
ramaraochavali 5fa7ea6
address review comments,updated release notes
ramaraochavali 0c0f8ef
removed the real thread test
ramaraochavali 15f48f1
correct the docs
ramaraochavali fb32a09
moved the logic of TLS histogram creation to recordValue
ramaraochavali 4930a24
address review comments
ramaraochavali e9e685a
formatted
ramaraochavali d6b613d
formatted
ramaraochavali a3b7b97
addressed review feedback
ramaraochavali e4805b7
ensure only one merge is in progress
ramaraochavali 0a1927f
moved variable declarations
ramaraochavali 0707303
added ASSERT for merge in progress
ramaraochavali 1eaf0fd
addressed review comments
ramaraochavali 1fc140a
added tls cache for parent histograms
ramaraochavali e26731f
addressed review comments
ramaraochavali File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
cc_library( | ||
name = "libcircllhist", | ||
srcs = ["src/circllhist.c"], | ||
hdrs = [ | ||
"src/circllhist.h", | ||
], | ||
includes = ["src"], | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -273,5 +273,38 @@ void RawStatData::initialize(absl::string_view key) { | |
name_[xfer_size] = '\0'; | ||
} | ||
|
||
HistogramStatisticsImpl::HistogramStatisticsImpl(const histogram_t* histogram_ptr) | ||
: computed_quantiles_(supportedQuantiles().size(), 0.0) { | ||
hist_approx_quantile(histogram_ptr, supportedQuantiles().data(), supportedQuantiles().size(), | ||
computed_quantiles_.data()); | ||
} | ||
|
||
const std::vector<double>& HistogramStatisticsImpl::supportedQuantiles() const { | ||
static const std::vector<double> supported_quantiles = {0, 0.25, 0.5, 0.75, 0.90, | ||
0.95, 0.99, 0.999, 1}; | ||
return supported_quantiles; | ||
} | ||
|
||
std::string HistogramStatisticsImpl::summary() const { | ||
std::vector<std::string> summary; | ||
const std::vector<double>& supported_quantiles_ref = supportedQuantiles(); | ||
summary.reserve(supported_quantiles_ref.size()); | ||
for (size_t i = 0; i < supported_quantiles_ref.size(); ++i) { | ||
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.
|
||
summary.push_back( | ||
fmt::format("P{}: {}", 100 * supported_quantiles_ref[i], computed_quantiles_[i])); | ||
} | ||
return absl::StrJoin(summary, ", "); | ||
} | ||
|
||
/** | ||
* Clears the old computed values and refreshes it with values computed from passed histogram. | ||
*/ | ||
void HistogramStatisticsImpl::refresh(const histogram_t* new_histogram_ptr) { | ||
std::fill(computed_quantiles_.begin(), computed_quantiles_.end(), 0.0); | ||
ASSERT(supportedQuantiles().size() == computed_quantiles_.size()); | ||
hist_approx_quantile(new_histogram_ptr, supportedQuantiles().data(), supportedQuantiles().size(), | ||
computed_quantiles_.data()); | ||
} | ||
|
||
} // namespace Stats | ||
} // namespace Envoy |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
nit: consistent single space after commas.