Skip to content

Commit

Permalink
fixup! Adjust config structure according to feedback from code review
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Haudum <[email protected]>
  • Loading branch information
chaudum committed Dec 19, 2024
1 parent 43ed574 commit f84fa29
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pkg/validation/limits.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ type Limits struct {
}

type FieldDetectorConfig struct {
Fields map[string][]string `yaml:"fields" json:"fields"`
Fields map[string][]string `yaml:"fields,omitempty" json:"fields,omitempty"`
}

type StreamRetention struct {
Expand Down
10 changes: 5 additions & 5 deletions pkg/validation/limits_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ ruler_remote_write_headers:
foo: "bar"
`,
exp: Limits{
DiscoverGenericFields: map[string][]string{},
DiscoverGenericFields: FieldDetectorConfig{},
RulerRemoteWriteHeaders: OverwriteMarshalingStringMap{map[string]string{"foo": "bar"}},
DiscoverServiceName: []string{},
LogLevelFields: []string{},
Expand All @@ -235,7 +235,7 @@ ruler_remote_write_headers:
ruler_remote_write_headers:
`,
exp: Limits{
DiscoverGenericFields: map[string][]string{},
DiscoverGenericFields: FieldDetectorConfig{},
DiscoverServiceName: []string{},
LogLevelFields: []string{},
// Rest from new defaults
Expand All @@ -256,7 +256,7 @@ retention_stream:
selector: '{foo="bar"}'
`,
exp: Limits{
DiscoverGenericFields: map[string][]string{},
DiscoverGenericFields: FieldDetectorConfig{},
DiscoverServiceName: []string{},
LogLevelFields: []string{},
StreamRetention: []StreamRetention{
Expand All @@ -278,7 +278,7 @@ reject_old_samples: true
`,
exp: Limits{
RejectOldSamples: true,
DiscoverGenericFields: map[string][]string{},
DiscoverGenericFields: FieldDetectorConfig{},
DiscoverServiceName: []string{},
LogLevelFields: []string{},

Expand All @@ -299,7 +299,7 @@ reject_old_samples: true
query_timeout: 5m
`,
exp: Limits{
DiscoverGenericFields: map[string][]string{},
DiscoverGenericFields: FieldDetectorConfig{},
DiscoverServiceName: []string{},
LogLevelFields: []string{},

Expand Down

0 comments on commit f84fa29

Please sign in to comment.