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

Node Mongoose Plugin #44

Merged
merged 3 commits into from
Mar 28, 2021
Merged

Node Mongoose Plugin #44

merged 3 commits into from
Mar 28, 2021

Conversation

tom-pytel
Copy link
Contributor

Too bad you already released 0.2.0, I wanted to get this last plugin in before that. It is not done yet, still need to test some more and write automated test. Also need to add the Component ID in the main skywalking repository and I think a logo goes somewhere?

@wu-sheng
Copy link
Member

Too bad you already released 0.2.0

We could have 0.3.0 when need :) Releasing one agent is not relying on many things.

@wu-sheng wu-sheng added this to the 0.3.0 milestone Mar 26, 2021
@tom-pytel tom-pytel changed the title added mongoose plugin Node Mongoose Plugin Mar 26, 2021
@tom-pytel tom-pytel force-pushed the master branch 3 times, most recently from 7f2d52e to b253d66 Compare March 26, 2021 20:48
@tom-pytel
Copy link
Contributor Author

BTW, this is good for merge.

@wu-sheng wu-sheng requested a review from kezhenxu94 March 27, 2021 12:59
@wu-sheng wu-sheng added enhancement New feature or request plugin labels Mar 27, 2021
Copy link
Member

@kezhenxu94 kezhenxu94 left a comment

Choose a reason for hiding this comment

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

The package-lock.json doesn't seem to be updated correctly, (seems it contains the dependencies of skywalking-nodejs itself and thus its depdnecneies duplicately), I simply checked out this PR and run npm install, the package-lock.json file is much more reduced, ~10000 lines!!), can you check ?

% gst
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean
% npm i > /dev/null
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
% g diff --stat
 package-lock.json | 10325 +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 1 file changed, 41 insertions(+), 10284 deletions(-)
% 

@tom-pytel
Copy link
Contributor Author

The package-lock.json doesn't seem to be updated correctly, (seems it contains the dependencies of skywalking-nodejs itself and thus its depdnecneies duplicately), I simply checked out this PR and run npm install, the package-lock.json file is much more reduced, ~10000 lines!!), can you check ?

My npm probably mangled it when I added mongoose as a dev dependancy for the test.

@tom-pytel
Copy link
Contributor Author

If you want just use the previous good version of package-lock and add mongoose as a dependency yourself or if you want I try again and hopefully npm behaves.

@tom-pytel
Copy link
Contributor Author

Confirmed, my npm v7.6.3 keeps doing this.

@kezhenxu94 kezhenxu94 merged commit 4670a45 into apache:master Mar 28, 2021
@zhaozhiming
Copy link

Hi, I found a problem, when I add skywalking agent in my server, the mongoose api is broken. The find api is ok but it return a Promise but not a mongoose model. when I remove the agent everything is fine.
I see that this case is not included in the test case, maybe it could be added to it.

const result = await this.model.find({}).exec();
//  ERROR 57176 nodejs.TypeError: model.find(...).exec is not a function 

@kezhenxu94
Copy link
Member

Hi, I found a problem, when I add skywalking agent in my server, the mongoose api is broken. The find api is ok but it return a Promise but not a mongoose model. when I remove the agent everything is fine.
I see that this case is not included in the test case, maybe it could be added to it.

const result = await this.model.find({}).exec();
//  ERROR 57176 nodejs.TypeError: model.find(...).exec is not a function 

@tom-pytel mind taking a look?

@tom-pytel
Copy link
Contributor Author

tom-pytel commented Jul 7, 2021

const result = await this.model.find({}).exec();
//  ERROR 57176 nodejs.TypeError: model.find(...).exec is not a function 

Just an update @zhaozhiming, not sure yet when I will be able to get to this but a temporary fix would be to simply await the .find() and leave out the .exec().

@abdusamadtv
Copy link

@tom-pytel excuse, but do you have any news about this bug?

still not working and throwing this error

MonitoringUser.find(...).populate is not a function

image

@tom-pytel
Copy link
Contributor Author

@tom-pytel excuse, but do you have any news about this bug?

Yeah, I never got back to this. The reason for the failure is because the find() function returns a wrapped Cursor object which does not have those specific functions being handled. If you want to look at it yourself and see if you can add those you can look in src/plugins/MongoDBPlugin.ts method hookCursorMaybe().

@abdusamadtv
Copy link

@tom-pytel excuse, but do you have any news about this bug?

Yeah, I never got back to this. The reason for the failure is because the find() function returns a wrapped Cursor object which does not have those specific functions being handled. If you want to look at it yourself and see if you can add those you can look in src/plugins/MongoDBPlugin.ts method hookCursorMaybe().

Thanks for your response. Are you planning any plugin updates in the future?

@tom-pytel
Copy link
Contributor Author

Thanks for your response. Are you planning any plugin updates in the future?

Not in the immediate future, sorry.

@apache apache deleted a comment from tkNobug Jan 27, 2023
@amolngt
Copy link

amolngt commented Dec 17, 2024

can anyone tell me which version should i use to avoid error ?

{
  message: 'Error installing plugin mongodb *',
  level: 'error',
  file: '/repo_name/node_modules/skywalking-backend-js/lib/core/PluginInstaller.js'
}

i am currently using "skywalking-backend-js": "^0.7.0" .

Thank you in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants