- はじめに
- エージェント
- インテグレーション
- Watchdog
- イベント
- ダッシュボード
- モバイルアプリケーション
- インフラストラクチャー
- サーバーレス
- メトリクス
- ノートブック
- アラート設定
- APM & Continuous Profiler
- CI Visibility
- RUM & セッションリプレイ
- データベース モニタリング
- ログ管理
- セキュリティプラットフォーム
- Synthetic モニタリング
- ネットワークモニタリング
- 開発者
- API
- アカウントの管理
- データセキュリティ
- ヘルプ
Go ランタイムメトリクスの収集を有効にするには、WithRuntimeMetrics
オプションを使用してトレーサーを起動します。
tracer.Start(tracer.WithRuntimeMetrics())
Datadog のサービス詳細画面でランタイムメトリクスを Go サービスと相関して表示します。
デフォルトでは、アプリケーションからのランタイムメトリクスは、DogStatsD で Datadog Agent に 10 秒ごとに送信されます。Agent で DogStatsD が有効になっていることを確認してください。Datadog Agent の DogStatsD のアドレスがデフォルトの localhost:8125
と異なる場合は、WithDogstatsdAddress
オプション (1.18.0 以降で使用可能) か環境変数 DD_AGENT_HOST
と DD_DOGSTATSD_PORT
を使用するようにしてください。
WithDogstatsdAddress
が使われていない場合、トレーサーは以下のルールに従って statsd サービスのアドレスを決定しようとします。
/var/run/datadog/dsd.socket
を探し、存在すればそれを使用します。ない場合は、#2 へ進みます。DD_AGENT_HOST
によって決定され、デフォルトは “localhost” です。DD_DOGSTATSD_PORT
によって決定され、デフォルトは 8125
です。Agent をコンテナとして実行している場合は、DD_DOGSTATSD_NON_LOCAL_TRAFFIC
が true
に設定されていることと、Agent コンテナでポート 8125
が開いていることを確認してください。また、Kubernetes または ECS の場合は、以下のガイドラインに従ってください。
以下のメトリクスは Go メトリクスを有効にした後、デフォルトで収集されます。
runtime.go.num_cpu (gauge) | CPUs detected by the runtime. Shown as resource |
runtime.go.num_goroutine (gauge) | goroutines spawned. Shown as invocation |
runtime.go.num_cgo_call (gauge) | CGO calls made. Shown as invocation |
runtime.go.mem_stats.alloc (gauge) | Alloc is bytes of allocated heap objects. Shown as bytes |
runtime.go.mem_stats.total_alloc (gauge) | TotalAlloc is cumulative bytes allocated for heap objects. Shown as bytes |
runtime.go.mem_stats.sys (gauge) | Sys is the total bytes of memory obtained from the OS. Shown as bytes |
runtime.go.mem_stats.lookups (gauge) | Lookups is the number of pointer lookups performed by the Shown as unit |
runtime.go.mem_stats.mallocs (gauge) | Mallocs is the cumulative count of heap objects allocated. Shown as unit |
runtime.go.mem_stats.frees (gauge) | Frees is the cumulative count of heap objects freed. Shown as unit |
runtime.go.mem_stats.heap_alloc (gauge) | HeapAlloc is bytes of allocated heap objects. Shown as bytes |
runtime.go.mem_stats.heap_sys (gauge) | HeapSys is bytes of heap memory obtained from the OS. Shown as bytes |
runtime.go.mem_stats.heap_idle (gauge) | HeapIdle is bytes in idle (unused) spans. Shown as bytes |
runtime.go.mem_stats.heap_inuse (gauge) | HeapInuse is bytes in in-use spans. Shown as bytes |
runtime.go.mem_stats.heap_released (gauge) | HeapReleased is bytes of physical memory returned to the OS. Shown as bytes |
runtime.go.mem_stats.heap_objects (gauge) | HeapObjects is the number of allocated heap objects. Shown as unit |
runtime.go.mem_stats.stack_inuse (gauge) | StackInuse is bytes in stack spans. Shown as bytes |
runtime.go.mem_stats.stack_sys (gauge) | StackSys is bytes of stack memory obtained from the OS. Shown as bytes |
runtime.go.mem_stats.m_span_inuse (gauge) | MSpanInuse is bytes of allocated mspan structures. Shown as bytes |
runtime.go.mem_stats.m_span_sys (gauge) | MSpanSys is bytes of memory obtained from the OS for mspan structures. Shown as bytes |
runtime.go.mem_stats.m_cache_inuse (gauge) | MCacheInuse is bytes of allocated mcache structures. Shown as bytes |
runtime.go.mem_stats.m_cache_sys (gauge) | MCacheSys is bytes of memory obtained from the OS for Shown as bytes |
runtime.go.mem_stats.buck_hash_sys (gauge) | BuckHashSys is bytes of memory in profiling bucket hash tables. Shown as bytes |
runtime.go.mem_stats.gc_sys (gauge) | GCSys is bytes of memory in garbage collection metadata. Shown as bytes |
runtime.go.mem_stats.other_sys (gauge) | OtherSys is bytes of memory in miscellaneous off-heap Shown as bytes |
runtime.go.mem_stats.next_gc (gauge) | NextGC is the target heap size of the next GC cycle. Shown as bytes |
runtime.go.mem_stats.last_gc (gauge) | LastGC is the time the last garbage collection finished, as nanoseconds since 1970 (the UNIX epoch). Shown as ns |
runtime.go.mem_stats.pause_total_ns (gauge) | PauseTotalNs is the cumulative nanoseconds in GC Shown as ns |
runtime.go.mem_stats.num_gc (gauge) | NumGC is the number of completed GC cycles. Shown as unit |
runtime.go.mem_stats.num_forced_gc (gauge) | NumForcedGC is the number of GC cycles that were forced by the application calling the GC function. Shown as unit |
runtime.go.mem_stats.gc_cpu_fraction (gauge) | GCCPUFraction is the fraction of this program's available CPU time used by the GC since the program started. Shown as float |
runtime.go.gc_stats.pause_quantiles.min (gauge) | Distribution of GC pause times: minimum values Shown as ns |
runtime.go.gc_stats.pause_quantiles.25p (gauge) | Distribution of GC pause times: 25th percentile Shown as ns |
runtime.go.gc_stats.pause_quantiles.75p (gauge) | Distribution of GC pause times: 50th percentile Shown as ns |
runtime.go.gc_stats.pause_quantiles.95p (gauge) | Distribution of GC pause times: 75th percentile Shown as ns |
runtime.go.gc_stats.pause_quantiles.max (gauge) | Distribution of GC pause times: maximum values Shown as ns |
APM サービス詳細画面にこれらのメトリクスを表示するだけでなく、Datadog はデフォルトの Go ランタイムダッシュボードを提供します。