- はじめに
- エージェント
- インテグレーション
- Watchdog
- イベント
- ダッシュボード
- モバイルアプリケーション
- インフラストラクチャー
- サーバーレス
- メトリクス
- ノートブック
- アラート設定
- APM & Continuous Profiler
- CI Visibility
- RUM & セッションリプレイ
- データベース モニタリング
- ログ管理
- セキュリティプラットフォーム
- Synthetic モニタリング
- ネットワークモニタリング
- 開発者
- API
- アカウントの管理
- データセキュリティ
- ヘルプ
The profiler is shipped within Datadog tracing libraries. If you are already using APM to collect traces for your application, you can skip installing the library and go directly to enabling the profiler.
The Datadog Profiler requires Go 1.12+.
Continuous Profiler is not supported on serverless platforms, such as AWS Lambda.
To begin profiling applications:
If you are already using Datadog, upgrade your agent to version 7.20.2+ or 6.20.2+.
Get dd-trace-go
using the command:
go get gopkg.in/DataDog/dd-trace-go.v1/profiler
Note: Profiler is available in the dd-trace-go
library for versions 1.23.0+.
Import the profiler at the start of your application:
import "gopkg.in/DataDog/dd-trace-go.v1/profiler"
Add the following snippet to start the profiler:
err := profiler.Start(
profiler.WithService("<SERVICE_NAME>"),
profiler.WithEnv("<ENVIRONMENT>"),
profiler.WithVersion("<APPLICATION_VERSION>"),
profiler.WithTags("<KEY1>:<VALUE1>,<KEY2>:<VALUE2>"),
profiler.WithProfileTypes(
profiler.CPUProfile,
profiler.HeapProfile,
// The profiles below are disabled by default to keep overhead
// low, but can be enabled as needed.
// profiler.BlockProfile,
// profiler.MutexProfile,
// profiler.GoroutineProfile,
),
)
if err != nil {
log.Fatal(err)
}
defer profiler.Stop()
After a minute or two, visualize your profiles in the Datadog APM > Profiler page.
Note: By default only the CPU and Heap profile are enabled. Use profiler.WithProfileTypes to enable additional profile types.
You can set profiler parameters in code with these functions:
Function | Type | Description |
---|---|---|
WithService | String | The Datadog service name, for example my-web-app . |
WithEnv | String | The Datadog environment name, for example, production . |
WithVersion | String | The version of your application. |
WithTags | String | The tags to apply to an uploaded profile. Must be a list of in the format <KEY1>:<VALUE1>,<KEY2>:<VALUE2> . |
Alternatively you can set profiler configuration using environment variables:
Environment variable | Type | Description |
---|---|---|
DD_ENV | String | The environment name, for example: production . |
DD_SERVICE | String | The service name, for example, web-backend . |
DD_VERSION | String | The version of your service. |
DD_TAGS | String | Tags to apply to an uploaded profile. Must be a list of <key>:<value> separated by commas such as: layer:api,team:intake . |
The Getting Started with Profiler guide takes a sample service with a performance problem and shows you how to use Continuous Profiler to understand and fix the problem.