consul/command
Dhia Ayachi 9e4d7a3d26
generate a single debug file for a long duration capture (#10279) (#10360)
* debug: remove the CLI check for debug_enabled

The API allows collecting profiles even debug_enabled=false as long as
ACLs are enabled. Remove this check from the CLI so that users do not
need to set debug_enabled=true for no reason.

Also:
- fix the API client to return errors on non-200 status codes for debug
  endpoints
- improve the failure messages when pprof data can not be collected

Co-Authored-By: Dhia Ayachi <dhia@hashicorp.com>

* remove parallel test runs

parallel runs create a race condition that fail the debug tests

* snapshot the timestamp at the beginning of the capture

- timestamp used to create the capture sub folder is snapshot only at the beginning of the capture and reused for subsequent captures
- capture append to the file if it already exist

* Revert "snapshot the timestamp at the beginning of the capture"

This reverts commit c2d03346

* Refactor captureDynamic to extract capture logic for each item in a different func

* snapshot the timestamp at the beginning of the capture

- timestamp used to create the capture sub folder is snapshot only at the beginning of the capture and reused for subsequent captures
- capture append to the file if it already exist

* Revert "snapshot the timestamp at the beginning of the capture"

This reverts commit c2d03346

* Refactor captureDynamic to extract capture logic for each item in a different func

* extract wait group outside the go routine to avoid a race condition

* capture pprof in a separate go routine

* perform a single capture for pprof data for the whole duration

* add missing vendor dependency

* add a change log and fix documentation to reflect the change

* create function for timestamp dir creation and simplify error handling

* use error groups and ticker to simplify interval capture loop

* Logs, profile and traces are captured for the full duration. Metrics, Heap and Go routines are captured every interval

* refactor Logs capture routine and add log capture specific test

* improve error reporting when log test fail

* change test duration to 1s

* make time parsing in log line more robust

* refactor log time format in a const

* test on log line empty the earliest possible and return

Co-authored-by: Freddy <freddygv@users.noreply.github.com>

* rename function to captureShortLived

* more specific changelog

Co-authored-by: Paul Banks <banks@banksco.de>

* update documentation to reflect current implementation

* add test for behavior when invalid param is passed to the command

* fix argument line in test

* a more detailed description of the new behaviour

Co-authored-by: Paul Banks <banks@banksco.de>

* print success right after the capture is done

* remove an unnecessary error check

Co-authored-by: Daniel Nephin <dnephin@hashicorp.com>

* upgraded github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57 => v0.0.0-20210601050228-01bbb1931b22

Co-authored-by: Daniel Nephin <dnephin@hashicorp.com>
Co-authored-by: Freddy <freddygv@users.noreply.github.com>
Co-authored-by: Paul Banks <banks@banksco.de>

Co-authored-by: Daniel Nephin <dnephin@hashicorp.com>
Co-authored-by: Freddy <freddygv@users.noreply.github.com>
Co-authored-by: Paul Banks <banks@banksco.de>
2021-06-07 15:51:57 -04:00
..
acl doc: Update acl-method command example (#8845) 2020-10-09 19:26:54 +00:00
agent Merge pull request #10345 from hashicorp/dnephin/backport-logging-fix 2021-06-03 18:43:21 +00:00
catalog Convert the remaining calls to NewTestAgentWithFields 2020-03-31 17:14:55 -04:00
cli Merge pull request #10345 from hashicorp/dnephin/backport-logging-fix 2021-06-03 18:43:21 +00:00
config connect: all config entries pick up a meta field (#8596) 2020-09-02 19:22:37 +00:00
connect Merge pull request #10324 from hashicorp/dnephin/fix-envoy-bootstrap-exec 2021-06-01 14:15:45 -04:00
debug generate a single debug file for a long duration capture (#10279) (#10360) 2021-06-07 15:51:57 -04:00
event Remove name from NewTestAgent 2020-03-31 16:13:44 -04:00
exec Remove name from NewTestAgent 2020-03-31 16:13:44 -04:00
flags Merge pull request #8169 from hashicorp/config-entry-ns 2020-06-23 11:44:57 -06:00
forceleave Convert the remaining calls to NewTestAgentWithFields 2020-03-31 17:14:55 -04:00
helpers Centralized Config CLI (#5731) 2019-04-30 16:27:16 -07:00
info Remove name from NewTestAgent 2020-03-31 16:13:44 -04:00
intention Merge pull request #8040 from hashicorp/ingress/expose-cli 2020-06-09 19:11:51 +00:00
join Remove name from NewTestAgent 2020-03-31 16:13:44 -04:00
keygen Update default gossip encryption key size to 32 bytes 2019-07-30 09:45:41 -06:00
keyring add -list-primary to `consul keyring` command (#8692) 2020-09-24 18:04:57 +00:00
kv Add unconvert linter 2020-05-12 13:47:25 -04:00
leave Remove name from NewTestAgent 2020-03-31 16:13:44 -04:00
lock Remove name from NewTestAgent 2020-03-31 16:13:44 -04:00
login acl: add auth method for JWTs (#7846) 2020-05-11 20:59:29 -05:00
logout Remove name from NewTestAgent 2020-03-31 16:13:44 -04:00
maint Merge pull request #8735 from ncode/master 2020-09-24 17:31:45 +00:00
members Convert the remaining calls to NewTestAgentWithFields 2020-03-31 17:14:55 -04:00
monitor fix monitor to only start the monitor in json format when requested (#10358) 2021-06-07 16:09:40 +00:00
operator Convert the remaining calls to NewTestAgentWithFields 2020-03-31 17:14:55 -04:00
reload Merge pull request #8086 from hashicorp/feature/auto-config/client-config-inject 2020-06-18 14:45:52 +00:00
rtt Remove name from NewTestAgent 2020-03-31 16:13:44 -04:00
services Merge pull request #7762 from hashicorp/dnephin/warn-on-unknown-service-file 2020-06-17 15:21:34 -04:00
snapshot fix some flaky snapshot tests (#8015) 2020-06-03 19:19:36 +00:00
tls introduce certopts (#9606) 2021-03-22 09:17:23 +00:00
validate Merge pull request #7762 from hashicorp/dnephin/warn-on-unknown-service-file 2020-06-17 15:21:34 -04:00
version add v to version pretty formatter (#8341) 2020-07-20 21:45:57 +00:00
watch Remove name from NewTestAgent 2020-03-31 16:13:44 -04:00
commands_oss.go Merge pull request #10345 from hashicorp/dnephin/backport-logging-fix 2021-06-03 18:43:21 +00:00
registry.go Merge pull request #10345 from hashicorp/dnephin/backport-logging-fix 2021-06-03 18:43:21 +00:00