Skip to content

Document all hand-written source in exporter/opentelemetry-exporter-otlp - #74

Draft
ocelotl wants to merge 5 commits into
docs-basefrom
docs_exporter_otlp
Draft

ocelotl wants to merge 5 commits into
docs-basefrom
docs_exporter_otlp

Conversation

@ocelotl

@ocelotl ocelotl commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Adds the one missing docstring in exporter/opentelemetry-exporter-otlp.

Base branch is docs-base, a snapshot of open-telemetry/opentelemetry-python@3462000f3, so the diff shows only this work. This pull request is against the ocelotl fork and is not proposed upstream.

What changed

One file, +36/-0, in five commits:

  • 46573dbde Document opentelemetry.exporter.otlp.version
  • 6d4408197 Correct how the otlp exporter name is resolved from the environment
  • ed2a63303 State how an empty protocol environment variable is read
  • 758146e23 Note that the protocol value is stripped before it is matched
  • 2712c2201 Rewrap the protocol paragraph

opentelemetry-exporter-otlp is a meta-package. Its src/ tree holds a py.typed marker and a single module, opentelemetry/exporter/otlp/version/__init__.py, which carries __version__ and nothing else. There is no exporter code here at all: the distribution exists so that pip install opentelemetry-exporter-otlp pulls in opentelemetry-exporter-otlp-proto-grpc and opentelemetry-exporter-otlp-proto-http together. So the whole of this change is a module docstring plus an attribute docstring on __version__, and there was nothing else to document.

The module docstring says what installing the distribution gets you, and names the two distributions an exporter class is actually imported from together with the three modules the classes live in. Its second paragraph covers the part of this package that is easy to get wrong. This distribution does register otlp entry points in all three exporter groups (exporter/opentelemetry-exporter-otlp/pyproject.toml:34-41), and all three point at the gRPC exporters, but the SDK's environment-variable configuration never loads them. _get_exporter_entry_point at opentelemetry-sdk/src/opentelemetry/sdk/_configuration/__init__.py:155 rewrites the name otlp to otlp_proto_grpc or otlp_proto_http first, and the entry point loaded is the rewritten one, which the gRPC and HTTP distributions register. The choice comes from OTEL_EXPORTER_OTLP_TRACES_PROTOCOL falling back to OTEL_EXPORTER_OTLP_PROTOCOL (line 164), with both unset or empty giving gRPC (lines 166-168) and an unrecognised non-empty value raising RuntimeError (lines 174-176). The value is stripped of surrounding whitespace at line 171 before it is matched, so grpc\n out of a ConfigMap is read as grpc.

The attribute docstring follows the form used for the same __version__ attribute in #54.

The release tooling rewrites only the __version__ assignment line (scripts/eachdist.py:541-542 sets search = "__version__ .*"), so neither docstring is disturbed by a version bump.

Verification

Every command below was re-run after the last commit.

  • Docstring coverage over exporter/opentelemetry-exporter-otlp/src, measured by walking the AST: 0 gaps, down from 1 (mod_missing: 1).
  • ruff check and ruff format --check with ruff 0.16.1, the version pinned in dev-requirements.txt:23: pass, 1 file.
  • pytest exporter/opentelemetry-exporter-otlp/tests -q: 1 passed.
  • tox -e lint-opentelemetry-exporter-otlp-combined: 10.00/10, no messages. The name is declared in the envlist at tox.ini:75 and mapped to a command at tox.ini:284.
  • tox -e docs: build finished with problems, 16 warnings, the same 16 as docs-base, of the same four kinds (6 _http.Compression, 6 ambiguous MeterProvider, 2 types.Attributes, 2 Attributes). This branch adds none. Nothing in this package is autodoc'd: docs/exporter/otlp/otlp.rst:3 documents the opentelemetry.exporter.otlp namespace package, not the version module, so the new docstrings do not reach the rendered output.
  • tox -e typecheck: 2 errors, both in templatelib.py of the CPython 3.14.6 standard library and neither in this repository. The identical two errors appear with this branch's change stashed, so they are pre-existing and not caused by this change.

Nothing to decide

No # pylint: disable= pragma was added, no docs/conf.py entry was needed, and no behaviour changed.

This branch has not been deployed

No deployments
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.

1 participant