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

feat: exponential histogram - part 2 - the accumulation and aggregator #3505

Merged
merged 12 commits into from
Mar 14, 2023

Conversation

mwear
Copy link
Member

@mwear mwear commented Dec 22, 2022

Which problem is this PR solving?

This PR is part 2 in a series of PRs to add exponential histogram support. See this comparison for the changes introduced in this PR (omitting the mapping functions from part 1).

Related: #3324

Short description of the changes

This PR includes ExponentialHistogramAccumulation and ExponentialHistogramAggregator along with extensive unit testing. This is the bulk of the work and uses the mapping functions introduced in part 1.

This code is heavily based on the Golang reference implementation. For other details see:

For the other PRs in this series see:

You can see all 3 PRs combined in the original draft PR

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Extensive unit testing
  • End to end test with the 3 PRs from this series adding ExponentialHistogram support

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added
  • Documentation has been updated

@codecov
Copy link

codecov bot commented Dec 22, 2022

Codecov Report

Merging #3505 (9434b41) into main (56e6b1b) will increase coverage by 0.16%.
The diff coverage is 97.53%.

❗ Current head 9434b41 differs from pull request most recent head 51a1b23. Consider uploading reports for the commit 51a1b23 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3505      +/-   ##
==========================================
+ Coverage   93.56%   93.72%   +0.16%     
==========================================
  Files         275      277       +2     
  Lines        8126     8448     +322     
  Branches     1691     1754      +63     
==========================================
+ Hits         7603     7918     +315     
- Misses        523      530       +7     
Impacted Files Coverage Δ
.../packages/otlp-transformer/src/metrics/internal.ts 97.72% <ø> (ø)
.../aggregator/exponential-histogram/mapping/types.ts 100.00% <ø> (ø)
packages/sdk-metrics/src/export/MetricData.ts 100.00% <ø> (ø)
...sdk-metrics/src/aggregator/ExponentialHistogram.ts 97.15% <97.15%> (ø)
...cs/src/aggregator/exponential-histogram/Buckets.ts 98.01% <98.01%> (ø)
...r/exponential-histogram/mapping/ExponentMapping.ts 100.00% <100.00%> (ø)
.../exponential-histogram/mapping/LogarithmMapping.ts 100.00% <100.00%> (ø)
...trics/src/aggregator/exponential-histogram/util.ts 94.11% <100.00%> (+6.61%) ⬆️
packages/sdk-metrics/src/aggregator/types.ts 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

@mwear mwear mentioned this pull request Dec 22, 2022
6 tasks
Copy link
Member

@dyladan dyladan left a comment

Choose a reason for hiding this comment

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

Sorry my review took so long

@dyladan
Copy link
Member

dyladan commented Feb 27, 2023

@open-telemetry/javascript-maintainers would like at least one more set of experienced eyes on this. @legendecas if you have time to look I would really appreciate it since you're the most familiar with the metrics SDK. @pichlermarc you've also done a lot of metrics work so your insight here would also be great.

Copy link
Member

@pichlermarc pichlermarc 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. 🚀

I'm still having a hard time understanding everything, but I feel like I understand it a bit better now, thanks for adding all the great comments explaining what's happening. 🙂

No major comments, just a few nits. 🙂

Copy link
Member

@pichlermarc pichlermarc left a comment

Choose a reason for hiding this comment

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

Was looking to merge this and did another quick review on it: I realized that we're exporting ExponentialHistogram already which may want to hold back until we get #3654 out the door.

However, with the proposed changes below we could merge it now and we won't have to wait for the 1.10.0 release. 🙂

Comment on lines +100 to +103
dataPoint:
| DataPoint<number>
| DataPoint<Histogram>
| DataPoint<ExponentialHistogram>,
Copy link
Member

Choose a reason for hiding this comment

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

I think we may be able to reduce this to

Suggested change
dataPoint:
| DataPoint<number>
| DataPoint<Histogram>
| DataPoint<ExponentialHistogram>,
dataPoint: DataPoint<number>,

if we change

  • toSingularDataPoints(metricData: MetricData) -> toSingularDataPoints(metricData: SumMetricData | GaugeMetricData)
  • toHistogramDataPoints(metricData: MetricData) -> toSingularDataPoints(metricData: HistogramMetricData)

This way, we don't have to export ExponentialHistogram from @opentelemetry/sdk-metrics and we can merge this PR before following through with #3654, as it would not expose any new types. 🙂

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry I was out last week. I wanted to check in to see if this is still needed since #3654 was merged and released?

Copy link
Member

Choose a reason for hiding this comment

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

No worries 🙂
It's not blocking for me - since there's no release imminent I think it would be safe to merge as-is.

@pichlermarc pichlermarc merged commit d82a098 into open-telemetry:main Mar 14, 2023
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.

None yet

3 participants