diff --git a/operator/internal/manifests/config_otlp.go b/operator/internal/manifests/config_otlp.go index 8d2a092f85ca6..563a1678fd7aa 100644 --- a/operator/internal/manifests/config_otlp.go +++ b/operator/internal/manifests/config_otlp.go @@ -5,14 +5,8 @@ import ( "github.com/grafana/loki/operator/internal/manifests/internal/config" ) -func defaultOTLPAttributeConfig(ts *lokiv1.TenantsSpec) config.OTLPAttributeConfig { - if ts == nil || ts.Mode != lokiv1.OpenshiftLogging { - return config.OTLPAttributeConfig{} - } - - // TODO decide which of these can be disabled by using "disableRecommendedAttributes" - // TODO decide whether we want to split the default configuration by tenant - result := config.OTLPAttributeConfig{ +func defaultOpenShiftLoggingAttributes() config.OTLPAttributeConfig { + return config.OTLPAttributeConfig{ DefaultIndexLabels: []string{ "openshift.cluster.uid", "openshift.log.source", @@ -90,8 +84,16 @@ func defaultOTLPAttributeConfig(ts *lokiv1.TenantsSpec) config.OTLPAttributeConf }, }, } +} + +func defaultOTLPAttributeConfig(ts *lokiv1.TenantsSpec) config.OTLPAttributeConfig { + if ts == nil || ts.Mode != lokiv1.OpenshiftLogging { + return config.OTLPAttributeConfig{} + } - return result + // TODO decide which of these can be disabled by using "disableRecommendedAttributes" + // TODO decide whether we want to split the default configuration by tenant + return defaultOpenShiftLoggingAttributes() } func collectAttributes(attrs []lokiv1.OTLPAttributeReference) (regularExpressions, names []string) { diff --git a/operator/internal/manifests/config_otlp_test.go b/operator/internal/manifests/config_otlp_test.go index 9a6d99d3a50d3..c658ecd7ae7dc 100644 --- a/operator/internal/manifests/config_otlp_test.go +++ b/operator/internal/manifests/config_otlp_test.go @@ -186,6 +186,15 @@ func TestOtlpAttributeConfig(t *testing.T) { }, }, }, + { + desc: "openshift-logging defaults", + spec: lokiv1.LokiStackSpec{ + Tenants: &lokiv1.TenantsSpec{ + Mode: lokiv1.OpenshiftLogging, + }, + }, + wantConfig: defaultOpenShiftLoggingAttributes(), + }, } for _, tc := range tt {