-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.go
30 lines (25 loc) · 1.58 KB
/
config.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
package config
type (
TraceExporterType string
MetricExporterType string
)
const (
NoneMetricExporter MetricExporterType = "none"
HTTPMetricExporter MetricExporterType = "http"
NoneTraceExporter TraceExporterType = "none"
HTTPTraceExporter TraceExporterType = "http"
)
type Config struct {
Trace TraceConfig `embed:"" prefix:"trace-"`
Metric MetricConfig `embed:"" prefix:"metric-"`
}
type TraceConfig struct {
Exporter TraceExporterType `default:"none" help:"Type of telemetry trace exporter, one of [ none, http ]." validate:"oneof=none http"`
HTTPEndpointURL string `default:"http://localhost:4318/v1/traces" help:"Endpoint URL for HTTP traces exporter." validate:"required_if=Exporter http"`
HTTPAuthorization string `default:"Basic ...." help:"Authorization for traces exporter." json:"-" validate:"required_if=Exporter http"`
}
type MetricConfig struct {
Exporter MetricExporterType `default:"none" help:"Type of telemetry metric exporter, one of [ none, http ]." validate:"oneof=none http"`
HTTPEndpointURL string `default:"http://localhost:4318/v1/metrics" help:"Endpoint URL for HTTP metrics exporter." validate:"required_if=Exporter http"`
HTTPAuthorization string `default:"Basic ...." help:"Authorization for metrics exporter." json:"-" validate:"required_if=Exporter http"`
}