Fix logarithm mapping max scale comment and align with Go implementation by chimchim89 · Pull Request #4981 · open-telemetry/opentelemetry-python

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