open-consul/command
Dhia Ayachi e3dd0f9a44
generate a single debug file for a long duration capture (#10279)
* 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>
2021-06-07 13:00:51 -04:00
..
acl testing: skip slow tests with -short 2020-12-07 13:42:55 -05:00
agent cmd: remove unnecessary GatedUi 2021-06-02 17:33:20 -04:00
catalog testing: skip slow tests with -short 2020-12-07 13:42:55 -05:00
cli cmd: introduce a shim to expose Stdout/Stderr writers 2021-06-02 16:51:34 -04:00
config config-entry: use custom MarshalJSON for mesh type 2021-04-29 17:49:43 -04:00
connect envoy: improve comments 2021-06-01 11:35:32 -04:00
debug generate a single debug file for a long duration capture (#10279) 2021-06-07 13:00:51 -04:00
event testing: skip slow tests with -short 2020-12-07 13:42:55 -05:00
exec testing: skip slow tests with -short 2020-12-07 13:42:55 -05:00
flags ci: update to Go 1.15.4 and alpine:3.12 (#9036) 2020-11-13 13:02:59 -05:00
forceleave testing: skip slow tests with -short 2020-12-07 13:42:55 -05:00
helpers Centralized Config CLI (#5731) 2019-04-30 16:27:16 -07:00
info testing: skip slow tests with -short 2020-12-07 13:42:55 -05:00
intention Fix flaky CLI Intention Listing Test 2021-01-19 15:27:49 -05:00
join testing: skip slow tests with -short 2020-12-07 13:42:55 -05:00
keygen Update default gossip encryption key size to 32 bytes 2019-07-30 09:45:41 -06:00
keyring testing: skip slow tests with -short 2020-12-07 13:42:55 -05:00
kv command/kv: Add prefix option to kv import command 2021-02-19 14:07:25 +03:00
leave testing: skip slow tests with -short 2020-12-07 13:42:55 -05:00
lock testing: skip slow tests with -short 2020-12-07 13:42:55 -05:00
login Give descriptive error if auth method not found (#10163) 2021-05-03 13:39:13 -07:00
logout testing: skip slow tests with -short 2020-12-07 13:42:55 -05:00
maint agent: move deprecated AddServiceFromSource to a test file 2021-01-25 17:25:03 -05:00
members testing: skip slow tests with -short 2020-12-07 13:42:55 -05:00
monitor fix monitor to only start the monitor in json format when requested (#10358) 2021-06-07 12:08:48 -04:00
operator testing: skip slow tests with -short 2020-12-07 13:42:55 -05:00
reload testing: skip slow tests with -short 2020-12-07 13:42:55 -05:00
rtt testing: skip slow tests with -short 2020-12-07 13:42:55 -05:00
services make tests use a dummy node_name to avoid environment related failures (#10262) 2021-06-01 11:58:03 -04:00
snapshot Fix panic bug in snapshot inspect (#10091) 2021-04-23 20:48:10 +01:00
tls introduce certopts (#9606) 2021-03-22 10:16:41 +01:00
validate config: replace calls to config.NewBuilder with config.Load 2021-01-27 17:34:43 -05:00
version add v to version pretty formatter (#8341) 2020-07-20 17:43:10 -04:00
watch testing: skip slow tests with -short 2020-12-07 13:42:55 -05:00
commands_oss.go cmd: introduce a shim to expose Stdout/Stderr writers 2021-06-02 16:51:34 -04:00
registry.go cmd: introduce a shim to expose Stdout/Stderr writers 2021-06-02 16:51:34 -04:00