asyncio: fix environment variables not appearing in docs#4261
asyncio: fix environment variables not appearing in docs#4261srikaaviya wants to merge 5 commits intoopen-telemetry:mainfrom
Conversation
Fix the docstrings in environment_variables.py so they are correctly picked up by Sphinx autodoc for Read the Docs. Previously the docstrings were placed above the variable assignments, which Sphinx cannot parse. Moved them below and added the required '.. envvar::' directives, consistent with how other packages (e.g. opentelemetry-instrumentation) document their environment variables. Fixes open-telemetry#4256
...y-instrumentation-asyncio/src/opentelemetry/instrumentation/asyncio/environment_variables.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
@srikaaviya Have you checked that this is enough to fix it? This is a genuine question since building docs locally has always been painful for me 😅
@xrmx I tried building the docs locally earlier but ran into some missing C-extension dependencies. I'll get those installed and verify the env vars appear correctly, then update you. |
|
@xrmx Thanks for the heads up on checking it locally. During my local testing, I realized Sphinx was actually ignoring the To fix this properly, I moved the .. envvar:: docstrings directly into the asyncio/init.py module docstring (as followed by logging and fastapi instrumentations). I've verified locally (screenshot attached) (Side note: I noticed while investigating this, that the system_metrics package's environment variables are currently broken on the live RTD site as well for a similar reason. Just thought I'd flag it!)
|
|
If you keep the documentation in environment_variables, does adding the following snippet work? |
|
@xrmx Actually, I had already tested adding the 2nd automodule — it didn't work. After your suggestion, I realized the issue might be the placement of the docstrings. So i moved .. envvar:: entries to a module-level docstring at the top of environment_variables.py and it worked! Let me know if this commit helps. |

Description
Fix the docstrings in environment_variables.py so they are correctly picked up by Sphinx autodoc for Read the Docs.
Previously the docstrings were placed above the variable assignments, which Sphinx cannot parse. Moved them below and added the required '.. envvar::' directives, consistent with how other packages (e.g. opentelemetry-instrumentation) document their environment variables.
Fixes #4256
Type of change
How Has This Been Tested?
Ran tox lint locally:
tox -e lint-instrumentation-asyncio→ 10.00/10pre-commit runon modified files → PassedDoes This PR Require a Core Repo Change?
Checklist: