Repository navigation
Conversation
ocelotl
force-pushed
the
docs_test_utils
branch
from
October 30, 2026 22:47
d6646c3 to
b6ea529
Compare
…pen-telemetry#5704) * fix(zipkin): tolerate invalid OTEL_EXPORTER_ZIPKIN_TIMEOUT env var Both Zipkin exporters parsed OTEL_EXPORTER_ZIPKIN_TIMEOUT with a bare int() in __init__, so an invalid value (e.g. "10s") raised ValueError during exporter construction and took SDK startup down, unlike the OTLP HTTP/gRPC exporters which warn and fall back to the default. Add _timeout_from_env() in each exporter that skips unset/empty values silently, logs a warning for non-integer values, and falls back to the 10 second default. Explicit timeout argument precedence is unchanged. Assisted-by: Doubao * style(zipkin): inline timeout assignment in both exporters Collapse the two-line timeout resolution into a single assignment per review nit; no behavior change. Assisted-by: Doubao * test(zipkin): patch os.environ in invalid-timeout fallback test Use patch.dict to set OTEL_EXPORTER_ZIPKIN_TIMEOUT instead of assigning os.environ directly, restoring the process environment after the test; applied symmetrically to both exporters. No behavior change. Assisted-by: Doubao * test(zipkin): drop redundant environment restore assertion patch.dict already restores the process environment, so asserting it in the invalid-timeout fallback test adds nothing; remove it from both exporters. No behavior change. Assisted-by: Doubao --------- Co-authored-by: Lukas Hering <40302054+herin049@users.noreply.github.com> Co-authored-by: Leighton Chen <lechen@microsoft.com>
…y#5874) * chore(deps): update dependency pylint to v4 [security] * Fix lint compatibility with Pylint 4 Remove the obsolete suggestion-mode option from both Pylint configs and use NoneType when unwrapping optional annotations. Assisted-by: GPT-6 --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Lukas Hering <lukasheringb@gmail.com> Co-authored-by: Lukas Hering <40302054+herin049@users.noreply.github.com>
ocelotl
force-pushed
the
docs_test_utils
branch
from
November 2, 2026 13:59
5e99477 to
cc4f25c
Compare
ocelotl
force-pushed
the
docs_test_utils
branch
from
November 2, 2026 14:20
cc4f25c to
0a6037c
Compare
Owner
Author
|
Superseded by open-telemetry#5879, which carries the same commits against upstream main. The branch stays, because that pull request uses it as its head. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Documents every hand-written module, class, function and method in
opentelemetry-test-utils, so that each one carries a docstring, every parameter is documented, and every callable with a return value has aReturns:section.No behaviour changes, with one exception explained under "One code change, and why" below.
Scope note
The package sits under the repository's
tests/directory, but it is a published distribution namedopentelemetry-test-utilsand the code undertests/opentelemetry-test-utils/src/is its source. Thatsrc/directory is what this change documents.tests/opentelemetry-test-utils/tests/, which holds the package's own tests, is untouched. None of the 15 files is generated.This package has no page in the rendered API reference, so nothing here changes the published documentation. The audience is whoever reads or extends the test helpers, which is every contributor who writes a test against them.
What changed
15 files under
tests/opentelemetry-test-utils/src/opentelemetry/test/, +1952/-44, in 15 commits.How to review
There is exactly one commit per file, so any single file can be reviewed on its own without reading around it. The order is
versionand__init__, which are the package entry points, thenglobals_test,test_base, the HTTP, WSGI and ASGI fixtures, the span, metric and sampler builders, the propagator and entry point doubles,concurrency_test,_otlp_test_server, and finallyweaver_live_check.Conventions followed
docs/conf.pydoes not setspecial-members, so an__init__docstring never renders. Constructor parameters therefore go on the class docstring, and__init__carries a short docstring saying so. That applies to_AssertNotRaisesMixin._AssertNotRaises,FinishedTestSpans,IterEntryPoint,CapturingSampler,OtlpProtoTestServer,LiveCheckError,LiveCheckReportandWeaverLiveCheck. In theWeaverLiveCheckcase the existing__init__docstring already described four of the ten parameters in prose; that prose moved into theArgs:section on the class rather than being duplicated.Cross-references are written only where the target is actually documented, which is why some names are written as inline literals instead.
opentelemetry.metrics.set_meter_providerand theopentelemetry._logsmembers are undocumented becausedocs/api/metrics.rst:10anddocs/api/_logs.rst:14useautomodulewithout:members:.opentelemetry.util._once.Onceis undocumented for a different reason: no document underdocs/coversopentelemetry.utilat all, as the toctree atdocs/api/index.rst:14-25shows. Inside this package the same rule applies to the three attributes ofLiveCheckErrorand to__enter__and__exit__, since plain assignments in__init__get nopy:attributeanddocs/conf.py:215-221sets nospecial-members.Where a docstring could only repeat the name, it says something else: which argument is ignored, what an empty return means, which call consumes the queue it reads from, and which method does not call its parent.
Documentation that was wrong and is now corrected
48 docstring claims that the code contradicts were corrected, each checked against the line of code that disagrees with it, and most settled by running the code. The three largest:
get_sorted_metricsclaimed a second read sees only what was recorded in between. The in-memory reader is cumulative, so it does not.reset_*_globalsfunctions claimed that replacing a proxy provider detaches tracers, meters and loggers already handed out. A proxy caches the real implementation on first use, so an object handed out earlier keeps pointing at the old one.TestBaseclass docstring gave an override recipe that cannot work. Reassigning the provider attributes aftersuper().setUp()leaves the provider thatsetUpbuilt installed as the API global.Three
Recorded*dataclasses also moved their field documentation fromArgs:toAttributes:, so that thenapoleon_use_ivarsetting atdocs/conf.py:225applies to them.Verification
Every command below was run at the head of this branch.
tests/opentelemetry-test-utils/src, measured by walking the AST: 0 remaining gaps, down from 173 at the base commit, which were 15 missing module docstrings, 16 missing class docstrings, 119 missing function or method docstrings, 11 incomplete parameter lists and 12 missingReturns:sections.ruff checkandruff format --checkwith ruff 0.16.1, the version pinned atdev-requirements.txt:23: pass on all 15 files.tox -e py312-test-opentelemetry-test-utils, which runspytest tests/opentelemetry-test-utils/tests: 58 passed, 7 skipped, 19 subtests passed, identical to the base commit. All 7 skips aretest_weaver_live_check.pyskipping because noweaverbinary is onPATH.tox -e lint-opentelemetry-test-utils: 10.00/10, no messages. No# pylint: disable=pragma was added anywhere.tox -e typecheck: 0 errors.tox -e public-symbols-check: adds no public symbols.tox -e docs, which runssphinx-build -Wwithnitpicky = Trueset atdocs/conf.py:102: build succeeded, and the base commit built in the same environment gives the same result. This branch cannot change that either way:docs/conf.py:42-52puts onlyopentelemetry-instrumentation/src,exporter/*/srcandshim/*/srconsys.path, the stringtests/appears nowhere indocs/conf.py, and every file this diff touches is undertests/opentelemetry-test-utils/src, which Sphinx never reads.One code change, and why
The explicit
return Nonethat was the whole body ofNOOPTextMapPropagator.inject, attests/opentelemetry-test-utils/src/opentelemetry/test/mock_textmap.py:38on the base commit, is removed. Ruff exempts a function whose entire body isreturn None; once the docstring is added, that statement is no longer the entire body and ruff reportsRET501. The method is annotated-> Noneand returnsNoneeither way, so behaviour is unchanged. It is in the same commit as the docstring that forced it, because splitting it out would leave one commit failingruff check.Things to decide
Four findings are described accurately in the new docstrings and deliberately not fixed, since this is a documentation change. Each could become its own issue.
_AssertNotRaisesMixin._AssertNotRaises.__exit__attests/opentelemetry-test-utils/src/opentelemetry/test/__init__.py:81returnsTrueunconditionally, so it suppresses every exception raised in the block, including one of a type the caller never asked about.with self.assertNotRaises(ValueError): raise KeyError()passes silently. The same method matches types withinrather thanissubclass, so a subclass of a watched type does not fail the test either.AsgiTestBase.tearDownattests/opentelemetry-test-utils/src/opentelemetry/test/asgitestutil.py:90andAsyncAsgiTestBase.tearDownat the same file's line 196 overrideTestBase.tearDownwithout callingsuper(), so the trace and metrics globals these classes install insetUpare never reset by them. A later test that is not based onTestBasetherefore sees the providers of the last ASGI test until something else replaces them._generate_metricattests/opentelemetry-test-utils/src/opentelemetry/test/metrictestutil.py:33and_generate_unsupported_metricat line 149 of the same file accept anattributesparameter that neither function reads. The docstrings say so rather than implying the argument has an effect.HttpTestBase.tearDownClassattests/opentelemetry-test-utils/src/opentelemetry/test/httptest.py:113never callsserver_close(), so the listening socket of each test class's server is left open until the interpreter exits. The docstring records it.