Skip to content

Commit

Permalink
fix: fix parsing of default per tenant otlp config (#12836)
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeepsukhani authored May 14, 2024
1 parent f66172e commit 7cc9a93
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions integration/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ limits_config:
attributes_config:
- action: index_label
attributes: ["service.name"]
log_attributes:
- action: drop
attributes: [email]
storage_config:
named_stores:
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion integration/loki_micro_services_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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": "[email protected]"}))
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}}))
Expand Down
2 changes: 1 addition & 1 deletion pkg/validation/limits.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,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.
Expand Down

0 comments on commit 7cc9a93

Please sign in to comment.