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: Add Exponential Histogram #3498

Closed
wants to merge 16 commits into from
Closed

Conversation

mwear
Copy link
Member

@mwear mwear commented Dec 20, 2022

Which problem is this PR solving?

This PR includes an implementation of the Exponential Histogram for Javascript. It is heavily based on the Golang Reference Implementation.

Fixes #3324

Short description of the changes

This PR contains the entire implementation of the Exponential Histogram, but can be considered in three parts. They are:

  • The mapping functions, based on the IEEE 754 floating point standard, described at length in the spec
  • The ExponentialHistogramAccumulation and ExponentialHistogramAggregation
  • The interfaces and code necessary to transform and export the ExponentialHistogram to OTLP

Note: I will give a walkthrough of this PR at the JS SIG meeting on Dec 21.

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. Many of the cases were borrowed from the Golang Reference implementation
  • End to end testing (exporting data via an OTel collector to a metric backend)

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added
  • Documentation has been updated (there are docs in the source code, we'll likely need to do a pass on metrics docs at some point).

@codecov
Copy link

codecov bot commented Dec 20, 2022

Codecov Report

Merging #3498 (46eecbb) into main (1c3af6c) will increase coverage by 0.21%.
The diff coverage is 97.19%.

❗ Current head 46eecbb differs from pull request most recent head e293cdd. Consider uploading reports for the commit e293cdd to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3498      +/-   ##
==========================================
+ Coverage   93.74%   93.95%   +0.21%     
==========================================
  Files         249      256       +7     
  Lines        7593     8057     +464     
  Branches     1582     1673      +91     
==========================================
+ Hits         7118     7570     +452     
- Misses        475      487      +12     
Impacted Files Coverage Δ
...tal/packages/otlp-transformer/src/metrics/types.ts 100.00% <ø> (ø)
packages/sdk-metrics/src/export/MetricData.ts 100.00% <ø> (ø)
packages/sdk-metrics/src/view/Aggregation.ts 93.82% <55.55%> (-4.79%) ⬇️
...trics/src/aggregator/exponential-histogram/util.ts 94.11% <94.11%> (ø)
...sdk-metrics/src/aggregator/ExponentialHistogram.ts 97.18% <97.18%> (ø)
...cs/src/aggregator/exponential-histogram/Buckets.ts 98.01% <98.01%> (ø)
.../packages/otlp-transformer/src/metrics/internal.ts 98.00% <100.00%> (+0.27%) ⬆️
...r/exponential-histogram/mapping/ExponentMapping.ts 100.00% <100.00%> (ø)
.../exponential-histogram/mapping/LogarithmMapping.ts 100.00% <100.00%> (ø)
...ggregator/exponential-histogram/mapping/ieee754.ts 100.00% <100.00%> (ø)
... and 4 more

@mwear mwear marked this pull request as draft December 21, 2022 17:48
@mwear
Copy link
Member Author

mwear commented Dec 22, 2022

Based on the discussion at the SIG meeting earlier today, I split this PR into three parts. See:

I'll leave this draft PR open so folks can see the three parts combined.

@github-actions
Copy link

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@pichlermarc
Copy link
Member

I'm closing this PR as all three parts (see below) have merged 🎉

Thank you again, @mwear, for putting in all the work and sticking with us during the reviews 🙂

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.

Add support for Exponential Histograms
2 participants