Skip to content

Add OTel context cleanup to ChatModelObservationFilterTest#1409

Merged
alexheifetz merged 1 commit intomainfrom
fix-stale-span
Feb 13, 2026
Merged

Add OTel context cleanup to ChatModelObservationFilterTest#1409
alexheifetz merged 1 commit intomainfrom
fix-stale-span

Conversation

@alexheifetz
Copy link
Contributor

This pull request addresses an issue with test context isolation in ChatModelObservationFilterTest.java by ensuring that OpenTelemetry (OTel) context does not leak between tests. The changes introduce explicit management of the OTel root context scope in the hierarchy integration tests.

Test context isolation improvements:

  • Imported Context and Scope from the OpenTelemetry API to allow explicit context management in tests.
  • Added a Scope field (otelRootScope) to the test class and initialized it with a clean OTel root context in the @BeforeEach setup method to prevent cross-test context leakage.
  • Ensured proper cleanup by closing the otelRootScope in the @AfterEach teardown method.

@alexheifetz alexheifetz merged commit d754167 into main Feb 13, 2026
10 checks passed
@alexheifetz alexheifetz deleted the fix-stale-span branch February 13, 2026 07:03
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
20.0% Coverage on New Code (required ≥ 73%)

See analysis details on SonarQube Cloud

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant