-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
feat: Configurable list of json fields to mine patterns #14528
feat: Configurable list of json fields to mine patterns #14528
Conversation
pkg/validation/limits.go
Outdated
@@ -418,6 +420,9 @@ func (l *Limits) RegisterFlags(f *flag.FlagSet) { | |||
f.IntVar(&l.BlockIngestionStatusCode, "limits.block-ingestion-status-code", defaultBlockedIngestionStatusCode, "HTTP status code to return when ingestion is blocked. If 200, the ingestion will be blocked without returning an error to the client. By Default, a custom status code (260) is returned to the client along with an error message.") | |||
|
|||
f.IntVar(&l.IngestionPartitionsTenantShardSize, "limits.ingestion-partition-tenant-shard-size", 0, "The number of partitions a tenant's data should be sharded to when using kafka ingestion. Tenants are sharded across partitions using shuffle-sharding. 0 disables shuffle sharding and tenant is sharded across all partitions.") | |||
|
|||
_ = l.PatternIngesterTokenizableJSONFields.Set("log,message,msg,msg_,_msg,content") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean we need to redefine all of these in the limits if we want to add a new one alongside the existing ones?
Is the default list part of the doc/description so it is easy to reference in that case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a default, append and delete lists. So we can better customize the default list per tenant.
pkg/pattern/drain/drain_test.go
Outdated
@@ -91,7 +91,7 @@ func TestDrain_TrainExtractsPatterns(t *testing.T) { | |||
}, | |||
}, | |||
{ | |||
drain: New(DefaultConfig(), "", nil), | |||
drain: New("", DefaultConfig(), &fakeLimits{}, "", nil), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: define a tenantID constant for this, so its obvious what is being passed here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
What this PR does / why we need it:
This PR makes the hardcoded list of json fields to mine patterns for configurable. This would allow us to:
This list is now configurable via the following overrides:
pattern_ingester_tokenizable_json_fields_default
: It takes a comma-separated list of fields. By default we set it to the currently hardcoded list:log,message,msg,msg_,_msg,content
.pattern_ingester_tokenizable_json_fields_append
: Also comma-separated. Appends content to default list.pattern_ingester_tokenizable_json_fields_delete
: Comma-separated. Deletes keys from (default U append).The docs are hidden.
Special notes for your reviewer:
pattern.stream
via theinstanceID
of thepattern.instance
which in turns comes from thepattern.Ingester
atGetOrCreateInstance
where theinstanceID
comes from the tenantID in the ctx.Checklist
CONTRIBUTING.md
guide (required)feat
PRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.docs/sources/setup/upgrade/_index.md
deprecated-config.yaml
anddeleted-config.yaml
files respectively in thetools/deprecated-config-checker
directory. Example PR