forked from hypermodeinc/dgraph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflags.go
64 lines (57 loc) · 2.28 KB
/
flags.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* Copyright 2022 Dgraph Labs, Inc. and Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package x
import (
"github.com/dgraph-io/ristretto/z"
"github.com/spf13/pflag"
)
const (
TraceDefaults = `ratio=0.01; jaeger=; datadog=;`
TelemetryDefaults = `reports=true; sentry=true;`
)
// FillCommonFlags stores flags common to Alpha and Zero.
func FillCommonFlags(flag *pflag.FlagSet) {
flag.String("my", "",
"addr:port of this server, so other Dgraph servers can talk to this.")
// OpenCensus flags.
//
// datadog: See https://github.com/DataDog/opencensus-go-exporter-datadog/issues/34
// about the status of supporting annotation logs through the datadog exporter
flag.String("trace", TraceDefaults, z.NewSuperFlagHelp(TraceDefaults).
Head("Trace options").
Flag("ratio",
"The ratio of queries to trace.").
Flag("jaeger",
"URL of Jaeger to send OpenCensus traces.").
Flag("datadog",
"URL of Datadog to send OpenCensus traces. As of now, the trace exporter does not "+
"support annotation logs and discards them.").
String())
flag.String("survive", "process",
`Choose between "process" or "filesystem".`+"\n "+
`If set to "process", there would be no data loss in case of process crash, but `+
`the behavior would be indeterministic in case of filesystem crash.`+"\n "+
`If set to "filesystem", blocking sync would be called after every write, hence `+
`guaranteeing no data loss in case of hard reboot.`+"\n "+
`Most users should be OK with choosing "process".`)
flag.String("telemetry", TelemetryDefaults, z.NewSuperFlagHelp(TelemetryDefaults).
Head("Telemetry (diagnostic) options").
Flag("reports",
"Send anonymous telemetry data to Dgraph devs.").
Flag("sentry",
"Send crash events to Sentry.").
String())
}