Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix parsing of default per tenant otlp config #12836

Merged
merged 1 commit into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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.
Expand Down
Loading