---
title: Ruby
description: Collect metrics, traces, and logs from your Ruby applications.
breadcrumbs: Docs > Integrations > Ruby
---

# Ruby

## Overview{% #overview %}

The Ruby integration allows you to collect and monitor your Ruby application logs, traces, and custom metrics.

## Setup{% #setup %}

### Metric collection{% #metric-collection %}

See the dedicated documentation for [collecting Ruby custom metrics with DogStatsD](https://docs.datadoghq.com/developers/dogstatsd/?tab=ruby).

### Trace collection{% #trace-collection %}

See the dedicated documentation for [instrumenting your Ruby application](https://docs.datadoghq.com/tracing/setup/ruby/) to send its traces to Datadog.

### Log collection{% #log-collection %}

*Available for Agent v6.0+*

See the dedicated documentation on how to [setup Ruby log collection](https://docs.datadoghq.com/logs/log_collection/ruby/) to forward your logs to Datadog.

### Profile collection{% #profile-collection %}

See the dedicated documentation for [enabling the Ruby profiler](https://docs.datadoghq.com/profiler/enabling/ruby/).

### App & API Protection (AAP){% #app--api-protection-aap %}

See the dedicated documentation for [securing your Ruby application](https://docs.datadoghq.com/security/application_security/setup/ruby/) to enable App & API Protection (AAP).

## Data Collected{% #data-collected %}

### Metrics{% #metrics %}

|  |
|  |
| **runtime.ruby.class\_count**(gauge)                                   | Total number of classes loaded*Shown as resource*                                                                            |
| **runtime.ruby.gc.remembered\_wb\_unprotected\_objects**(gauge)        | Number of write-barrier unprotected objects in the remembered set*Shown as resource*                                         |
| **runtime.ruby.gc.remembered\_wb\_unprotected\_objects\_limit**(gauge) | Limit on write-barrier unprotected objects allowed in the remembered set*Shown as resource*                                  |
| **runtime.ruby.gc.oldmalloc\_increase\_bytes**(gauge)                  | Total bytes allocated to old objects*Shown as byte*                                                                          |
| **runtime.ruby.gc.oldmalloc\_increase\_bytes\_limit**(gauge)           | Bytes limit that will trigger garbage collection of old objects*Shown as byte*                                               |
| **runtime.ruby.gc.malloc\_increase\_bytes**(gauge)                     | Total bytes allocated to objects*Shown as byte*                                                                              |
| **runtime.ruby.gc.malloc\_increase\_bytes\_limit**(gauge)              | Bytes limit that will trigger garbage collection of objects*Shown as byte*                                                   |
| **runtime.ruby.gc.total\_allocated\_objects**(gauge)                   | Total number of allocated objects over the lifetime of this process*Shown as resource*                                       |
| **runtime.ruby.gc.total\_freed\_objects**(gauge)                       | Total number of freed objects over the lifetime of this process*Shown as resource*                                           |
| **runtime.ruby.gc.total\_allocated\_pages**(gauge)                     | Total number of allocated pages over the lifetime of this process*Shown as page*                                             |
| **runtime.ruby.gc.total\_freed\_pages**(gauge)                         | Total number of freed pages over the lifetime of this process*Shown as page*                                                 |
| **runtime.ruby.gc.heap\_live\_slots**(gauge)                           | Number of live objects slots*Shown as resource*                                                                              |
| **runtime.ruby.gc.heap\_final\_slots**(gauge)                          | Number of object slots with finalizers attached to them*Shown as resource*                                                   |
| **runtime.ruby.gc.heap\_marked\_slots**(gauge)                         | Count of old objects which survived more than 3 GC cycles and number of write-barrier unprotected objects*Shown as resource* |
| **runtime.ruby.gc.heap\_available\_slots**(gauge)                      | Total number of slots in heap pages*Shown as resource*                                                                       |
| **runtime.ruby.gc.heap\_free\_slots**(gauge)                           | Number of free slots in heap pages*Shown as resource*                                                                        |
| **runtime.ruby.thread\_count**(gauge)                                  | Total number of threads*Shown as thread*                                                                                     |
| **runtime.ruby.gc.old\_objects**(gauge)                                | Total number of old objects*Shown as resource*                                                                               |
| **runtime.ruby.gc.old\_objects\_limit**(gauge)                         | Limit on number of old objects*Shown as resource*                                                                            |
| **runtime.ruby.global\_constant\_state**(gauge)                        | Global constant cache generation*Shown as event*                                                                             |
| **runtime.ruby.global\_method\_state**(gauge)                          | Global method cache generation*Shown as event*                                                                               |
| **runtime.ruby.constant\_cache\_invalidations**(gauge)                 | Constant cache invalidations*Shown as resource*                                                                              |
| **runtime.ruby.constant\_cache\_misses**(gauge)                        | Constant cache misses*Shown as resource*                                                                                     |

## Troubleshooting{% #troubleshooting %}

Need help? Contact [Datadog support](https://docs.datadoghq.com/help/).

## Further Reading{% #further-reading %}

- [Monitoring Rails applications with Datadog](https://www.datadoghq.com/blog/monitoring-rails-with-datadog/)
- [Collecting and monitoring Rails logs with Datadog](https://www.datadoghq.com/blog/managing-rails-logs-with-datadog/)
- [Managing and enhancing Rails application logs](https://www.datadoghq.com/blog/managing-rails-application-logs/)
