Skip to content

Commit 3fcabc3

Browse files
srikaaviyaxrmx
andauthored
asyncio: fix environment variables not appearing in docs (#4261)
* asyncio: fix environment variables not in docs 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 * Fix typo from 'determines' to 'determine' * Apply suggestion from @xrmx * asyncio: move environment_variables docs to __init__ module docstring for sphinx * asyncio: keep envvar docs in environment_variables.py with module-level docstring --------- Co-authored-by: Riccardo Magliocchetti <[email protected]>
1 parent 60345f3 commit 3fcabc3

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5959
([#4139](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4139))
6060

6161
### Fixed
62+
63+
- `opentelemetry-instrumentation-asyncio`: Fix environment variables not appearing in Read the Docs documentation
64+
([#4256](https://github.com/open-telemetry/opentelemetry-python-contrib/issues/4256))
6265
- `opentelemetry-instrumentation-mysql`: Refactor MySQL integration test mocks to use concrete DBAPI connection attributes, reducing noisy attribute type warnings.
6366
([#4116](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4116))
6467
- `opentelemetry-instrumentation-cassandra`: Use `_instruments_any` instead of `_instruments` for driver dependencies so that having either `cassandra-driver` or `scylla-driver` installed is sufficient

docs/instrumentation/asyncio/asyncio.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,8 @@ OpenTelemetry asyncio Instrumentation
55
:members:
66
:undoc-members:
77
:show-inheritance:
8+
9+
.. automodule:: opentelemetry.instrumentation.asyncio.environment_variables
10+
:members:
11+
:undoc-members:
12+
:show-inheritance:

instrumentation/opentelemetry-instrumentation-asyncio/src/opentelemetry/instrumentation/asyncio/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ def func():
7979
* asyncio.process.duration (seconds) - Duration of asyncio process
8080
* asyncio.process.count (count) - Number of asyncio process
8181
82-
8382
API
8483
---
8584
"""

instrumentation/opentelemetry-instrumentation-asyncio/src/opentelemetry/instrumentation/asyncio/environment_variables.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,27 @@
1313
# limitations under the License.
1414

1515
"""
16-
Enter the names of the coroutines to be traced through the environment variable below, separated by commas.
16+
.. envvar:: OTEL_PYTHON_ASYNCIO_COROUTINE_NAMES_TO_TRACE
17+
18+
Enter the names of the coroutines to be traced through the environment variable below, separated by commas.
19+
20+
.. envvar:: OTEL_PYTHON_ASYNCIO_FUTURE_TRACE_ENABLED
21+
22+
To determine whether the tracing feature for Future of Asyncio in Python is enabled or not.
23+
24+
.. envvar:: OTEL_PYTHON_ASYNCIO_TO_THREAD_FUNCTION_NAMES_TO_TRACE
25+
26+
Enter the names of the functions to be traced through the environment variable below, separated by commas.
1727
"""
1828

1929
OTEL_PYTHON_ASYNCIO_COROUTINE_NAMES_TO_TRACE = (
2030
"OTEL_PYTHON_ASYNCIO_COROUTINE_NAMES_TO_TRACE"
2131
)
2232

23-
"""
24-
To determines whether the tracing feature for Future of Asyncio in Python is enabled or not.
25-
"""
2633
OTEL_PYTHON_ASYNCIO_FUTURE_TRACE_ENABLED = (
2734
"OTEL_PYTHON_ASYNCIO_FUTURE_TRACE_ENABLED"
2835
)
2936

30-
"""
31-
Enter the names of the functions to be traced through the environment variable below, separated by commas.
32-
"""
3337
OTEL_PYTHON_ASYNCIO_TO_THREAD_FUNCTION_NAMES_TO_TRACE = (
3438
"OTEL_PYTHON_ASYNCIO_TO_THREAD_FUNCTION_NAMES_TO_TRACE"
3539
)

0 commit comments

Comments
 (0)