如何确定在API调用期间调用的所有函数的执行时间?

I built an API in golang. I want to determine where, in the lifetime of serving a request, I have slow downs. My current solution is to log the duration times for every function in the request call. So, something like this:

start := time.Now()
defer func() {
    log.Debugf("duration: %d", time.Since(start).Seconds())
}()

Putting the code above in the beginning of every function is cumbersome and clutters the codebase. Is there a better way to accomplish what I'm trying to do? Are there tools I can use for this?

I looked at libraries in github but couldn't find a more elegant solution.

UPDATE:

To add to the complication:

  1. My APIs calls other APIs and those calls needs to be timed.
  2. The APIs are hosted in Heroku and AWS.