mirror of
https://github.com/cloudflare/cloudflared.git
synced 2026-06-23 04:10:20 +00:00
a67c583bf1
Final run method, which runs cloudlflared pre-checks for both the normal startup procedure, as well as cloudflared diag.
For cloudflared diag, this produces a new json output to which is added to the final zip file.
Also added in a new flag to prevent this from running all the time, at least for now until we are 100% sure this works as intended. We will later remove this flag, only leaving in `--no-prechecks`, so this runs by default for everyone using cloudflared.
Tested pre-checks locally with origintunneld. The results show all pre-checks succeeding. In this case, it ran with only 1 region, since locally we run it with `--edge origintunneld1:7844`.
{width=900 height=217}
39 lines
2.0 KiB
Go
39 lines
2.0 KiB
Go
package diagnostic
|
|
|
|
import "time"
|
|
|
|
const (
|
|
defaultCollectorTimeout = time.Second * 10 // This const define the timeout value of a collector operation.
|
|
collectorField = "collector" // used for logging purposes
|
|
systemCollectorName = "system" // used for logging purposes
|
|
tunnelStateCollectorName = "tunnelState" // used for logging purposes
|
|
configurationCollectorName = "configuration" // used for logging purposes
|
|
defaultTimeout = 15 * time.Second // timeout for the collectors
|
|
twoWeeksOffset = -14 * 24 * time.Hour // maximum offset for the logs
|
|
logFilename = "cloudflared_logs.txt" // name of the output log file
|
|
configurationKeyUID = "uid" // Key used to set and get the UID value from the configuration map
|
|
tailMaxNumberOfLines = "10000" // maximum number of log lines from a virtual runtime (docker or kubernetes)
|
|
|
|
// Endpoints used by the diagnostic HTTP Client.
|
|
cliConfigurationEndpoint = "/diag/configuration"
|
|
tunnelStateEndpoint = "/diag/tunnel"
|
|
systemInformationEndpoint = "/diag/system"
|
|
memoryDumpEndpoint = "debug/pprof/heap"
|
|
goroutineDumpEndpoint = "debug/pprof/goroutine"
|
|
metricsEndpoint = "metrics"
|
|
tunnelConfigurationEndpoint = "/config"
|
|
// Base for filenames of the diagnostic procedure
|
|
systemInformationBaseName = "systeminformation.json"
|
|
metricsBaseName = "metrics.txt"
|
|
zipName = "cloudflared-diag"
|
|
heapPprofBaseName = "heap.pprof"
|
|
goroutinePprofBaseName = "goroutine.pprof"
|
|
networkBaseName = "network.json"
|
|
rawNetworkBaseName = "raw-network.txt"
|
|
tunnelStateBaseName = "tunnelstate.json"
|
|
cliConfigurationBaseName = "cli-configuration.json"
|
|
configurationBaseName = "configuration.json"
|
|
taskResultBaseName = "task-result.json"
|
|
prechecksBaseName = "prechecks.json"
|
|
)
|