Skip to content

server: allow on-demand goroutine dumps - #159352

Merged
craig[bot] merged 9 commits into
cockroachdb:masterfrom
tbg:gorodump-trigger
Jan 15, 2026
Merged

craig[bot] merged 9 commits into
cockroachdb:masterfrom
tbg:gorodump-trigger

Conversation

@tbg

@tbg tbg commented Dec 12, 2025

Copy link
Copy Markdown
Contributor

Enable programmatic, rate-limited goroutine dumps that KV can trigger on demand.

Move goroutine dumper construction out of env sampling so it can be shared. Add (*GoroutineDumper).DumpNow(ctx, reason) (reason logged, not in the filename), and plumb it down to KV via kvserver.StoreConfig.GoroutineDumpNow. Implement DumpNow to write a dump tagged on_demand while preserving the existing naming scheme, and gate requests via server.goroutine_dump.on_demand.min_interval (default 10s).

Closes #159342

Epic: none

@cockroach-teamcity

Copy link
Copy Markdown
Member

This change is Reviewable

@tbg tbg left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tbg made 1 comment.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @tbg).


-- commits line 7 at r1:
A later commit will make this the only way, so if it bothers you that there's two ways right now, know that it will resolve.

@tbg
tbg marked this pull request as ready for review January 9, 2026 11:34
@tbg
tbg requested review from a team as code owners January 9, 2026 11:34
@tbg
tbg requested review from a team, alyshanjahani-crl and angeladietz and removed request for a team January 9, 2026 11:34
tbg added 9 commits January 15, 2026 08:21
Move goroutine dumper creation out of startSampleEnvironment so it can be
shared with other subsystems.

Keep sampling/heuristic dumping behavior unchanged by allowing a pre-built
dumper to be passed in.
Add (*GoroutineDumper).DumpNow(ctx, reason) as a placeholder API for
future on-demand goroutine dumps.

This commit introduces the method signature only; it does not take dumps yet.
Add an optional StoreConfig callback for triggering on-demand goroutine
dumps.

Wire the server-owned goroutine dumper into store config when a goroutine
dump directory is configured.
Implement DumpNow to write a goroutine dump tagged on_demand while
keeping the existing filename schema unchanged.

Log the redactable reason and gate requests via
server.goroutine_dump.on_demand.min_interval (default 10s).
Both callers now pass it in, which is cleaner.
@angeladietz

Copy link
Copy Markdown
Contributor

bors r+

@craig

craig Bot commented Jan 15, 2026

Copy link
Copy Markdown
Contributor

@craig
craig Bot merged commit e614561 into cockroachdb:master Jan 15, 2026
23 checks passed
@tbg
tbg deleted the gorodump-trigger branch January 16, 2026 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

server: allow dumping goroutines via explicit trigger

4 participants