Skip to content

Commit 7c4a6b8

Browse files
raajheshkannaalzchenemdneto
authored
docs: add missing modules to sphinx documentation build (#5017)
* docs: add missing modules to sphinx documentation build Add RST files and toctree entries for modules that were not included in the sphinx doc build: API: - opentelemetry._events (Events API) - opentelemetry.attributes (Attributes utilities) - opentelemetry.trace.propagation (Trace context propagation) SDK: - opentelemetry.sdk._events (Events SDK implementation) - opentelemetry.sdk._logs.export (Log export processors and exporters) Closes #2573 Signed-off-by: Raajhesh Kannaa Chidambaram <495042+raajheshkannaa@users.noreply.github.com> * fix: add Event class to nitpick_ignore for sphinx docs build Signed-off-by: Raajhesh Kannaa Chidambaram <495042+raajheshkannaa@users.noreply.github.com> * fix: add changelog entry and nitpick_ignore for get_finished_logs Add CHANGELOG entry for the docs PR and suppress the Sphinx cross-reference warning for get_finished_logs (referenced as :func: in a docstring we did not modify). * fix: add Token class to nitpick_ignore for sphinx docs build * address review: remove events API, fix get_finished_logs xref, move changelog - Remove docs/api/_events.rst and docs/sdk/_events.rst (events API is deprecated per MikeGoldsmith, avoid exposing it in docs). - Remove _events entries from api/index.rst and sdk/index.rst toctrees. - Drop Event class nitpick_ignore entry (no longer needed). - Fix docstring cross-reference on InMemoryLogRecordExporter from :func: to :meth: since get_finished_logs is a method, and drop its nitpick_ignore entry. - Move changelog entry from 1.41.0/0.62b0 to Unreleased. * docs: remove trace.propagation.rst per maintainer review Submodule .rst files were removed in #5133. This was missed during the prior merge. Reviewed-by: Leighton Chen * docs: re-export AnyValue from attributes module for sphinx forward-ref resolution sphinx_autodoc_typehints calls get_type_hints on BoundedAttributes, which uses _ExtendedAttributes (Mapping[str, 'AnyValue']) from util.types. The forward ref to 'AnyValue' resolves in BoundedAttributes' __globals__ (the attributes module), not in util.types where it is defined. Re-export AnyValue into the attributes module namespace so the forward ref resolves and the docs build succeeds. Signed-off-by: Raajhesh Kannaa Chidambaram <495042+raajheshkannaa@users.noreply.github.com> * docs: use explicit re-export for AnyValue (fix ruff) Signed-off-by: Raajhesh Kannaa Chidambaram <495042+raajheshkannaa@users.noreply.github.com> * docs: use __all__ for AnyValue re-export to satisfy both pylint and ruff * docs: inject AnyValue into attributes namespace via conf.py instead of re-exporting Signed-off-by: Raajhesh Kannaa Chidambaram <495042+raajheshkannaa@users.noreply.github.com> * docs: migrate changelog entry to towncrier fragment Address @emdneto's feedback: replace direct CHANGELOG.md edit with a .changelog/5017.fixed fragment per the new towncrier workflow added in * docs: drop dead trace toctree (no trace.{status,span,propagation}.rst exist) The Submodules toctree referenced files that were never added in this PR and trace.propagation.rst was removed earlier per review. Sphinx -W treats the missing toctree target as a warning-as-error, breaking the docs build. Signed-off-by: Raajhesh Kannaa Chidambaram <495042+raajheshkannaa@users.noreply.github.com> --------- Signed-off-by: Raajhesh Kannaa Chidambaram <495042+raajheshkannaa@users.noreply.github.com> Co-authored-by: Raajhesh Kannaa Chidambaram <495042+raajheshkannaa@users.noreply.github.com> Co-authored-by: Leighton Chen <lechen@microsoft.com> Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
1 parent 4582c34 commit 7c4a6b8

7 files changed

Lines changed: 38 additions & 1 deletion

File tree

.changelog/5017.fixed

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Add missing `.rst` files to Sphinx documentation build for SDK logs,
2+
propagators, and exporter submodules.

docs/api/attributes.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
opentelemetry.attributes
2+
========================
3+
4+
.. automodule:: opentelemetry.attributes
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:

docs/api/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ For the concrete implementation of these interfaces, see the
1515
:maxdepth: 1
1616

1717
_logs
18+
attributes
1819
baggage
1920
context
2021
propagate

docs/conf.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@
2626

2727
settings.configure()
2828

29+
# Provide AnyValue in opentelemetry.attributes module's namespace so the
30+
# "AnyValue" forward reference in opentelemetry.util.types._ExtendedAttributes
31+
# resolves when sphinx_autodoc_typehints calls typing.get_type_hints() on
32+
# BoundedAttributes (whose __globals__ is the attributes module). Docs-only.
33+
import opentelemetry.attributes # noqa: E402
34+
from opentelemetry.util.types import AnyValue as _AnyValue # noqa: E402
35+
36+
opentelemetry.attributes.AnyValue = _AnyValue
37+
2938

3039
source_dirs = [
3140
os.path.abspath("../opentelemetry-instrumentation/src/"),
@@ -181,6 +190,7 @@
181190
"py:class",
182191
"_ExtendedAttributes",
183192
),
193+
("py:class", "Token"),
184194
]
185195

186196
# Add any paths that contain templates here, relative to this directory.

docs/sdk/_logs.export.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
opentelemetry.sdk._logs.export
2+
==============================
3+
4+
.. automodule:: opentelemetry.sdk._logs.export
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:

docs/sdk/_logs.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
opentelemetry.sdk._logs package
22
===============================
33

4+
Submodules
5+
----------
6+
7+
.. toctree::
8+
9+
_logs.export
10+
11+
Module contents
12+
---------------
13+
414
.. automodule:: opentelemetry.sdk._logs
515
:members:
616
:undoc-members:

opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/export/in_memory_log_exporter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class InMemoryLogRecordExporter(LogRecordExporter):
1818
1919
This class can be used for testing purposes. It stores the exported logs
2020
in a list in memory that can be retrieved using the
21-
:func:`.get_finished_logs` method.
21+
:meth:`.get_finished_logs` method.
2222
"""
2323

2424
def __init__(self):

0 commit comments

Comments
 (0)