How to collect methods call statistics?

I want to identify the most used methods and methods that are not used at all.

1 Like

How about creating a collection (or a single record in an existing collection) and incrementing a counter field in this collection/record from the top of every method call? You could do the same with your publications. You would start to form the basis for your own brand of analytics for your meteor app.

This is just an idea, and an intriguing one for me. I have not yet implemented it but Iā€™m sure once you get started, this will start to resolve in your mind into a system much like logging and it will no doubt start to burgeon.

Good luck!

Give https://montiapm.com/ a try. Super easy to set up, and it will give you lots of other data as well.

Even the free tier is really useful, but the $5 tier is well worth it.

Edit: For example, all my methods in Production on average over the past week:

Monti%20APM%20-%20Performance%20Monitoring%20for%20Meteor%20Apps

1 Like

Thanks for the answer.
Your idea is good, but involves manually adding code to each method. I was looking for the opportunity to automatically set such counters. I found an interesting case here https://github.com/Meteor-Community-Packages/meteor-method-hooks/blob/master/server.js

1 Like

Thanks,
I will try it with TEST environment.

That could work for you very well. I am also looking at that package, trying to weigh the relative merits of a custom solution versus a package. I must say that here, for your particular use case thus far, method hooks looks very promising.

I suppose you can use method hooks to attach an event to update your proposed method counter

1 Like