- 重要な情報
- はじめに
- 用語集
- ガイド
- エージェント
- インテグレーション
- OpenTelemetry
- 開発者
- API
- CoScreen
- アプリ内
- Service Management
- インフラストラクチャー
- アプリケーションパフォーマンス
- 継続的インテグレーション
- ログ管理
- セキュリティ
- UX モニタリング
- 管理
ランタイムメトリクスの収集は dogstatsd-ruby
gemを使用し、DogStatsD を介して Agent にメトリクスを送信します。ランタイムメトリクスを収集するには、この gem を Ruby アプリケーションに追加し、DogStatsD が Agent に対して有効になっていることを確認する必要があります。
メトリクス収集は初期設定では無効になっています。DD_RUNTIME_METRICS_ENABLED
環境変数を true
に設定するか、Ruby アプリケーションで次のコンフィギュレーションを行うと有効にできます。
# config/initializers/datadog.rb
require 'datadog/statsd'
require 'ddtrace'
Datadog.configure do |c|
# ランタイムメトリクス収集を有効にするには、`true` を設定します。デフォルトは `false` です。
# DD_RUNTIME_METRICS_ENABLED=true に設定して構成することもできます。
c.runtime_metrics.enabled = true
# 必要に応じて、ランタイムメトリクスの送信に使用される DogStatsD インスタンスを構成できます。
# `dogstatsd-ruby` が利用可能な場合、DogStatsD は自動的にデフォルト設定になります。
# Datadog Agent のホストとポートを使用して構成できます。デフォルトは 'localhost:8125' です。
c.runtime_metrics.statsd = Datadog::Statsd.new
end
ランタイムメトリクスは、Ruby サービスと相関して表示できます。Datadog のサービス詳細画面を参照してください。
初期設定では、アプリケーションからのランタイムメトリクスは DogStatsD のポート 8125
から Datadog Agent に送信されます。DogStatsD が Agent に対して有効になっていることを確認してください。
Agent をコンテナとして実行している場合は、DD_DOGSTATSD_NON_LOCAL_TRAFFIC
が true に設定されていること、また Agent 上でポート 8125
が開いていることを確認してください。
Kubernetes では、DogstatsD ポートをホストポートにバインドし、ECS ではタスク定義で適切なフラグを設定します。
以下のメトリクスはランタイムメトリクスを有効にした後、デフォルトで収集されます。
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 generation |
runtime.ruby.global_method_state (gauge) | Global method cache generation Shown as generation |
runtime.ruby.constant_cache_invalidations (gauge) | Constant cache invalidations Shown as resource |
runtime.ruby.constant_cache_misses (gauge) | Constant cache misses Shown as resource |
APM サービス詳細画面にこれらのメトリクスを表示するだけでなく、Datadog はデフォルトの Ruby ランタイムダッシュボードを提供します。