fix: split report global keys into raw and computed across plugins
The `<plugin>-global-<property>` keys in `:report` output returned the resolved value with the built-in default substituted in, so external tooling could not distinguish a property that had been set globally to the default from one that had never been set. The bare keys for caddy, haproxy, and traefik global-only properties had the same shape. The `global-<property>` keys now hold the raw stored value and are empty when nothing has been set, and a new `computed-<property>` key holds the effective value used at runtime, falling back through the per-app value (where one exists), the global value, and the built-in default. The bare global-only keys for the three proxy plugins are removed in favor of the raw/computed pair. Closes #8631.
This commit is contained in:
@@ -222,7 +222,7 @@ func writeVectorConfig() error {
|
||||
|
||||
data.Sources["docker-global-source"] = vectorSource{
|
||||
Type: "docker_logs",
|
||||
IncludeLabels: []string{reportGlobalAppLabelAlias("global")},
|
||||
IncludeLabels: []string{reportComputedAppLabelAlias("global")},
|
||||
}
|
||||
|
||||
data.Sinks["docker-global-sink"] = sink
|
||||
|
||||
@@ -20,11 +20,13 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
var flags map[string]common.ReportFunc
|
||||
if appName == "--global" {
|
||||
flags = map[string]common.ReportFunc{
|
||||
"--logs-global-app-label-alias": reportGlobalAppLabelAlias,
|
||||
"--logs-global-max-size": reportGlobalMaxSize,
|
||||
"--logs-global-vector-sink": reportGlobalVectorSink,
|
||||
"--logs-vector-global-image": reportVectorGlobalImage,
|
||||
"--logs-vector-global-networks": reportVectorGlobalNetworks,
|
||||
"--logs-computed-app-label-alias": reportComputedAppLabelAlias,
|
||||
"--logs-computed-max-size": reportComputedMaxSize,
|
||||
"--logs-global-app-label-alias": reportGlobalAppLabelAlias,
|
||||
"--logs-global-max-size": reportGlobalMaxSize,
|
||||
"--logs-global-vector-sink": reportGlobalVectorSink,
|
||||
"--logs-vector-global-image": reportVectorGlobalImage,
|
||||
"--logs-vector-global-networks": reportVectorGlobalNetworks,
|
||||
}
|
||||
} else {
|
||||
flags = map[string]common.ReportFunc{
|
||||
@@ -57,12 +59,15 @@ func reportComputedAppLabelAlias(appName string) string {
|
||||
if value == "" {
|
||||
value = reportGlobalAppLabelAlias(appName)
|
||||
}
|
||||
if value == "" {
|
||||
value = AppLabelAlias
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
func reportGlobalAppLabelAlias(appName string) string {
|
||||
return common.PropertyGetDefault("logs", "--global", "app-label-alias", AppLabelAlias)
|
||||
return common.PropertyGet("logs", "--global", "app-label-alias")
|
||||
}
|
||||
|
||||
func reportAppLabelAlias(appName string) string {
|
||||
@@ -74,12 +79,15 @@ func reportComputedMaxSize(appName string) string {
|
||||
if value == "" {
|
||||
value = reportGlobalMaxSize(appName)
|
||||
}
|
||||
if value == "" {
|
||||
value = MaxSize
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
func reportGlobalMaxSize(appName string) string {
|
||||
return common.PropertyGetDefault("logs", "--global", "max-size", MaxSize)
|
||||
return common.PropertyGet("logs", "--global", "max-size")
|
||||
}
|
||||
|
||||
func reportVectorGlobalImage(appName string) string {
|
||||
|
||||
Reference in New Issue
Block a user