Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
October 30, 2020 09:53 pm GMT

Using New Relic APM with Rails on AWS Lambda

Custom Ink has been using Rails for as long as the framework has been around. For many of those years we have used New Relic's awesome Application Performance Monitoring (APM) tool to observe and debug dozens of our critical services.

In the past I have have shared on Twitter that that New Relic Ruby Agent did not work when using Rails on AWS Lambda. I think my assumption was based on how the agent's collector needed a daemon process on the server or was tightly coupled to certain web servers like Passenger and thus not compatible with Lamby's Rack adapter under API Gateway.

Thankfully I was wrong! Here is how I got New Relic & Rails working this past week.

  1. Use the NEWRELIC_LICENSE_KEY environment variable. This will ensure that the RPM gem can assign it to the license_key config as needed during initialization. Ensure this is present before Rails loads.
  2. Add the log_file_path: STDOUT to your config yaml file.

When your Lambda experiences a cold start, the agent should log that it too is starting and using Rack and whatever instrumentation hooks it finds within your application. Here is an example of the config/newrelic.yml file.

common: &default_settings  app_name: MyAppName  log_level: info  log_file_path: STDOUT  ssl: truedevelopment:  <<: *default_settings  monitor_mode: falsetest:  <<: *default_settings  monitor_mode: falseproduction:  <<: *default_settings
Enter fullscreen mode Exit fullscreen mode

Lastly, thanks so much to the New Relic team for always improving their products and providing an awesome service.


Original Link: https://dev.to/aws-heroes/using-new-relic-apm-with-rails-on-aws-lambda-51gi

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To