New Relic And Sidekiq Metrics

Viewed 73

I'm kinda new at the new relic stuff, and I have a task to create alerts for specific queues from sidekiq, and I've seen that there is this NSQL, but since I don't know any of the metrics' real names, thought about asking here.

I have a Rails 5 project, a full-stack solution, and wanted to track queue length and lag, both of what I've seen in this plugin, but since it's been some time that it doesn't receive and update and I don't actually know how to integrate this type of plugins, I think it's more of a guideline. I've seen the premade alerts that NewRelic has for Sidekiq, and its dashboard, but I'm not interested in memory usage/CPU usage metrics, so they're kinda useless to me.

Thank you in advance!

1 Answers

The Ruby agent's Sidekiq instrumentation is documented here, though it's a bit high level: https://docs.newrelic.com/docs/apm/agents/ruby-agent/background-jobs/sidekiq-instrumentation/

When the agent's Sidekiq instrumentation is enabled (and it is by default), the agent will configure Sidekiq with both client and server middleware. This is done by making Sidekiq.configure_client and Sidekiq.configure_server calls. Additionally, we hook into Sidekiq's DelayedClass class for the reporting of errors.

With this middleware and hook in place, both the client and server components will report metrics. Also distributed tracing metadata will flow from clients to the server. For Sidekiq, the worker class that performs the job is considered server based, and the model or controller class that enqueues work - typically from a Rails web application - is considered client based.

As for metrics names, everything should be prefixed with OtherTransaction/SidekiqJob:

• Outermost roll-up metric: OtherTransaction/SidekiqJob/all.

• (Server) job class metric: OtherTransaction/SidekiqJob/<WORKER_CLASS_NAME>/perform

• (Client) enqueueing class metric: OtherTransaction/SidekiqJob/<MODEL_CLASS_NAME>/<ENQUEUEING_METHOD_NAME>

• (Server) job class failure metric: OtherTransaction/SidekiqJob/Sidekiq::Extensions::DelayedClass/perform

Related