forked from platformsh/platformsh-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ruby continuous profiling support (platformsh#4137)
Co-authored-by: Chad Carlson <[email protected]>
- Loading branch information
1 parent
4b8ad2f
commit cf59af0
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
sites/upsun/src/increase-observability/application-metrics/ruby.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
title: Continuous profiling for Ruby | ||
sidebarTitle: "Ruby continuous profiler" | ||
description: Configure and use the Ruby continuous profiler. | ||
weight: 30 | ||
--- | ||
|
||
{{< vendor/name >}} [Continuous Profiler](./cont-prof.md) is powered by [Blackfire](../../../increase-observability/application-metrics/blackfire.md). | ||
It is available directly the [Console](/administration/web/_index.md), under the **Profiling** tab of your environments. | ||
|
||
The Ruby continuous profiling is currently made across 3 dimensions: | ||
- **CPU Time**: Time spent running on the CPU | ||
- **Wall-time**: elapsed time per function call | ||
- **Allocations**: Time spent running on the CPU | ||
|
||
The default sampling frequency is 100 Hz. This means the Ruby continuous profiler is | ||
collecting information 100 times per second. | ||
|
||
## Prerequisites | ||
|
||
{{< vendor/name >}} Continuous Profiler requires [`Ruby >= 2.5`](/languages/ruby.md). | ||
|
||
## Installation | ||
|
||
1. Add the `datadog` gem to your `Gemfile` or `gems.rb` file: | ||
|
||
``` bash | ||
gem 'datadog', '~> 2.0' | ||
``` | ||
|
||
2. Install the gems running the `bundle install` command. | ||
|
||
3. Add the ``ddprofrb exec`` command to your Ruby application start command: | ||
|
||
``` bash | ||
bundle exec ddprofrb exec ruby myrubyapp.rb | ||
``` | ||
|
||
Rails example: | ||
``` bash | ||
bundle exec ddprofrb exec bin/rails s | ||
``` | ||
|
||
Alternatively, start the profiler by adding the following code in your application's entry point if you can't start it using `ddprofrb exec`: | ||
|
||
``` bash | ||
require 'datadog/profiling/preload' | ||
``` |