How to profile an Atlas Realm function?

Hello,
I’ve created a Realm function and access it using an HTTPS Endpoint. The query itself (using Atlas Search) is fast but the overall performance is ~3 s (search and retrieval). I’d like to be profile the function to make sure there isn’t anything I can do to speed performance. The function is not a pure aggregation, as the search is partially built from the user’s profile (so one _id find, then an aggregation). Any suggestions?