Skip to content
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

[Metrics SDK] Histogram min/max support #1540

Merged
merged 9 commits into from
Aug 6, 2022

Conversation

esigo
Copy link
Member

@esigo esigo commented Aug 3, 2022

Fixes #1443 (issue)

Changes

adds min/max recording to Histograms
makes this configurable via the Aggregation
Update proto to 0.18.0 to make it exportable.

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

@codecov
Copy link

codecov bot commented Aug 3, 2022

Codecov Report

Merging #1540 (6753e6f) into main (22f07a0) will increase coverage by 0.09%.
The diff coverage is 95.56%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1540      +/-   ##
==========================================
+ Coverage   83.90%   83.98%   +0.09%     
==========================================
  Files         156      156              
  Lines        4873     4905      +32     
==========================================
+ Hits         4088     4119      +31     
- Misses        785      786       +1     
Impacted Files Coverage Δ
...metry/sdk/metrics/aggregation/aggregation_config.h 100.00% <ø> (ø)
...nclude/opentelemetry/sdk/metrics/data/point_data.h 100.00% <ø> (ø)
...k/src/metrics/aggregation/histogram_aggregation.cc 87.50% <91.67%> (+2.50%) ⬆️
exporters/ostream/src/metric_exporter.cc 93.45% <100.00%> (+0.53%) ⬆️
exporters/ostream/test/ostream_metric_test.cc 100.00% <100.00%> (ø)
...ry/sdk/metrics/aggregation/histogram_aggregation.h 90.00% <100.00%> (+3.34%) ⬆️
ext/src/http/client/curl/http_client_curl.cc 81.07% <0.00%> (-0.37%) ⬇️

@esigo esigo marked this pull request as ready for review August 4, 2022 19:11
@esigo esigo requested a review from a team August 4, 2022 19:11
@esigo esigo changed the title [WIP] [Metrics SDK] Histogram min/max support [Metrics SDK] Histogram min/max support Aug 4, 2022
@@ -147,6 +149,8 @@ TEST(OStreamMetricsExporter, ExportHistogramPointData)
"\n type : HistogramPointData"
"\n count : 3"
"\n sum : 900"
"\n min : 0"
"\n max : 0"
Copy link
Member

@lalitb lalitb Aug 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these values 0?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was because histogram_point_data, had default min and max.
thanks, added proper min & max now.

@@ -21,6 +21,7 @@ class HistogramAggregationConfig : public AggregationConfig
{
public:
std::list<T> boundaries_;
bool record_min_max_ = true;
Copy link
Member

@lalitb lalitb Aug 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems we are setting it, but not using it :).

Pls ignore, it's been used. Sorry about that.

if (merge.record_min_max_)
{
merge.min_ = std::min(nostd::get<T>(current.min_), nostd::get<T>(delta.min_));
merge.max_ = std::max(nostd::get<T>(current.max_), nostd::get<T>(delta.max_));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how to handle for HistogramDiff, should we set record_min_max_ to false?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I set it to false for now.

Copy link
Member

@lalitb lalitb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to merge, once we have a decision on how to handle Histogram Diff as mentioned in the comment.

@ThomsonTan ThomsonTan merged commit 124b198 into open-telemetry:main Aug 6, 2022
@esigo esigo deleted the Histogram-min/max branch August 6, 2022 09:47
yxue pushed a commit to yxue/opentelemetry-cpp that referenced this pull request Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Metrics SDK] Histogram min/max support
3 participants