You simply can use project https://captain-bridge.tech/.
It allows building custom metrics for Jira using syntax of mongo, python or sql.