refactor to shorter config name (#997)

master
Kevin Wan 3 years ago committed by GitHub
parent 3b683fd498
commit 79eab0ea2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -30,7 +30,7 @@ type ServiceConf struct {
Mode string `json:",default=pro,options=dev|test|rt|pre|pro"`
MetricsUrl string `json:",optional"`
Prometheus prometheus.Config `json:",optional"`
OpenTelemetry opentelemetry.Config `json:",optional"`
Telemetry opentelemetry.Config `json:",optional"`
}
// MustSetUp sets up the service, exits on error.
@ -45,8 +45,8 @@ func (sc ServiceConf) SetUp() error {
if len(sc.Log.ServiceName) == 0 {
sc.Log.ServiceName = sc.Name
}
if len(sc.OpenTelemetry.Name) == 0 {
sc.OpenTelemetry.Name = sc.Name
if len(sc.Telemetry.Name) == 0 {
sc.Telemetry.Name = sc.Name
}
if err := logx.SetUp(sc.Log); err != nil {
return err
@ -54,7 +54,7 @@ func (sc ServiceConf) SetUp() error {
sc.initMode()
prometheus.StartAgent(sc.Prometheus)
opentelemetry.StartAgent(sc.OpenTelemetry)
opentelemetry.StartAgent(sc.Telemetry)
if len(sc.MetricsUrl) > 0 {
stat.SetReportWriter(stat.NewRemoteWriter(sc.MetricsUrl))

Loading…
Cancel
Save