opentelemetry-python icon indicating copy to clipboard operation
opentelemetry-python copied to clipboard

remove unnecessary buckets on exponential histograms

Open loomis-relativity opened this issue 1 year ago • 6 comments

Description

Updates the serialization of exponential histogram buckets to remove unnecessary zero buckets. If there are no non-zero buckets, then none are serialized. This matches better the payloads from the JavaScript SDK and avoids ingestion problems with a downstream vendor when an empty negative bucket appears.

Fixes #3767

Type of change

Please delete options that are not relevant.

  • [X] Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Added unit tests to ensure that the truncation of the zero buckets works as expected. Updated the unit test for metric encoding to exercise this functionality.

Does This PR Require a Contrib Repo Change?

Answer the following question based on these examples of changes that would require a Contrib Repo Change:

  • The OTel specification has changed which prompted this PR to update the method interfaces of opentelemetry-api/ or opentelemetry-sdk/

  • The method interfaces of test/util have changed

  • Scripts in scripts/ that were copied over to the Contrib repo have changed

  • Configuration files that were copied over to the Contrib repo have changed (when consistency between repositories is applicable) such as in

    • pyproject.toml
    • isort.cfg
    • .flake8
  • When a new .github/CODEOWNER is added

  • Major changes to project information, such as in:

    • README.md
    • CONTRIBUTING.md
  • [ ] Yes. - Link to PR:

  • [X] No.

Checklist:

  • [x] Followed the style guidelines of this project
  • [x] Changelogs have been updated
  • [x] Unit tests have been added
  • ~[ ] Documentation has been updated~

loomis-relativity avatar Mar 11 '24 19:03 loomis-relativity

@euroelessar any chance you can take a look at this please?

xrmx avatar Apr 05 '24 12:04 xrmx

unfortunately this PR has to be rebased due to #3798 being merged @loomis-relativity any chance you can take on it? if not, I probably will be able to prepare a new PR somewhere within a week

euroelessar avatar Apr 05 '24 17:04 euroelessar

@loomis-relativity any chance you can rebase your changes please?

xrmx avatar Apr 23 '24 09:04 xrmx

@xrmx Merge conflict resolved.

loomis-relativity avatar May 03 '24 13:05 loomis-relativity

@euroelessar hello, do you have time to take a look at it?

xrmx avatar May 15 '24 08:05 xrmx

Apologies, the notifications got lost in my inbox. @euroelessar I've refactored the code to remove some duplication. Don't think that it can be moved into the def bucket_counts without changing the code generated from the protobuf definitions.

loomis-relativity avatar Jun 26 '24 14:06 loomis-relativity