Skip to content
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

refactor: migrate mongodb to instrumentation #250 #354

Merged
merged 6 commits into from
Mar 5, 2021

Conversation

vmarchaud
Copy link
Member

I migrated the plugin to instrumentation class, however i also updated the patch to hook to different files (which are more up to date with latest version and more precise).
It support mongodb starting 3.3 which was released in the summer of 2019. I though adding back support for < 3.3 but i think it make more sense in a seperate PR + see if supporting those old versions is actually needed.

@vmarchaud vmarchaud self-assigned this Feb 20, 2021
@vmarchaud vmarchaud requested a review from a team February 20, 2021 14:54
@codecov
Copy link

codecov bot commented Feb 20, 2021

Codecov Report

Merging #354 (682f44d) into main (19c5496) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #354   +/-   ##
=======================================
  Coverage   93.88%   93.88%           
=======================================
  Files          12       12           
  Lines         409      409           
  Branches       44       44           
=======================================
  Hits          384      384           
  Misses         25       25           

@vmarchaud vmarchaud linked an issue Feb 21, 2021 that may be closed by this pull request
@vmarchaud vmarchaud force-pushed the mongodb-instrumentation branch 2 times, most recently from 7d63e90 to 6d7367b Compare March 2, 2021 13:21
@vmarchaud vmarchaud requested review from Flarna, obecny and dyladan March 2, 2021 13:22
@vmarchaud
Copy link
Member Author

About 6d7367b (#354): For some obscure reason, tests were failing if supportedVersions was a property, i tested with typescript 4.2.2 with the same result. I converted it to a getter which works for some reason.

@vmarchaud vmarchaud force-pushed the mongodb-instrumentation branch from 6d7367b to 9c99321 Compare March 2, 2021 14:16
@dyladan
Copy link
Member

dyladan commented Mar 2, 2021

About 6d7367b (#354): For some obscure reason, tests were failing if supportedVersions was a property, i tested with typescript 4.2.2 with the same result. I converted it to a getter which works for some reason.

Can you paste the output of the broken test?

@vmarchaud
Copy link
Member Author

Can you paste the output of the broken test?

You can see the tests output here: https://github.com/open-telemetry/opentelemetry-js-contrib/runs/1977512692?check_suite_focus=true

undefined,
[
new InstrumentationNodeModuleFile<WireProtocolInternal>(
'mongodb/lib/core/wireprotocol/index.js',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work on windows because of the /. Using \\ works (but most likely breaks non windows).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested this on windows? I think this uses the node module resolver which I thought normalized paths.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though i think its handled by node, if thats an actual bug we should fix this directly in the instrumentation base package because the mongodb plugin isn't the only one to use internals require

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, tested on windows.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Flarna Could you open an issue on the main repo with the details ? we should fix this before RC of SDK for sure

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about using path.normalize('mongodb/lib/core/wireprotocol/index.js'), for now? The turnaround time for a fix in core until it arrives in contrib is not that short.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine doing that in another PR so we can do one PR for all contrib, WDYT ?

Copy link
Member

@obecny obecny Mar 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should make a fix in core repo when InstrumentationNodeModuleFile is being created use path.normalize as @Flarna mentioned

@dyladan
Copy link
Member

dyladan commented Mar 2, 2021

Can you document in the readme and in the package.json that this package is mac/linux only for now until the instrumentation package is updated?

@vmarchaud
Copy link
Member Author

Can you document in the readme and in the package.json that this package is mac/linux only for now until the instrumentation package is updated?

I think it would be better to make a dedicated PR for that, the graphql and grpc instrumentation use internal require for sure and i'm not sure about others. WDYT ?

@vmarchaud vmarchaud force-pushed the mongodb-instrumentation branch from 56adc2d to a5187a0 Compare March 3, 2021 08:16
@Flarna
Copy link
Member

Flarna commented Mar 3, 2021

I think it would be better to make a dedicated PR for that, the graphql and grpc instrumentation use internal require for sure and i'm not sure about others. WDYT ?

I can confirm that grpc instrumenation tests fail on windows because of the slashes issue.

Copy link
Member

@obecny obecny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generally looks fine, I have just one concern with dropping support for older version we did support with plugin

@vmarchaud
Copy link
Member Author

Please don't merge the PR as i need to bump api dependency to 0.18

@vmarchaud vmarchaud force-pushed the mongodb-instrumentation branch from 1a6c1d4 to b381381 Compare March 5, 2021 08:45
@vmarchaud vmarchaud removed the blocked label Mar 5, 2021
@vmarchaud vmarchaud requested a review from dyladan March 5, 2021 08:45
@obecny obecny added the enhancement New feature or request label Mar 5, 2021
@obecny obecny merged commit eb0ed47 into open-telemetry:main Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert mongodb plugin to instrumentation
4 participants