Skip to content

Weaver live check test util#5088

Merged
xrmx merged 20 commits intoopen-telemetry:mainfrom
lmolkova:weaver-live-check
Apr 21, 2026
Merged

Weaver live check test util#5088
xrmx merged 20 commits intoopen-telemetry:mainfrom
lmolkova:weaver-live-check

Conversation

@lmolkova
Copy link
Copy Markdown
Member

@lmolkova lmolkova commented Apr 14, 2026

Description

Adds WeaverLiveCheck helper that allows to validate instrumentation output against otel semconv.

Examples:

  1. you can call report = check.end() and it won't raise. You can explore report (which contains a list of violations and also full weaver report as dict from json) - party on
        with WeaverLiveCheck() as weaver:
            # ... configure provider, emit telemetry ...
            provider.force_flush()
            report = weaver.end()

        seen_metrics = report["statistics"]["seen_registry_metrics"]
        self.assertEqual(seen_metrics.get("test.metric"), 1)
  1. you can call report = check.end_and_check() and it'd raise LiveCheckError (extends AssertionError) if any violations are found. You still get full report as a property on the error if you want to assert on more
        with WeaverLiveCheck() as weaver:
            # ... configure provider, emit telemetry ...
            provider.force_flush()

            with self.assertRaises(LiveCheckError) as cm:
                weaver.end_and_check()

        seen_metrics = cm.exception.report["statistics"]["seen_registry_metrics"]
        self.assertEqual(seen_metrics.get("test.metric"), 1)

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@lmolkova lmolkova requested a review from a team as a code owner April 14, 2026 06:08
Copy link
Copy Markdown
Contributor

@xrmx xrmx left a comment

Choose a reason for hiding this comment

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

Love this, thanks a lot!

Comment thread tests/opentelemetry-test-utils/src/opentelemetry/test/weaver_live_check.py Outdated
Comment thread .github/workflows/templates/test.yml.j2 Outdated
@lmolkova lmolkova force-pushed the weaver-live-check branch from 80a4f86 to 284dece Compare April 14, 2026 17:28
Comment thread .github/workflows/templates/test.yml.j2 Outdated
Comment thread tests/opentelemetry-test-utils/test-requirements.txt Outdated
Comment thread tests/opentelemetry-test-utils/src/opentelemetry/test/weaver_live_check.py Outdated
Comment thread tests/opentelemetry-test-utils/src/opentelemetry/test/weaver_live_check.py Outdated
@xrmx xrmx moved this to Approved PRs in Python PR digest Apr 16, 2026
Comment thread tests/opentelemetry-test-utils/test-requirements.txt
@lmolkova lmolkova force-pushed the weaver-live-check branch from 39b4fcf to 270c9d2 Compare April 17, 2026 03:21
@lmolkova lmolkova force-pushed the weaver-live-check branch from 1094e5b to 00d6e47 Compare April 17, 2026 04:15
Copy link
Copy Markdown
Member

@MikeGoldsmith MikeGoldsmith left a comment

Choose a reason for hiding this comment

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

🚀

Comment thread .claude/settings.json Outdated
@xrmx xrmx merged commit 6339fc4 into open-telemetry:main Apr 21, 2026
466 checks passed
@github-project-automation github-project-automation Bot moved this from Approved PRs to Done in Python PR digest Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants