-
Notifications
You must be signed in to change notification settings - Fork 533
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
fix: remove types of the instrumented libs form public apis #1221
Conversation
Requesting reviews from the component owners: @henrinormak and @blumamir 🙏 |
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.
The dataloader part looks good, the mongoose changes syntactically make sense as well, but not super familiar with that package.
export function getAttributesFromCollection( | ||
collection: Collection | ||
_collection: unknown |
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 might be missing something, but why is this function part of the public api? it is not exported in index.ts
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 is not exported to index.ts
, but it's exported from utils. I expected TS to recursively import ts files and compile them. It seems that I was wrong and in the normal case utils is not compiled. Only when
import * as mongooseUtils from '@opentelemetry/instrumentation-mongoose/build/src/utils';
is run explicitly, the problem occurs. Is there a compiler option that turns that process recursive?
That said, if I understand the situation correctly, we don't have to remove the type from that signature. Thanks for pointing that out, @blumamir!
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.
Is there a compiler option that turns that process recursive?
From what I know, typescript is compiling only the single .d.ts
file that is declared in package.json
like this:
{
"types": "index.d.ts"
}
This file in turn can import
other type files (or not), but since utils.d.ts
is not imported from index.d.ts
, then typescript never encounters import * from 'mongoose'
so there are no issues.
This is only my understanding, but I could be missing some important details. typescript is so complicated 😅
Which problem is this PR solving?
Fixes #1217
Fixes #1218
Short description of the changes
InstrumentationNodeModuleDefinition<unknown>
patch
andunpatch
methods on mongoose instrumentation private