Skip to content

Commit

Permalink
fix output of histogram (#700)
Browse files Browse the repository at this point in the history
  • Loading branch information
qicosmos committed Jun 28, 2024
1 parent 8b29939 commit c350c57
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/ylt/metric/histogram.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class histogram_t : public metric_t {
for (size_t i = 0; i < bucket_counts.size(); i++) {
auto counter = bucket_counts[i];
value_str.append(name_).append("_bucket{");
build_label_string(str, sum_->labels_name(), labels_value);
build_label_string(value_str, sum_->labels_name(), labels_value);
value_str.append(",");

if (i == bucket_boundaries_.size()) {
Expand Down
5 changes: 5 additions & 0 deletions src/metric/tests/test_metric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,11 @@ TEST_CASE("test get metric by static labels and label") {

h1->observe({"GET", "/"}, 23);

std::string str1;
h1->serialize(str1);
std::cout << str1;
CHECK(str1.find("method=\"GET\",url=\"/\",le=") != std::string::npos);

auto s1 = metric_mgr::create_metric_static<summary_t>(
"http_req_static_summary", "help",
summary_t::Quantiles{
Expand Down

0 comments on commit c350c57

Please sign in to comment.