-
Notifications
You must be signed in to change notification settings - Fork 472
DOC-14292 Product Change- PR #149705 - release-25.3: tracing: add background execution tracer (+ debug zip export) #19935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
florence-crl
wants to merge
1
commit into
main
Choose a base branch
from
DOC-14292
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
title: Automatic Go Execution Tracer | ||
summary: The automatic Go execution tracer can be used to gain fine-grained insight into goroutine scheduling, blocking events, garbage collection, and runtime activity. | ||
keywords: go execution trace, go execution tracing, execution tracer, automatic execution tracer | ||
toc: true | ||
--- | ||
|
||
The automatic Go execution tracer allows operators and support engineers to investigate internal system behavior over time. Use this feature to gain fine-grained insight into goroutine scheduling, blocking events, garbage collection, and runtime activity. | ||
|
||
{{site.data.alerts.callout_info}} | ||
Execution tracing introduces a performance overhead. This feature is primarily intended for use under the guidance of [Cockroach Labs Support](https://support.cockroachlabs.com/). | ||
{{site.data.alerts.end}} | ||
|
||
When enabled, the automatic Go execution tracer captures runtime execution traces on a recurring schedule and stores them in the node's log directory. These traces are collected in the background and can be analyzed using Go’s standard tooling (e.g., [`go tool trace`](https://pkg.go.dev/runtime/trace)). | ||
|
||
To prevent disk overuse, older traces are automatically garbage collected based on a configurable storage limit. | ||
|
||
## Configuration | ||
|
||
You can configure automatic Go execution trace capture with the following [cluster settings]({% link {{ page.version.version }}/cluster-settings.md %}): | ||
|
||
Cluster Setting | Description | Default Value | ||
----------------|-------------|--------------- | ||
`obs.execution_tracer.interval` | Enables periodic execution tracing on each node and defines how often traces are collected. Set to a positive duration (e.g., `10m`, `1h`) to enable. Set to `0` to disable (default). | `0` | ||
`obs.execution_tracer.duration` | Sets how long each execution trace runs. Use short durations (e.g., 5-15 seconds) to produce traces that are easier to analyze. | `10s` | ||
`obs.execution_tracer.total_dump_size_limit` | Sets a soft limit on the total disk space used by execution trace files. When the limit is exceeded, the oldest files are deleted. | `4GiB` | ||
|
||
## Accessing Go execution traces | ||
|
||
- The automatic Go execution tracer saves the captured traces to disk on each node's file system in the [logging directory]({% link {{ page.version.version }}/configure-logs.md %}#logging-directory). The default path is `cockroach-data/logs/executiontrace_dump`. | ||
- To access these Go execution traces, you must use the node file system. | ||
- Each file represents a single trace session, includes the `executiontrace.` prefix and `.out` extension, and is timestamped to support correlation with other logs and profiles. For example, the trace file could be named `executiontrace.2025-07-14T18_41_22.216.out`. | ||
- Enabling the automatic Go execution tracer does add Go execution traces to [debug zips]({% link {{ page.version.version }}/cockroach-debug-zip.md %}) in the `nodes/*/executiontrace` paths. | ||
|
||
## Best Practices | ||
|
||
- Trace duration should be short (e.g., 5s–15s). Shorter trace files are easier to parse and load into external tools. | ||
- Storage limit should be generous to allow sufficient trace history. Avoid overly tight disk caps unless necessary. | ||
- Enable tracing temporarily when troubleshooting runtime behavior or under support guidance, as it may slightly impact performance. | ||
|
||
## Performance Impact | ||
|
||
Enabling execution tracing incurs a low overhead, estimated at 1–2% based on upstream Go benchmarks ([Go blog, 2024](https://go.dev/blog/execution-traces-2024#low-overhead-tracing)). No additional CockroachDB-specific benchmarks are available at this time. | ||
|
||
## Example | ||
|
||
To enable 10-second traces every 15 minutes with a storage limit of `8GiB`, configure the following settings: | ||
|
||
```sql | ||
SET CLUSTER SETTING obs.execution_tracer.interval = '15m'; | ||
SET CLUSTER SETTING obs.execution_tracer.duration = '10s'; | ||
SET CLUSTER SETTING obs.execution_tracer.total_dump_size_limit = '8GiB'; | ||
``` | ||
|
||
## See also | ||
|
||
- [Automatic CPU Profiler]({% link {{ page.version.version }}/automatic-cpu-profiler.md %}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this timestamp the time the session started or ended?