![]() From here click on the Rails icon and pick a name for your integration (using the name of your Rails application is a good choice). Start by logging in to your Librato account and navigating to the Integrations page. There are a number of ways to do this, but let’s see what it would look like if you use Librato. We’ve considered some of the data that we would like to measure and the strategies you can use for collecting those measurements-now the question is, what to do with this data you’ve collected? At the very least, you’re going to want some way to visualize your metrics so that you can more easily see trends and/or anomalies over time. If you’d like to learn more about the ActiveSupport instrumentation API, there is a presentation titled Digging Deep With ActiveSupport::Notifications you may want to check out. Elapsed time for executing database queriesĪs you can see, almost all of the must-collect metrics we identified above are delivered to us as part of this one event.Response format (html, json, xml, etc…).For example, the process_action.action_controller event provides all of the following data: In addition to the standard event data above, different events can provide a custom, event-specific payload. Name of the exception class and the exception message (if an error occurs during the event).With each of these events Rails delivers all sorts of useful data (as part of the args passed to your callback): As a trivial example you might do something like this: class ApplicationController < ActionController::Base In fact, if you configure a filter in the ApplicationController it will be run on every action in your application. ![]() Rails has great support for filters which allow you to run custom code before, after or “around” any controller action. Obviously, this doesn’t even begin to cover all the things that you could measure, but it’s a good start and should give you a sense for the general health of your application. With a list of the things we want to measure in hand, the next question is: how do we measure them? How to Measure Much like the error count, a spike in 4xx or 5xx status codes may signal a problem in your application environment. Status Code Counts – Count of requests that resulted in the different HTTP status codes.This indicates that there may be problems with your infrastructure or the application itself. Error Count – Total number of errors raised that aren’t being handled by your application.This is a common cause of hidden latency in your application’s overall response time. Queueing Time – Time a request spends between the app server and the Rails process.Hopefully, this is a small portion of the request time (you don’t have any business logic in your views, right?) Template Rendering Time – Amount of the total request time spent rendering the view.Along with the database time, this likely accounts for a large chunk of your total request time. Service Time – Amount of the total request time spent interacting with external services.This can help you identify problematic queries. Database Time – Amount of the total request time spent interacting with the database.This will be a good indication of how the performance of your application performance may be affecting user experience. Total Request Time – Elapsed time between the request reaching the Rails app and a response being returned.This is useful as a general measure of site traffic. Request Count – Total number of requests handled by the Rails app.Some of the things we might want to measure: Let’s walk through some of the things to consider when trying to instrument your own application. In the process, we’ve learned a lot about getting metrics out of a Rails application. As you can probably imagine, we’ve put a lot of effort into instrumenting these applications so that we can keep a close watch on all aspects of their performance. Many of our user-facing web applications are built on top of the Ruby on Rails framework. Learn more about monitoring rails using AppOptics. Note: This article was originally published on Librato, which has since been merged with SolarWinds ® AppOptics ™.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |