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
|
package server
import (
"gitlab.com/gitlab-org/cluster-integration/gitlab-agent/v16/internal/tool/prototool"
"gitlab.com/gitlab-org/cluster-integration/gitlab-agent/v16/pkg/kascfg"
)
const (
defaultObservabilityListenNetwork = "tcp"
defaultObservabilityListenAddress = "127.0.0.1:8151"
defaultObservabilityPrometheusUrlPath = "/metrics"
defaultObservabilityLivenessProbeUrlPath = "/liveness"
defaultObservabilityReadinessProbeUrlPath = "/readiness"
defaultGrpcLogLevel = kascfg.LogLevelEnum_error
)
func ApplyDefaults(config *kascfg.ConfigurationFile) {
prototool.NotNil(&config.Observability)
o := config.Observability
prototool.NotNil(&o.Listen)
prototool.StringPtr(&o.Listen.Network, defaultObservabilityListenNetwork)
prototool.String(&o.Listen.Address, defaultObservabilityListenAddress)
prototool.NotNil(&o.Prometheus)
prototool.String(&o.Prometheus.UrlPath, defaultObservabilityPrometheusUrlPath)
prototool.NotNil(&o.Sentry)
prototool.NotNil(&o.Logging)
if o.Logging.GrpcLevel == nil {
x := defaultGrpcLogLevel
o.Logging.GrpcLevel = &x
}
prototool.NotNil(&o.LivenessProbe)
prototool.String(&o.LivenessProbe.UrlPath, defaultObservabilityLivenessProbeUrlPath)
prototool.NotNil(&o.ReadinessProbe)
prototool.String(&o.ReadinessProbe.UrlPath, defaultObservabilityReadinessProbeUrlPath)
}
|