Skip to content

Fix logarithm mapping max scale comment and align with Go implementation#4981

Open
chimchim89 wants to merge 1 commit intoopen-telemetry:mainfrom
chimchim89:fix/logarithm-mapping-scale
Open

Fix logarithm mapping max scale comment and align with Go implementation#4981
chimchim89 wants to merge 1 commit intoopen-telemetry:mainfrom
chimchim89:fix/logarithm-mapping-scale

Conversation

@chimchim89
Copy link
Contributor

Description

Fixes the FIXME in LogarithmMapping._get_max_scale() by documenting the rationale for _max_scale = 20.

The original FIXME asked whether 20 is the correct value for this implementation. After reviewing the Go reference implementation and the otel-launcher-go README, 20 is confirmed correct for Python as well. The OTLP exponential histogram data point uses a signed 32-bit integer for bucket indices. At scale 20, the maximum bucket index is ((MAX_NORMAL_EXPONENT + 1) << 20) - 1, which fits within this range. At scale 21, the maximum bucket index reaches the upper limit of a signed 32-bit integer, making it difficult to test correctness.

No logic, no value, and no behaviour was changed. Only the FIXME comment was replaced with an accurate explanation.

Type of change

  • This change requires a documentation update

How Has This Been Tested?

  • tox -e lint
  • tox -e py

Does This PR Require a Contrib Repo Change?

  • No.

Checklist

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

@chimchim89 chimchim89 requested a review from a team as a code owner March 14, 2026 17:17
@xrmx xrmx moved this to Easy to review / merge / close in Python PR digest Mar 16, 2026
@xrmx xrmx added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Skip Changelog PRs that do not require a CHANGELOG.md entry

Projects

Status: Easy to review / merge / close

Development

Successfully merging this pull request may close these issues.

2 participants