Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

Ruby clockwork with newrelic


#1

Did anybody tried with clockwork + newrelic

In aws we’re using clockwork with separate instance(t2.medium). how can i configure newrelic ruby agent. if i follow normal way i.e adding gem and it is not working.

currently we running only one file which is clock.rb in instance. which will do some Database checks and spawns job(sidekiq) will take care by another instances.

ruby agent version is : 4.7.1.340


#2

Hi @shaik.shakeel! I am eager to hear if anyone in the community has experience working with clockwork and New Relic!

Our support engineers haven’t come across this particular case, so we will closely watch any helpful info that comes into this thread! :blush:


#3

Hello Shaik,

Thanks for writing in to us. I did respond a few minutes ago to an internally-made ticket but I wanted to make sure the community also saw this response as well.

I see you are using Clockwork and trying to make sure it gets instrumented correctly with New Relic. At this time, we do not auto-instrument Clockwork. Here’s one of documents about instrumenting background processes that may be of use to you: https://docs.newrelic.com/docs/agents/ruby-agent/background-jobs/monitor-ruby-background-processes

Since it’s not something we instrument automatically, I would suggest trying custom transaction tracers with add_transaction_tracer.

Additionally, we have add_method_tracer for instrumenting individual methods that aren’t automatically instrumented.

Hope this helps!


#4

Thanks for your information. in our ruby file we don’t have any classes or methods

take look into the sample clockwork code :

Clockwork.every(1.minutes, 'Trigger Process') do
  Account.all.each do |account|
    account.make_current
    # and so much stuff
  end
end

this is what we’ve in clockwork.rb file. we are running this file using clockwork clockwork.rb.
is there any way to instrument this transactions ?

Thanks


#5

@shaik.shakeel Looking at your code snippet it does appear you may be using an ActiveRecord model and it looks like you’re calling the make_current method on an instance of that model.

I don’t have a lot of context into your application but we do have out of the box instrumentation for Sidekiq and ActiveRecord (if that’s what you’re using).

Custom instrumentation, can be used to instrument things that we don’t instrument by default.


#6

Found this thread via Google, solution is here: https://github.com/Rykian/clockwork/issues/17


#7

Great share, @kfalconer! Thank you. :blush: