// snippets is an example of starting cloud.google.com/go/profiler.
package main
import (
"cloud.google.com/go/profiler"
)
func main() {
cfg := profiler.Config{
Service: "myservice",
ServiceVersion: "1.0.0",
// ProjectID must be set if not running on GCP.
// ProjectID: "my-project",
// For OpenCensus users:
// To see Profiler agent spans in APM backend,
// set EnableOCTelemetry to true
// EnableOCTelemetry: true,
}
// Profiler initialization, best done as early as possible.
if err := profiler.Start(cfg); err != nil {
// TODO: Handle error.
}
}
次のステップ
他の Google Cloud プロダクトに関連するコードサンプルの検索およびフィルタ検索を行うには、Google Cloud のサンプルをご覧ください。