Testground
GitHubGo SDKInfra
master
master
  • README
  • Table of contents
    • What is Testground?
      • Community
    • Concepts and architecture
      • Test plans and test cases
      • Daemon and client
      • Synchronization service
      • Networking
      • Sidecar
      • Builders
      • Runners
      • Runtime environment (runenv)
      • Client-Server communication
    • Getting started
    • Writing test plans
      • Quick start
      • Understanding the test plan manifest
      • Parameters and test cases
      • Keeping instances in sync
      • Communication between instances
      • Observability, assets and metrics
    • Managing test plans
    • Running test plans
    • Traffic shaping
    • Analyzing test run results
      • Capturing profiles
    • Debugging test plans
    • Docker Settings
    • Featured projects
  • Runner library
    • local:exec
    • local:docker
      • System overview
      • Runner flags
      • Troubleshooting
    • cluster:k8s
      • System overview
      • How to create a Kubernetes cluster for Testground
      • Monitoring and Observability
      • Understanding Testground performance on Kubernetes
      • Troubleshooting
  • Builder Library
    • docker:go
    • exec:go
    • docker:generic
Powered by GitBook
On this page
  1. Table of contents
  2. Analyzing test run results

Capturing profiles

PreviousAnalyzing test run resultsNextDebugging test plans

Last updated 2 years ago

?> This feature was first made available in Testground v0.5.4 + sdk-go v0.2.8.

Profiling is a powerful way to understand how the code under test behaves under the hood. Different programming languages support different types of profiles. For example, Go supports these types:

  • CPU profiles.

  • Heaps and allocs profiles.

  • Goroutine, threads, mutex and block profiles.

Refer to the for more information.

Testground has first-class support for capturing profiles continuously throughout the test execution, and it's very versatile:

  • You can choose to profile all test run instances, or just a subset of them (per group).

  • You can choose which profile types to record.

  • You can set the sampling interval or frequency of capture for snapshot-type profiles (e.g. goroutine, heap, etc. profiles in go).

?> Success Because profiling is a language feature, Testground delegates the capture to the corresponding SDK by sending the profiling requirements for each instance inside the TEST_CAPTURE_PROFILES� env variable.

The profiles are written to the , and are available in the output bundle generated by testground collect or the testground run --collect flag.

Enabling profiles

You can enable profiles by setting the profiling settings under the run configuration.

To enable profiling globally

composition.toml

...

[global.run]
# this enables a continuous CPU profile, a heap profile every 5 seconds,
# and an allocs profile every 10 seconds.
profiles = { cpu = "true", heap = "5s", allocs = "10s" }

...

To enable profiling in a single group

composition.toml

...

[[groups]]
id = "low-latency"
[groups.run]
# same settings as above
profiles = { cpu = "true", heap = "5s", allocs = "10s" }

...
pprof package godocs
output path for each instance