forked from ydb-platform/ydb-kubernetes-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathendpoints.go
40 lines (33 loc) · 1012 Bytes
/
endpoints.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
package metrics
import (
"fmt"
v1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
)
type Service struct {
Name string
Path string
Relabelings []*v1.RelabelConfig
}
func getMetricsServices(services []string) []Service {
metricsServices := make([]Service, 0, len(services))
for _, serviceName := range services {
var servicePath string
if serviceName == "ydb" || serviceName == "ydb_serverless" {
servicePath = fmt.Sprintf(MetricEndpointFormat, serviceName+"/name_label=name")
} else {
servicePath = fmt.Sprintf(MetricEndpointFormat, serviceName)
}
metricsServices = append(metricsServices, Service{
Name: serviceName,
Path: servicePath,
Relabelings: GetMetricsRelabelings(serviceName),
})
}
return metricsServices
}
func GetStorageMetricsServices() []Service {
return getMetricsServices(storageMetricsServices)
}
func GetDatabaseMetricsServices() []Service {
return getMetricsServices(databaseMetricsServices)
}