Skip to content

Conversation

@sharvath-newrelic
Copy link
Contributor

@sharvath-newrelic sharvath-newrelic commented Jan 20, 2026

Overview

Per this PR, classloading issues resulting from the porting of Kotlin lab code have been resolved. Additionally, unit tests for the Kotlin coroutines instrumentation modules (1.4, 1.7 and 1.9) have been added with assertions to verify NR agent behavior. Tests help to verify:

  • Transaction completion counts
  • Transaction name presence
  • Metric generation for instrumented operations
  • Token propagation across async boundaries

It's worth noting async.kt and PauseService.kt were not ported for the following reasons:

  1. async.kt:
    - Contained example code demonstrating async/await patterns but without assertions
    - All patterns have been incorporated into CoroutinesTest.kt with Introspector-based verification
    - The new tests cover the same scenarios (async, awaitAll, multiple deferreds) with agent behavior validation
  2. PauseService.kt:
    - No longer needed as new tests use delay() directly within test methods

Related Github Issue

Resolves #2675
Resolves #2661

Testing

To run the instrumentation tests manually, run the following command template via the terminal:
./gradlew instrumentation:kotlin-coroutines-1.x:test --parallel

@codecov-commenter
Copy link

codecov-commenter commented Jan 20, 2026

Codecov Report

❌ Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.31%. Comparing base (cfb7b44) to head (8e19186).
⚠️ Report is 16 commits behind head on main.

Files with missing lines Patch % Lines
...c/agent/introspec/internal/WeavingClassLoader.java 0.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2705      +/-   ##
============================================
- Coverage     70.34%   70.31%   -0.04%     
+ Complexity    10123    10118       -5     
============================================
  Files           853      853              
  Lines         41118    41120       +2     
  Branches       6240     6241       +1     
============================================
- Hits          28923    28912      -11     
- Misses         9372     9380       +8     
- Partials       2823     2828       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

Add/refine Kotlin unit tests for ported lab instrumentation Resolve classloading issues in kotlin tests

4 participants