From 9f70628615499ddf7d5fd0cea0671ccac9a1a7df Mon Sep 17 00:00:00 2001 From: Sandeep Sukhani Date: Tue, 30 Apr 2024 17:35:26 +0530 Subject: [PATCH] fix default of default per tenant otlp config --- integration/cluster/cluster.go | 4 ++++ integration/loki_micro_services_test.go | 2 +- pkg/validation/limits.go | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/integration/cluster/cluster.go b/integration/cluster/cluster.go index 694119ca4fe21..2ee68e15cc178 100644 --- a/integration/cluster/cluster.go +++ b/integration/cluster/cluster.go @@ -68,6 +68,9 @@ limits_config: attributes_config: - action: index_label attributes: ["service.name"] + log_attributes: + - action: drop + attributes: [email] storage_config: named_stores: @@ -430,6 +433,7 @@ func (c *Component) run() error { return err } + config.LimitsConfig.SetGlobalOTLPConfig(config.Distributor.OTLPConfig) var err error c.loki, err = loki.New(config.Config) if err != nil { diff --git a/integration/loki_micro_services_test.go b/integration/loki_micro_services_test.go index 33f28296bc062..a048d09324948 100644 --- a/integration/loki_micro_services_test.go +++ b/integration/loki_micro_services_test.go @@ -739,7 +739,7 @@ func TestOTLPLogsIngestQuery(t *testing.T) { t.Run("ingest-logs", func(t *testing.T) { // ingest some log lines - require.NoError(t, cliDistributor.PushOTLPLogLine("lineA", now.Add(-45*time.Minute), map[string]any{"trace_id": 1, "user_id": "2"})) + require.NoError(t, cliDistributor.PushOTLPLogLine("lineA", now.Add(-45*time.Minute), map[string]any{"trace_id": 1, "user_id": "2", "email": "foo@bar.com"})) require.NoError(t, cliDistributor.PushOTLPLogLine("lineB", now.Add(-45*time.Minute), nil)) require.NoError(t, cliDistributor.PushOTLPLogLine("lineC", now, map[string]any{"order.ids": []any{5, 6}})) diff --git a/pkg/validation/limits.go b/pkg/validation/limits.go index 0159197831645..2ed27ad47bfec 100644 --- a/pkg/validation/limits.go +++ b/pkg/validation/limits.go @@ -403,7 +403,7 @@ func (l *Limits) RegisterFlags(f *flag.FlagSet) { // SetGlobalOTLPConfig set GlobalOTLPConfig which is used while unmarshaling per-tenant otlp config to use the default list of resource attributes picked as index labels. func (l *Limits) SetGlobalOTLPConfig(cfg push.GlobalOTLPConfig) { l.GlobalOTLPConfig = cfg - l.OTLPConfig = push.DefaultOTLPConfig(cfg) + l.OTLPConfig.ApplyGlobalOTLPConfig(cfg) } // UnmarshalYAML implements the yaml.Unmarshaler interface.