@@ -153,39 +153,39 @@ func validateServices(services []config.Service) (map[NameInstance]config.Servic
153
153
replacer := strings .NewReplacer ("." , "_" , "-" , "_" )
154
154
155
155
for _ , srv := range services {
156
- if srv .ServiceType == "" {
157
- warning := fmt .Errorf ("%w: the key \" service_type \" is missing in one of your service override" , config .ErrInvalidValue )
156
+ if srv .Type == "" {
157
+ warning := fmt .Errorf ("%w: the key \" type \" is missing in one of your service override" , config .ErrInvalidValue )
158
158
warnings .Append (warning )
159
159
160
160
continue
161
161
}
162
162
163
- if ! model .IsValidMetricName (model .LabelValue (srv .ServiceType )) {
164
- newServiceType := replacer .Replace (srv .ServiceType )
163
+ if ! model .IsValidMetricName (model .LabelValue (srv .Type )) {
164
+ newServiceType := replacer .Replace (srv .Type )
165
165
if ! model .IsValidMetricName (model .LabelValue (newServiceType )) {
166
166
warning := fmt .Errorf (
167
- "%w: service_type \" %s\" can only contains letters, digits and underscore" ,
168
- config .ErrInvalidValue , srv .ServiceType ,
167
+ "%w: service type \" %s\" can only contains letters, digits and underscore" ,
168
+ config .ErrInvalidValue , srv .Type ,
169
169
)
170
170
warnings .Append (warning )
171
171
172
172
continue
173
173
}
174
174
175
175
warning := fmt .Errorf (
176
- "%w: service_type \" %s\" can not contains dot (.) or dash (-). Changed to \" %s\" " ,
177
- config .ErrInvalidValue , srv .ServiceType , newServiceType ,
176
+ "%w: service type \" %s\" can not contains dot (.) or dash (-). Changed to \" %s\" " ,
177
+ config .ErrInvalidValue , srv .Type , newServiceType ,
178
178
)
179
179
warnings .Append (warning )
180
180
181
- srv .ServiceType = newServiceType
181
+ srv .Type = newServiceType
182
182
}
183
183
184
184
// SSL and StartTLS can't be used at the same time.
185
185
if srv .SSL && srv .StartTLS {
186
186
warning := fmt .Errorf (
187
187
"%w: service '%s' can't set both SSL and StartTLS, StartTLS will be used" ,
188
- config .ErrInvalidValue , srv .ServiceType ,
188
+ config .ErrInvalidValue , srv .Type ,
189
189
)
190
190
warnings .Append (warning )
191
191
@@ -198,7 +198,7 @@ func validateServices(services []config.Service) (map[NameInstance]config.Servic
198
198
default :
199
199
warning := fmt .Errorf (
200
200
"%w: service '%s' has an unsupported stats protocol: '%s'" ,
201
- config .ErrInvalidValue , srv .ServiceType , srv .StatsProtocol ,
201
+ config .ErrInvalidValue , srv .Type , srv .StatsProtocol ,
202
202
)
203
203
warnings .Append (warning )
204
204
@@ -209,15 +209,15 @@ func validateServices(services []config.Service) (map[NameInstance]config.Servic
209
209
210
210
// Check for duplicated overrides.
211
211
key := NameInstance {
212
- Name : srv .ServiceType ,
213
- Instance : srv .ServiceInstance ,
212
+ Name : srv .Type ,
213
+ Instance : srv .Instance ,
214
214
}
215
215
216
216
if _ , ok := serviceMap [key ]; ok {
217
- warning := fmt .Sprintf ("a service override is duplicated for '%s'" , srv .ServiceType )
217
+ warning := fmt .Sprintf ("a service override is duplicated for '%s'" , srv .Type )
218
218
219
- if srv .ServiceInstance != "" {
220
- warning = fmt .Sprintf ("%s on instance '%s'" , warning , srv .ServiceInstance )
219
+ if srv .Instance != "" {
220
+ warning = fmt .Sprintf ("%s on instance '%s'" , warning , srv .Instance )
221
221
}
222
222
223
223
warnings .Append (fmt .Errorf ("%w: %s" , config .ErrInvalidValue , warning ))
@@ -558,8 +558,8 @@ func copyAndMergeServiceWithOverride(servicesMap map[NameInstance]Service, overr
558
558
559
559
for _ , v := range overrides {
560
560
key := NameInstance {
561
- Name : v .ServiceType ,
562
- Instance : v .ServiceInstance ,
561
+ Name : v .Type ,
562
+ Instance : v .Instance ,
563
563
}
564
564
service := serviceMapWithOverride [key ]
565
565
@@ -593,8 +593,8 @@ func applyOverrideInPlace(
593
593
for _ , serviceKey := range serviceKeys {
594
594
service := servicesMap [serviceKey ]
595
595
596
- if service .Name != service .Config .ServiceType && service .Config .ServiceType != "" {
597
- service .Name = service .Config .ServiceType
596
+ if service .Name != service .Config .Type && service .Config .Type != "" {
597
+ service .Name = service .Config .Type
598
598
service .ServiceType = ""
599
599
}
600
600
@@ -605,8 +605,8 @@ func applyOverrideInPlace(
605
605
service .ServiceType = CustomService
606
606
}
607
607
608
- if service .Config .ServiceInstance != "" {
609
- service .Instance = service .Config .ServiceInstance
608
+ if service .Config .Instance != "" {
609
+ service .Instance = service .Config .Instance
610
610
}
611
611
612
612
service .Active = true
0 commit comments