MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / init

Function init

dgraph/cmd/debuginfo/run.go:64–93  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

62}
63
64func init() {
65 DebugInfo.Cmd = &cobra.Command{
66 Use: "debuginfo",
67 Short: "Generate debug information on the current node",
68 Run: func(cmd *cobra.Command, args []string) {
69 if err := collectDebugInfo(); err != nil {
70 glog.Errorf("error while collecting dgraph debug info: %s", err)
71 os.Exit(1)
72 }
73 },
74 Annotations: map[string]string{"group": "debug"},
75 }
76
77 DebugInfo.EnvPrefix = "DGRAPH_AGENT_DEBUGINFO"
78 DebugInfo.Cmd.SetHelpTemplate(x.NonRootTemplate)
79
80 flags := DebugInfo.Cmd.Flags()
81 flags.StringVarP(&debugInfoCmd.alphaAddr, "alpha", "a", "localhost:8080",
82 "Address of running dgraph alpha.")
83 flags.StringVarP(&debugInfoCmd.zeroAddr, "zero", "z", "", "Address of running dgraph zero.")
84 flags.StringVarP(&debugInfoCmd.directory, "directory", "d", "",
85 "Directory to write the debug info into.")
86 flags.BoolVarP(&debugInfoCmd.archive, "archive", "x", true,
87 "Whether to archive the generated report")
88 flags.Uint32VarP(&debugInfoCmd.seconds, "seconds", "s", 30,
89 "Duration for time-based metric collection.")
90 flags.StringSliceVarP(&debugInfoCmd.metricTypes, "metrics", "m", metricList,
91 "List of metrics & profile to dump in the report.")
92
93}
94
95func collectDebugInfo() (err error) {
96 if debugInfoCmd.directory == "" {

Callers

nothing calls this directly

Calls 2

collectDebugInfoFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected