-
Notifications
You must be signed in to change notification settings - Fork 140
CBG-4714: collect goroutine stack traces on signal #7870
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
base: main
Are you sure you want to change the base?
Changes from 4 commits
ce80821
1beaae4
df92f51
033a788
2e41703
0ec5e51
ac7795c
201310a
8207199
e54a721
2c1bfeb
027cd4f
085e411
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -279,6 +279,25 @@ def make_http_client_pprof_tasks( | |||||
| return pprof_tasks | ||||||
|
|
||||||
|
|
||||||
| def make_http_client_stack_trace_task( | ||||||
| sg_url: str, auth_headers: dict[str, str] | ||||||
| ) -> PythonTask: | ||||||
| """ | ||||||
| This task uses the python http client to collect the raw stack trace data | ||||||
| """ | ||||||
| stack_trace_url = "{0}/_debug/stacktrace".format(sg_url) | ||||||
gregns1 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| stack_trace_task = make_curl_task( | ||||||
| name="Collect stack trace via http client", | ||||||
| auth_headers=auth_headers, | ||||||
| url=stack_trace_url, | ||||||
| log_file="sg_stack_trace.log", | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I don't care what we call this but sg_stack_trace.log will mean that this output overwrites the output from the signal handler, so it needs to be a different name. Basically this is just a plain text representation of pprof_goroutines.pb.gz so I think that would be a reasonable name.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will alter the name for all the files to make it goroutine specific but this doesn't overwrite the signal files, the signal files will have timestamp in the file name, sgcollect http call will not.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, that's fine then. |
||||||
| ) | ||||||
| stack_trace_task.no_header = True | ||||||
|
|
||||||
| return stack_trace_task | ||||||
|
|
||||||
|
|
||||||
| def to_lower_case_keys_dict(original_dict): | ||||||
| result = {} | ||||||
| for k, v in list(original_dict.items()): | ||||||
|
|
@@ -367,6 +386,7 @@ def make_collect_logs_tasks( | |||||
| "sg_debug.log": "sg_debug.log", | ||||||
| "sg_trace.log": "sg_trace.log", | ||||||
| "sg_stats.log": "sg_stats.log", | ||||||
| "sg_stack_trace.log": "sg_stack_trace.log", | ||||||
| "sync_gateway_access.log": "sync_gateway_access.log", | ||||||
| "sync_gateway_error.log": "sync_gateway_error.log", | ||||||
| "pprof.pb": "pprof.pb", | ||||||
|
|
@@ -761,6 +781,10 @@ def make_sg_tasks( | |||||
|
|
||||||
| http_client_pprof_tasks = make_http_client_pprof_tasks(sg_url, auth_headers) | ||||||
|
|
||||||
| http_client_stack_trace_task = make_http_client_stack_trace_task( | ||||||
| sg_url, auth_headers | ||||||
| ) | ||||||
|
|
||||||
| # Add a task to collect Sync Gateway config | ||||||
| config_tasks = make_config_tasks( | ||||||
| sg_config_path, sg_url, auth_headers, should_redact | ||||||
|
|
@@ -781,6 +805,7 @@ def make_sg_tasks( | |||||
| collect_logs_tasks, | ||||||
| py_expvar_task, | ||||||
| http_client_pprof_tasks, | ||||||
| http_client_stack_trace_task, | ||||||
| config_tasks, | ||||||
| status_tasks, | ||||||
| ] | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.