Skip to content

Enhance WeaverLiveCheck runner capabilities (#5526) - #5580

Open
webdevsamran wants to merge 2 commits into
open-telemetry:mainfrom
webdevsamran:fix/weaver-live-check-improvements
Open

Enhance WeaverLiveCheck runner capabilities (#5526)#5580
webdevsamran wants to merge 2 commits into
open-telemetry:mainfrom
webdevsamran:fix/weaver-live-check-improvements

Conversation

@webdevsamran

Copy link
Copy Markdown

Summary

Fixes #5526

Enhance WeaverLiveCheck and LiveCheckReport for programmatic test and conformance runner integration.

Changes

  • LiveCheckReport: Added .raw property and .to_dict() method returning self._report. Added typed properties .samples and .statistics.
  • LiveCheckError: Attached stdout and stderr attributes for failure diagnostics.
  • WeaverLiveCheck:
    • Added named constructor parameters config (--config) and advice_data (--advice-data), and allowed policies_dir to be a Sequence[str].
    • Added startup_timeout parameter and made readiness polling quiet by silencing transient connection warnings.
    • Exposed stdout and stderr properties reading the captured output.
    • Made end() and end_and_check() raise RuntimeError if called when weaver was already stopped.
  • Added unit tests in tests/opentelemetry-test-utils/tests/test_weaver_live_check.py.

…butes

BoundedAttributes.__setitem__ and _set_items, when operating in
extended_attributes mode, called _clean_extended_attribute and then
stored the result unconditionally.  The problem: _clean_extended_attribute
returns None for BOTH:

1. A valid caller-supplied None value.
2. An invalid key (empty / non-string key).

So an entry with a valid None value was silently skipped (never stored)
because None was interpreted as 'invalid'.

Fix: introduce an _INVALID_ATTRIBUTE sentinel object that
_clean_extended_attribute returns when the key or value is genuinely
invalid.  Only the sentinel triggers the early-return / skip path.
A true None value now flows through to _setitem_locked as intended.

Also update _clean_extended_attribute return type and docstring,
and add a regression test (test_extended_attributes_none_value_stored).

Fixes open-telemetry#5432
@webdevsamran
webdevsamran requested a review from a team as a code owner August 24, 2026 05:47
@linux-foundation-easycla

Copy link
Copy Markdown

CLA Not Signed

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Aug 24, 2026

Copy link
Copy Markdown

Pull request dashboard status

Waiting on the author · refreshed 2026-08-24 05:52 UTC

Resolve merge conflicts.

Two things need attention:

  • Required checks are failing — investigate the failures.
  • 3 review items — respond to each (e.g. link a commit, explain why not, ask a follow-up):
    • Inline threads: 1, 2, 3
Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Should this be with reviewers? Comment /dashboard route:reviewers to route it to them.
  • Anything wrong — including the routing? Report it with what you expected; it helps us improve the dashboard.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9640e53edf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +37 to +42
# Sentinel object returned by _clean_extended_attribute to signal that the
# key/value was invalid and must not be stored in the attributes dict.
# A plain ``None`` cannot serve this purpose because ``None`` is a valid
# AnyValue and must be stored when explicitly set by the caller.
_INVALID_ATTRIBUTE = object()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep the attribute fix out of this runner change

Remove this attribute-cleaning behavior change from the WeaverLiveCheck commit. Storing explicit None values in BoundedAttributes is unrelated to the runner enhancements described by this commit, affects a separate public package, and introduces its own compatibility and regression surface; it should be reviewed and tested independently as a narrowly scoped change.

AGENTS.md reference: AGENTS.md:L17-L19

Useful? React with 👍 / 👎.

Comment on lines 228 to +230
except TypeError as exception:
_logger.warning("Attribute %s: %s", key, exception)
return None
return _INVALID_ATTRIBUTE

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Do not propagate the sentinel into nested mappings

When an extended attribute is a mapping whose nested value cannot be stringified, the recursive _clean_extended_attribute call returns this sentinel, but _clean_extended_attribute_value assigns that result directly into cleaned_dict. The outer attribute is then accepted with a plain object embedded in it, violating the AnyValue contract and potentially causing serialization/export failures; the recursive mapping path must detect and omit the sentinel rather than store it.

Useful? React with 👍 / 👎.

Comment on lines +366 to +368
urllib_logger = logging.getLogger("urllib3.connectionpool")
prev_level = urllib_logger.level
urllib_logger.setLevel(logging.ERROR)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid racing updates to the global urllib3 logger

When two live checks start concurrently, each saves and changes the same process-global logger level: the second can save ERROR, the first can restore the original level, and the second then restores ERROR, permanently suppressing urllib3 warnings after both startups finish. This also suppresses unrelated requests made by other threads during polling, so readiness checks should silence only their own traffic rather than mutate the shared logger.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

WeaverLiveCheck improvements

1 participant