Skip to content

Conversation

@david-luna
Copy link
Contributor

@david-luna david-luna commented Nov 25, 2025

Which problem is this PR solving?

this PR add a factory function to create instrumentations. the factory function has a single param to get an object that implements the InstrumentationDelegate interface. The factory function wraps the delegate and takes care of the enabling or disabling the instrumentation (interaction with RITM and ITM).

This approach removes the inheritance from InstrumentationAbstract -> InstrumentationBase avoiding any initialisation issue in the constructor as it happens in #1989.

with this change we will have two ways of creating instrumentations:

  • extending InstrumentationBase
  • calling createInstrumentation function with a delegate

IMHO the path should be to sunset the former in favour of the later so we avoid the init issue in all instrumentations and also simplifies a bit the instrumentation code.

Fixes #1989

Short description of the changes

  • added a new function createInstrumentation in instrumentation package for node
  • TODO: added a new function createInstrumentation in instrumentation package for browser
  • created aHttpInstrumentationDelegate class and export createHttpInstrumentation function in http instrumentation

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • tests added for the new way of creating a HTTP instrumentation http-delegate-*.test.ts files
  • tests added in the instrumentation package

Checklist:

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

@codecov
Copy link

codecov bot commented Nov 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.40%. Comparing base (167185a) to head (1afe53e).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6163   +/-   ##
=======================================
  Coverage   95.40%   95.40%           
=======================================
  Files         317      317           
  Lines        9439     9439           
  Branches     2187     2187           
=======================================
  Hits         9005     9005           
  Misses        434      434           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

InstrumentationBase calls init on partly initialized Instrumentations

1 participant