-
Notifications
You must be signed in to change notification settings - Fork 821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: more specific types for getConfig and setConfig #2388
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
@@ -29,9 +29,9 @@ import * as types from './types'; | |||
/** | |||
* 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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