consul/command
Dhia Ayachi d24156db14 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 17:12:54 +00:00
..
acl add tailing backtick 2020-10-07 07:14:56 +08:00
agent Merge pull request #10338 from hashicorp/dnephin/fix-logging-indent 2021-06-03 13:26:03 -04:00
catalog Convert the remaining calls to NewTestAgentWithFields 2020-03-31 17:14:55 -04:00
cli Merge pull request #10338 from hashicorp/dnephin/fix-logging-indent 2021-06-03 13:26:03 -04:00
config connect: support defining intentions using layer 7 criteria (#8839) 2020-10-06 17:09:13 -05:00
connect Merge pull request #10324 from hashicorp/dnephin/fix-envoy-bootstrap-exec 2021-06-01 17:03:30 +00:00
debug generate a single debug file for a long duration capture (#10279) 2021-06-07 17:12:54 +00: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 ci: update to Go 1.15.4 and alpine:3.12 (#9036) 2020-11-13 18:03:37 +00: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 #9570 from hashicorp/bugfix/9498 2021-01-19 21:30:47 +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 20:04:20 +02:00
kv testing: use t.Cleanup in testutil.TempFile 2020-08-14 20:06:01 -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 Give descriptive error if auth method not found (#10163) 2021-05-03 20:39:55 +00:00
logout testing: Remove all the defer os.Removeall 2020-08-14 19:58:53 -04:00
maint remove nodeName call when using -service 2020-09-23 10:45:16 +02: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:32 +00:00
operator Add a CLI command for retrieving the autopilot configuration. (#9142) 2020-11-11 18:19:32 +00:00
reload Implement Client Agent Auto Config 2020-06-17 16:49:46 -04:00
rtt Remove name from NewTestAgent 2020-03-31 16:13:44 -04:00
services testing: use t.Cleanup in testutil.TempFile 2020-08-14 20:06:01 -04:00
snapshot Fix panic bug in snapshot inspect (#10091) (#10108) 2021-04-23 21:29:06 +01:00
tls introduce certopts (#9606) 2021-03-22 09:17:19 +00:00
validate testing: use t.Cleanup in testutil.TempFile 2020-08-14 20:06:01 -04:00
version add v to version pretty formatter (#8341) 2020-07-20 17:43:10 -04:00
watch testing: Remove all the defer os.Removeall 2020-08-14 19:58:53 -04:00
commands_oss.go Merge pull request #10338 from hashicorp/dnephin/fix-logging-indent 2021-06-03 13:26:03 -04:00
registry.go Merge pull request #10338 from hashicorp/dnephin/fix-logging-indent 2021-06-03 13:26:03 -04:00