<commit_before>class NewRelicQueueLatencyLogger
  def call(worker, job, queue)
    queue_latency = Time.now.utc - Time.at(job["enqueued_at"], in: "+00:00")
    ::NewRelic::Agent.add_custom_attributes({ queue_latency: queue_latency, queue: queue })
    yield
  end
end

Sidekiq.configure_server do |config|
  config.server_middleware do |chain|
    chain.add NewRelicQueueLatencyLogger
  end
end<commit_msg>Send course ID to newrelic for CDUW<commit_after>class NewRelicQueueLatencyLogger
  def call(worker, job, queue)
    queue_latency = Time.now.utc - Time.at(job["enqueued_at"], in: "+00:00")
    info = {
      queue_latency: queue_latency,
      queue: queue,
    }
    if worker.class.to_s == "CourseDataUpdateWorker"
      info[:course_id] = job["args"][0]
    end
    ::NewRelic::Agent.add_custom_attributes(info)
    yield
  end
end

Sidekiq.configure_server do |config|
  config.server_middleware do |chain|
    chain.add NewRelicQueueLatencyLogger
  end
end
{'fraction_non_alphanumeric': 0.10743801652892562, 'fraction_numerical': 0.009297520661157025, 'mean_word_length': 4.324175824175824, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '667425', 'n_tokens_mistral': 344, 'n_tokens_neox': 337, 'n_words': 70}