Skip to content

test(telemetry): stop otlp export leaking between tests - #913

Merged
LinoGiger merged 1 commit into
mainfrom
test(telemetry)/stop-otlp-leaking-between-tests
Sep 29, 2026
Merged

LinoGiger merged 1 commit into
mainfrom
test(telemetry)/stop-otlp-leaking-between-tests

Conversation

@LucStr

@LucStr LucStr commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

Problem

Prod OTel still receives ~24 error spans from Rapidata.Python.SDK per test-suite run (MagicMock payloads, job-1, TTL validation errors), even though #814 disabled OTLP in tests. Last 24h: 120 of the 120 SDK error spans were test runs.

Cause

LoggingConfig.__init__ broadcasts to every registered handler, including the global tracer. test_explicit_true_overrides_the_pytest_default builds LoggingConfig(enable_otlp=True), so the global tracer is turned on for every test collected after config/.

Repro on main: run test_otlp_default.py followed by a probe test. tracer._enabled is True in the probe.

Fix

Add an autouse fixture in tests/conftest.py that re-syncs handlers to the global rapidata_config.logging after each test. No test that builds a LoggingConfig can leak export into later tests any more.

Verification

  • Probe after test_otlp_default.py: tracer._enabled is False.
  • Full suite: 295 passed.

🔗 Session: https://poseidon.rapidata.internal/chat/node-4227a31892d6

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: LucStr <25279790+LucStr@users.noreply.github.com>
@RapidPoseidon
RapidPoseidon force-pushed the test(telemetry)/stop-otlp-leaking-between-tests branch from 7a44bc6 to b8fef8c Compare September 29, 2026 09:04
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

✅ No skill update needed — confirmed by @LinoGiger

This PR does not modify src/rapidata/_skill/. That directory is the agent skill that ships in every SDK release and that coding agents read through python -m rapidata skill.

Before merging, pick one:

  1. The change affects what an agent needs to know (new or renamed API, changed parameter, default or result field, new gotcha): update src/rapidata/_skill/SKILL.md (or a companion guide next to it) in this PR.
  2. Nothing the skill documents changed: a reviewer applies the skill-unchanged-approved label. New commits remove the label again.

@RapidPoseidon

Copy link
Copy Markdown
Contributor

Rebased onto main (conflict in tests/conftest.py resolved by keeping both the new agent_sandbox fixture from #911 and this PR's tracer-resync fixture). test and type-check are green; full suite 324 passed locally, and the leak probe still shows tracer._enabled == False after test_otlp_default.py.

The remaining red check, Agent Skill, is the review gate added in #911, not a failure of this change: this PR only touches tests/conftest.py, so nothing the agent skill documents changed. It needs a reviewer to apply skill-unchanged-approved; I have not applied it myself since that label is the reviewer's sign-off.

@LucStr
LucStr marked this pull request as ready for review September 29, 2026 09:12
@LucStr
LucStr requested a review from LinoGiger as a code owner September 29, 2026 09:12
@LinoGiger LinoGiger added the skill-unchanged-approved Reviewer confirms this PR needs no agent skill update label Sep 29, 2026
@LinoGiger
LinoGiger merged commit e8d30d4 into main Sep 29, 2026
7 checks passed
@LinoGiger
LinoGiger deleted the test(telemetry)/stop-otlp-leaking-between-tests branch September 29, 2026 09:26
RapidPoseidon added a commit that referenced this pull request Sep 29, 2026
Constructing any LoggingConfig pushed its settings to the global tracer and
logger, so a standalone LoggingConfig(enable_otlp=True) re-enabled OTLP for
the whole process. Only the global rapidata_config.logging now notifies the
handlers; the conftest resync from #913 stays as a test-side backstop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: luca@rapidata.ai <25279790+LucStr@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skill-unchanged-approved Reviewer confirms this PR needs no agent skill update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants