Skip to content

Instantly share code, notes, and snippets.

@ngtuna
Created February 7, 2022 03:48
Show Gist options
  • Save ngtuna/658b2934b7a0ab21f0ec7bb344c4a5bc to your computer and use it in GitHub Desktop.
Save ngtuna/658b2934b7a0ab21f0ec7bb344c4a5bc to your computer and use it in GitHub Desktop.
func main() {
tracer.Start(
tracer.WithEnv(os.Getenv("DD_ENV")),
tracer.WithService(os.Getenv("DD_SERVICE")),
tracer.WithServiceVersion(os.Getenv("DD_VERSION")),
)
defer tracer.Stop()
if err := profiler.Start(
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,
),
); err != nil {
log.Fatal(err)
}
defer profiler.Stop()
//my app logic starts here.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment