Count all events by project

Hello. I need to count the statistics on issues and events. I can’t find a way to calculate count events at the current time on the project. There is no such method in the sentry api.

There is only one option left-to consider sql as a query in the database, but this is a bad way. Are there other ways to solve the problem? Thanks