nambrot nambrot - 1 month ago 7
Ruby Question

NewRelic: Which parts of the method take the longest?

I am currently using Neo4j over the REST interface and would love to use NewRelic to analyze which calls take the longest. It can happen that within a request/response cycle (or action/view) I need to call the DB more than once.

I tried using NewRelic for the first time, but it can only show me the many HTTP calls im making and how long they take, but not which call correlates to which part of the method.

I hope I have expressed my problem somewhat clearly, I would just love to be able to figure out which calls take the longest.

rkb rkb
Answer Source

You can give different names to your various HTTP calls using New Relic's custom instrumentation (see the section "Tracing Blocks of Code"). You can wrap a block of Ruby with a call to trace_execution_scoped, a method provided in the Ruby agent API.

The names you give your different calls will show up in Transaction Traces and in the breakdown of where each of your Web Transactions spends time in aggregate.