opentelemetry-js
opentelemetry-js copied to clipboard
fix(instrumentation): allow different export types for files within a Node module
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~
Codecov Report
Merging #4046 (41fb74f) into main (e01f493) will decrease coverage by
0.61%. The diff coverage isn/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% <ø> (ø) |
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.
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.
@pichlermarc could you please take a look?
Hi @pichlermarc @dyladan, is there anything blocking getting this merged?
@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.