opentelemetry-js icon indicating copy to clipboard operation
opentelemetry-js copied to clipboard

fix(instrumentation): allow different export types for files within a Node module

Open haines opened this issue 2 years ago • 4 comments
trafficstars

Which problem is this PR solving?

The InstrumentationModuleDefinition<T> interface defines a property files: InstrumentationModuleFile<any>[].

InstrumentationNodeModuleDefinition<T> implements this interface but defines the property as files: InstrumentationModuleFile<T>[]. This implies that all files within the module have the same exports type, which is unlikely! As a result, you cannot (for example) call .push() on the files field without type casting.

Short description of the changes

This PR changes the type of the property in the class to match the interface it implements.

Type of change

Please delete options that are not relevant.

  • [x] Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

npm run compile

Checklist:

  • [x] Followed the style guidelines of this project
  • [ ] ~Unit tests have been added~
  • [ ] ~Documentation has been updated~

haines avatar Aug 09 '23 09:08 haines

Codecov Report

Merging #4046 (41fb74f) into main (e01f493) will decrease coverage by 0.61%. The diff coverage is n/a.

:exclamation: Current head 41fb74f differs from pull request most recent head 030c97e. Consider uploading reports for the commit 030c97e to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4046      +/-   ##
==========================================
- Coverage   92.83%   92.23%   -0.61%     
==========================================
  Files         328      334       +6     
  Lines        9519     9463      -56     
  Branches     2050     2009      -41     
==========================================
- Hits         8837     8728     -109     
- Misses        682      735      +53     
Files Coverage Δ
...ntation/src/instrumentationNodeModuleDefinition.ts 14.28% <ø> (ø)

... and 63 files with indirect coverage changes

codecov[bot] avatar Aug 09 '23 10:08 codecov[bot]

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] avatar Oct 09 '23 06:10 github-actions[bot]

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] avatar Jan 08 '24 06:01 github-actions[bot]

@pichlermarc could you please take a look?

haines avatar Jan 09 '24 15:01 haines

Hi @pichlermarc @dyladan, is there anything blocking getting this merged?

haines avatar Apr 04 '24 09:04 haines

@haines we'll likely remove this type-parameter completely as we've had multiple probems with this in the past. See https://github.com/open-telemetry/opentelemetry-js/pull/4598 for a full write-up.

pichlermarc avatar Apr 04 '24 13:04 pichlermarc