feat!: more specific types for getConfig and setConfig#2388
feat!: more specific types for getConfig and setConfig#2388dyladan wants to merge 2 commits intoopen-telemetry:mainfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2388 +/- ##
==========================================
- Coverage 92.78% 92.64% -0.14%
==========================================
Files 145 142 -3
Lines 5226 5101 -125
Branches 1071 1048 -23
==========================================
- Hits 4849 4726 -123
+ Misses 377 375 -2 |
Flarna
left a comment
There was a problem hiding this comment.
It would be nice to adapt one of the instrumentations like http to have an implicit test.
BREAKING CHANGE
|
@MSNev re-requested your review since the last change is breaking |
| * Base abstract internal class for instrumenting node and web plugins | ||
| */ | ||
| export abstract class InstrumentationAbstract<T = any> | ||
| export abstract class InstrumentationAbstract<InstrumentedModuleType = any, Config = types.InstrumentationConfig> |
There was a problem hiding this comment.
would this work ?
| export abstract class InstrumentationAbstract<InstrumentedModuleType = any, Config = types.InstrumentationConfig> | |
| export abstract class InstrumentationAbstract<InstrumentedModuleType = any, Config extends types.InstrumentationConfig> |
There was a problem hiding this comment.
If we make Config required we have to also make InstrumentedModuleType optional (required types can't follow optional types). Is that what you're suggesting?
There was a problem hiding this comment.
I think it should be a combination - optional with default to types.InstrumentationConfig but if a concrete type is specified it must extend types.InstrumentationConfig (otherwise it would be allowed to use e.g. number).
There was a problem hiding this comment.
just a friendly ping here to prevent stuck
|
I think it's needed to additionally adapt Once again, if you could adapt at least one instrumentation like http we would have an implicit test for this. |
|
It is required. I've been wrestling with it all morning because the instrumentation loader doesn't like the parameterized types. It actually turns out it's been broken since forever because the InstrumentationBase doesn't pass the T type so it is always any. |
|
Well, it was not really broken. As indicated in #2256 the base class has no real need for |
|
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 was closed because it has been stale for 14 days with no activity. |
Fixes #2258 Should not require any change to existing instrumentations, but allows instrumentations to declare config types with more properties which are used by config get/set