syncthing/lib/config
Jakob Borg ffe7a2fcd7 cmd/syncthing, lib/config: Enable HTTP CPU/heap profile collection for users
This adds a config to enable debug functions on the API server, which is
by default disabled. When enabled, the /rest/debug things become
available and become available without requiring a CSRF token (although
authentication is required if configured).

We also add a new endpoint /rest/debug/cpuprof?duration=15s (with the
duration being configurable, defaulting to 30s). This runs a CPU profile
for the duration and returns it as a file. It sets headers so that a
browser will save the file with an informative name.

The same is done for heap profiles, /rest/debug/heapprof, which does not
take any parameters.

The purpose of this is that any user can enable debugging under
advanced, then point their browser to the endpoint above and get a file
that contains a CPU or heap profile we can use, with the filename
telling us what version and architecture the profile is from.

On the command line, this becomes

    curl -O -J http://localhost:8082/rest/debug/cpuprof?duration=5s
    curl: Saved to filename
    'syncthing-cpu-darwin-amd64-v0.14.3+4-g935bcc0-110307.pprof'

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3467
2016-08-02 11:06:45 +00:00
..
testdata lib/config: Remove "Invalid" attribute (fixes #2471) 2016-07-02 19:38:39 +00:00
commit_test.go lib/config, cmd/syncthing: Handle committing configuration better (fixes #3077) 2016-07-04 20:32:34 +00:00
config_test.go cmd, lib: Fix ineffectual assignments (ineffasign) and comment spelling 2016-07-15 14:23:20 +00:00
config.go gui: Add one-off notifications that need to be acked 2016-08-02 08:07:30 +00:00
debug.go Implement facility based logger, debugging via REST API 2015-10-03 18:09:53 +02:00
deviceconfiguration.go Use constructor functions for FolderConfiguration and DeviceConfiguration 2015-11-07 09:50:04 +01:00
folderconfiguration.go lib/config: Remove "Invalid" attribute (fixes #2471) 2016-07-02 19:38:39 +00:00
foldertype.go lib/config: Change folder type attribute to a FolderType type 2016-05-04 11:26:36 +00:00
guiconfiguration.go cmd/syncthing, lib/config: Enable HTTP CPU/heap profile collection for users 2016-08-02 11:06:45 +00:00
optionsconfiguration.go gui: Add one-off notifications that need to be acked 2016-08-02 08:07:30 +00:00
pullorder.go pulorder.go -> pullorder.go 2015-10-27 12:14:14 +01:00
versioningconfiguration.go Fix some config Copy() things we had forgotten 2015-10-27 11:53:42 +01:00
wrapper.go lib/config, cmd/syncthing: Handle committing configuration better (fixes #3077) 2016-07-04 20:32:34 +00:00