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

Trouble setting transaction name and custom attributes


#1

I am having difficulty setting the transaction name and adding custom attributes to a custom transaction tracer that I’m adding to a Shoryuken-based worker. The transaction trace is happening. But, the name is just “Background” where it should be something like “create_event” based on the operation type below.

class SQSWorker
  include Shoryuken::Worker
  include NewRelic::Agent::Instrumentation::ControllerInstrumentation

  shoryuken_options queue: ENV['SQS_INPUT_QUEUE'], body_parser: :json

  def perform(sqs_message, body)
    NewRelic::Agent.set_transaction_name(body['operation_type'])
    NewRelic::Agent.add_custom_attributes(body['payload'])

    # handle message
  end

  add_transaction_tracer :perform, category: :task
end

Can you see what I’m doing wrong?


#2

@alan10 Thanks for your post. Can you send us a permalink to your app so that we can look more into how your transaction is being named? To create a permalink to any page within the New Relic user interface, scroll to the bottom and click ‘Permalink’ all the way on the right next to ‘Kiosk Mode.’ This will show us the exact page and time period that you are observing.

Regarding add_custom_attributes, the API call should accept a hash (as mentioned here.


#3

@alan10 Hi again. If nil is passed into the set_transaction_name API call when using category: :task, the agent will report the transaction as Background.

Can you confirm body['opertation_type'] is not nil?