From 074909a884ad1c9a1c3de2519153f6b87259c435 Mon Sep 17 00:00:00 2001 From: Cody Gibb Date: Tue, 14 Apr 2026 14:39:18 -0700 Subject: [PATCH 1/2] Sync swagger from monorepo --- .../cli/configv1/consumption_budgets.gen.go | 10 +- .../cli/configv1/consumption_config.gen.go | 14 +- .../cli/configv1/log_control_config.gen.go | 32 ++- .../cli/configv1/log_ingest_config.gen.go | 12 +- .../models/configv1_log_control_rule.go | 51 +++++ .../models/configv1_log_control_rule_type.go | 5 +- .../consumption_budget_priority_filter.go | 4 +- .../models/consumption_budget_s_k_u_group.go | 8 +- .../models/consumption_budget_unit.go | 5 +- .../models/log_control_rule_parse_field.go | 211 ++++++++++++++++++ .../models/log_ingest_config_log_parser.go | 51 +++++ .../configv1/models/log_parser_grok_parser.go | 51 +++++ .../configv1/models/log_parser_parser_type.go | 5 +- .../models/partition_filter_condition.go | 71 +++++- src/generated/swagger/configv1/spec.json | 54 ++++- 15 files changed, 560 insertions(+), 24 deletions(-) create mode 100644 src/generated/swagger/configv1/models/log_control_rule_parse_field.go create mode 100644 src/generated/swagger/configv1/models/log_parser_grok_parser.go diff --git a/src/generated/cli/configv1/consumption_budgets.gen.go b/src/generated/cli/configv1/consumption_budgets.gen.go index 5f5d49a..ddaf032 100644 --- a/src/generated/cli/configv1/consumption_budgets.gen.go +++ b/src/generated/cli/configv1/consumption_budgets.gen.go @@ -520,9 +520,7 @@ spec: # concatenated together as implied 'AND' operators. A request must match every # filter to match the 'priority'. filters: - - # If set, matches incoming data that belongs to the specified dataset. - - # Exactly one of 'dataset_slug' or 'log_filter' must be set. + - # Deprecated. Use 'log_filter' instead. dataset_slug: log_filter: # Returns logs that match this query. The query can include only top-level @@ -538,9 +536,9 @@ spec: instant_rate: # Value of the fixed rate threshold. fixed_value_per_sec: - sku_group: + sku_group: type: - unit: + unit: volume: # Value of the volume threshold. fixed_value: @@ -567,7 +565,7 @@ spec: # order to fire an alert. By default, the sustain is 0: any consumption # over the threshold will fire an alert. instant_rate_sustain_secs: - resource: + resource: ` func newConsumptionBudgetScaffoldCmd() *cobra.Command { diff --git a/src/generated/cli/configv1/consumption_config.gen.go b/src/generated/cli/configv1/consumption_config.gen.go index 226fd97..85d1432 100644 --- a/src/generated/cli/configv1/consumption_config.gen.go +++ b/src/generated/cli/configv1/consumption_config.gen.go @@ -363,8 +363,20 @@ spec: filters: - # Conditions for the query to match. conditions: - - # Deprecated. Use 'log_filter' instead. + - # Deprecated. Use 'log_filter', 'metric_filters', or 'trace_filter' instead. dataset_slug: + # If set, matches incoming metric data by label. If multiple label + # filters are specified, an incoming metric must match every label + # filter to match the condition. Label values support glob patterns, + # including matching multiple patterns with an 'OR', such as + # 'service:{svc1,svc2}'. + + # Exactly one of 'log_filter', 'metric_filters', or 'trace_filter' must be set. + metric_filters: + - # The name of the label to match. + name: + # The glob value of the label to match. + value_glob: log_filter: # Returns logs that match this query. The query can include only top-level # operations. Nested clauses aren't supported. Only one type of 'AND' or 'OR' diff --git a/src/generated/cli/configv1/log_control_config.gen.go b/src/generated/cli/configv1/log_control_config.gen.go index 3086c97..ed475b3 100644 --- a/src/generated/cli/configv1/log_control_config.gen.go +++ b/src/generated/cli/configv1/log_control_config.gen.go @@ -395,6 +395,36 @@ spec: selector: mode: mode: + # ParseField is the configuration for a parse field action. + parse_field: + destination: + # The log filter used to indicate the field path. Use 'parent[child]' syntax to + # indicate nesting. + selector: + parser: + grok_parser: + # The grok pattern to apply. Named capture groups become named fields in + # the extracted log. + pattern: + # A parser to extract key/value pairs from a string. + # If duplicate keys are found, the first instance is used. + key_value_parser: + # The string for splitting each pair into its key and value. + pair_separator: + # The string for splitting the input into key/value pairs. + delimiter: + # Specifies the code points of any Unicode characters to trim from the + # beginning and end of keys and values. + trim_set: + parser_type: + regex_parser: + # The regular expression parser pattern to apply. Must use RE2 syntax. + # Named capturing groups become named fields in the extracted log. + regex: + source: + # The log filter used to indicate the field path. Use 'parent[child]' syntax to + # indicate nesting. + selector: # ReplaceField is the configuration for a replace field action. replace_field: # Defines the the regular expression that determines which part of the field to @@ -441,7 +471,7 @@ spec: # is equal to 100% of logs. For example, to keep 25% of logs, enter '0.25' as # the 'rate'. rate: - type: + type: ` func newLogControlConfigScaffoldCmd() *cobra.Command { diff --git a/src/generated/cli/configv1/log_ingest_config.gen.go b/src/generated/cli/configv1/log_ingest_config.gen.go index 8b0a5fa..d1b4109 100644 --- a/src/generated/cli/configv1/log_ingest_config.gen.go +++ b/src/generated/cli/configv1/log_ingest_config.gen.go @@ -357,6 +357,10 @@ spec: keep_original: mode: parser: + grok_parser: + # The grok pattern to apply. Named capture groups become named fields in + # the extracted log. + pattern: # A parser to extract key/value pairs from a string. # If duplicate keys are found, the first instance is used. key_value_parser: @@ -367,7 +371,7 @@ spec: # Specifies the code points of any Unicode characters to trim from the # beginning and end of keys and values. trim_set: - parser_type: + parser_type: regex_parser: # The regular expression parser pattern to apply. Must use RE2 syntax. # Named capturing groups become named fields in the extracted log. @@ -380,6 +384,10 @@ spec: selector: mode: parser: + grok_parser: + # The grok pattern to apply. Named capture groups become named fields in + # the extracted log. + pattern: # A parser to extract key/value pairs from a string. # If duplicate keys are found, the first instance is used. key_value_parser: @@ -390,7 +398,7 @@ spec: # Specifies the code points of any Unicode characters to trim from the # beginning and end of keys and values. trim_set: - parser_type: + parser_type: regex_parser: # The regular expression parser pattern to apply. Must use RE2 syntax. # Named capturing groups become named fields in the extracted log. diff --git a/src/generated/swagger/configv1/models/configv1_log_control_rule.go b/src/generated/swagger/configv1/models/configv1_log_control_rule.go index 57a5f45..44c2a67 100644 --- a/src/generated/swagger/configv1/models/configv1_log_control_rule.go +++ b/src/generated/swagger/configv1/models/configv1_log_control_rule.go @@ -42,6 +42,9 @@ type Configv1LogControlRule struct { // emit metrics EmitMetrics *LogControlRuleEmitMetrics `json:"emit_metrics,omitempty"` + + // parse field + ParseField *LogControlRuleParseField `json:"parse_field,omitempty"` } // Validate validates this configv1 log control rule @@ -72,6 +75,10 @@ func (m *Configv1LogControlRule) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateParseField(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -188,6 +195,25 @@ func (m *Configv1LogControlRule) validateEmitMetrics(formats strfmt.Registry) er return nil } +func (m *Configv1LogControlRule) validateParseField(formats strfmt.Registry) error { + if swag.IsZero(m.ParseField) { // not required + return nil + } + + if m.ParseField != nil { + if err := m.ParseField.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("parse_field") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("parse_field") + } + return err + } + } + + return nil +} + // ContextValidate validate this configv1 log control rule based on the context it is used func (m *Configv1LogControlRule) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error @@ -216,6 +242,10 @@ func (m *Configv1LogControlRule) ContextValidate(ctx context.Context, formats st res = append(res, err) } + if err := m.contextValidateParseField(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -342,6 +372,27 @@ func (m *Configv1LogControlRule) contextValidateEmitMetrics(ctx context.Context, return nil } +func (m *Configv1LogControlRule) contextValidateParseField(ctx context.Context, formats strfmt.Registry) error { + + if m.ParseField != nil { + + if swag.IsZero(m.ParseField) { // not required + return nil + } + + if err := m.ParseField.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("parse_field") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("parse_field") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *Configv1LogControlRule) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/src/generated/swagger/configv1/models/configv1_log_control_rule_type.go b/src/generated/swagger/configv1/models/configv1_log_control_rule_type.go index 90c27eb..261766b 100644 --- a/src/generated/swagger/configv1/models/configv1_log_control_rule_type.go +++ b/src/generated/swagger/configv1/models/configv1_log_control_rule_type.go @@ -44,6 +44,9 @@ const ( // Configv1LogControlRuleTypeEMITMETRICS captures enum value "EMIT_METRICS" Configv1LogControlRuleTypeEMITMETRICS Configv1LogControlRuleType = "EMIT_METRICS" + + // Configv1LogControlRuleTypePARSEFIELD captures enum value "PARSE_FIELD" + Configv1LogControlRuleTypePARSEFIELD Configv1LogControlRuleType = "PARSE_FIELD" ) // for schema @@ -51,7 +54,7 @@ var configv1LogControlRuleTypeEnum []interface{} func init() { var res []Configv1LogControlRuleType - if err := json.Unmarshal([]byte(`["DROP","SAMPLE","DROP_FIELD","REPLACE_FIELD","EMIT_METRICS"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["DROP","SAMPLE","DROP_FIELD","REPLACE_FIELD","EMIT_METRICS","PARSE_FIELD"]`), &res); err != nil { panic(err) } for _, v := range res { diff --git a/src/generated/swagger/configv1/models/consumption_budget_priority_filter.go b/src/generated/swagger/configv1/models/consumption_budget_priority_filter.go index 8245d09..48f227c 100644 --- a/src/generated/swagger/configv1/models/consumption_budget_priority_filter.go +++ b/src/generated/swagger/configv1/models/consumption_budget_priority_filter.go @@ -18,9 +18,7 @@ import ( // swagger:model ConsumptionBudgetPriorityFilter type ConsumptionBudgetPriorityFilter struct { - // If set, matches incoming data that belongs to the specified dataset. - // - // Exactly one of `dataset_slug` or `log_filter` must be set. + // Deprecated. Use `log_filter` instead. DatasetSlug string `json:"dataset_slug,omitempty"` // log filter diff --git a/src/generated/swagger/configv1/models/consumption_budget_s_k_u_group.go b/src/generated/swagger/configv1/models/consumption_budget_s_k_u_group.go index e27f829..efc462f 100644 --- a/src/generated/swagger/configv1/models/consumption_budget_s_k_u_group.go +++ b/src/generated/swagger/configv1/models/consumption_budget_s_k_u_group.go @@ -35,6 +35,12 @@ const ( // ConsumptionBudgetSKUGroupLOGPROCESSEDBYTES captures enum value "LOG_PROCESSED_BYTES" ConsumptionBudgetSKUGroupLOGPROCESSEDBYTES ConsumptionBudgetSKUGroup = "LOG_PROCESSED_BYTES" + + // ConsumptionBudgetSKUGroupMETRICPERSISTEDSERIES captures enum value "METRIC_PERSISTED_SERIES" + ConsumptionBudgetSKUGroupMETRICPERSISTEDSERIES ConsumptionBudgetSKUGroup = "METRIC_PERSISTED_SERIES" + + // ConsumptionBudgetSKUGroupMETRICALL captures enum value "METRIC_ALL" + ConsumptionBudgetSKUGroupMETRICALL ConsumptionBudgetSKUGroup = "METRIC_ALL" ) // for schema @@ -42,7 +48,7 @@ var consumptionBudgetSKUGroupEnum []interface{} func init() { var res []ConsumptionBudgetSKUGroup - if err := json.Unmarshal([]byte(`["LOG_PERSISTED_BYTES","LOG_PROCESSED_BYTES"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["LOG_PERSISTED_BYTES","LOG_PROCESSED_BYTES","METRIC_PERSISTED_SERIES","METRIC_ALL"]`), &res); err != nil { panic(err) } for _, v := range res { diff --git a/src/generated/swagger/configv1/models/consumption_budget_unit.go b/src/generated/swagger/configv1/models/consumption_budget_unit.go index 96e0bba..7e49231 100644 --- a/src/generated/swagger/configv1/models/consumption_budget_unit.go +++ b/src/generated/swagger/configv1/models/consumption_budget_unit.go @@ -32,6 +32,9 @@ const ( // ConsumptionBudgetUnitNATIVE captures enum value "NATIVE" ConsumptionBudgetUnitNATIVE ConsumptionBudgetUnit = "NATIVE" + + // ConsumptionBudgetUnitCREDITS captures enum value "CREDITS" + ConsumptionBudgetUnitCREDITS ConsumptionBudgetUnit = "CREDITS" ) // for schema @@ -39,7 +42,7 @@ var consumptionBudgetUnitEnum []interface{} func init() { var res []ConsumptionBudgetUnit - if err := json.Unmarshal([]byte(`["NATIVE"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["NATIVE","CREDITS"]`), &res); err != nil { panic(err) } for _, v := range res { diff --git a/src/generated/swagger/configv1/models/log_control_rule_parse_field.go b/src/generated/swagger/configv1/models/log_control_rule_parse_field.go new file mode 100644 index 0000000..ff2151b --- /dev/null +++ b/src/generated/swagger/configv1/models/log_control_rule_parse_field.go @@ -0,0 +1,211 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// LogControlRuleParseField ParseField is the configuration for a parse field action. +// +// swagger:model LogControlRuleParseField +type LogControlRuleParseField struct { + + // source + Source *Configv1LogFieldPath `json:"source,omitempty"` + + // destination + Destination *Configv1LogFieldPath `json:"destination,omitempty"` + + // parser + Parser *LogIngestConfigLogParser `json:"parser,omitempty"` +} + +// Validate validates this log control rule parse field +func (m *LogControlRuleParseField) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateSource(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDestination(formats); err != nil { + res = append(res, err) + } + + if err := m.validateParser(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *LogControlRuleParseField) validateSource(formats strfmt.Registry) error { + if swag.IsZero(m.Source) { // not required + return nil + } + + if m.Source != nil { + if err := m.Source.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("source") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("source") + } + return err + } + } + + return nil +} + +func (m *LogControlRuleParseField) validateDestination(formats strfmt.Registry) error { + if swag.IsZero(m.Destination) { // not required + return nil + } + + if m.Destination != nil { + if err := m.Destination.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("destination") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("destination") + } + return err + } + } + + return nil +} + +func (m *LogControlRuleParseField) validateParser(formats strfmt.Registry) error { + if swag.IsZero(m.Parser) { // not required + return nil + } + + if m.Parser != nil { + if err := m.Parser.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("parser") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("parser") + } + return err + } + } + + return nil +} + +// ContextValidate validate this log control rule parse field based on the context it is used +func (m *LogControlRuleParseField) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateSource(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateDestination(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateParser(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *LogControlRuleParseField) contextValidateSource(ctx context.Context, formats strfmt.Registry) error { + + if m.Source != nil { + + if swag.IsZero(m.Source) { // not required + return nil + } + + if err := m.Source.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("source") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("source") + } + return err + } + } + + return nil +} + +func (m *LogControlRuleParseField) contextValidateDestination(ctx context.Context, formats strfmt.Registry) error { + + if m.Destination != nil { + + if swag.IsZero(m.Destination) { // not required + return nil + } + + if err := m.Destination.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("destination") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("destination") + } + return err + } + } + + return nil +} + +func (m *LogControlRuleParseField) contextValidateParser(ctx context.Context, formats strfmt.Registry) error { + + if m.Parser != nil { + + if swag.IsZero(m.Parser) { // not required + return nil + } + + if err := m.Parser.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("parser") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("parser") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *LogControlRuleParseField) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *LogControlRuleParseField) UnmarshalBinary(b []byte) error { + var res LogControlRuleParseField + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/src/generated/swagger/configv1/models/log_ingest_config_log_parser.go b/src/generated/swagger/configv1/models/log_ingest_config_log_parser.go index e485205..c0ae17d 100644 --- a/src/generated/swagger/configv1/models/log_ingest_config_log_parser.go +++ b/src/generated/swagger/configv1/models/log_ingest_config_log_parser.go @@ -26,6 +26,9 @@ type LogIngestConfigLogParser struct { // key value parser KeyValueParser *LogParserKeyValueParser `json:"key_value_parser,omitempty"` + + // grok parser + GrokParser *LogParserGrokParser `json:"grok_parser,omitempty"` } // Validate validates this log ingest config log parser @@ -44,6 +47,10 @@ func (m *LogIngestConfigLogParser) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateGrokParser(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -105,6 +112,25 @@ func (m *LogIngestConfigLogParser) validateKeyValueParser(formats strfmt.Registr return nil } +func (m *LogIngestConfigLogParser) validateGrokParser(formats strfmt.Registry) error { + if swag.IsZero(m.GrokParser) { // not required + return nil + } + + if m.GrokParser != nil { + if err := m.GrokParser.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("grok_parser") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("grok_parser") + } + return err + } + } + + return nil +} + // ContextValidate validate this log ingest config log parser based on the context it is used func (m *LogIngestConfigLogParser) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error @@ -121,6 +147,10 @@ func (m *LogIngestConfigLogParser) ContextValidate(ctx context.Context, formats res = append(res, err) } + if err := m.contextValidateGrokParser(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -187,6 +217,27 @@ func (m *LogIngestConfigLogParser) contextValidateKeyValueParser(ctx context.Con return nil } +func (m *LogIngestConfigLogParser) contextValidateGrokParser(ctx context.Context, formats strfmt.Registry) error { + + if m.GrokParser != nil { + + if swag.IsZero(m.GrokParser) { // not required + return nil + } + + if err := m.GrokParser.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("grok_parser") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("grok_parser") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *LogIngestConfigLogParser) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/src/generated/swagger/configv1/models/log_parser_grok_parser.go b/src/generated/swagger/configv1/models/log_parser_grok_parser.go new file mode 100644 index 0000000..395d6ee --- /dev/null +++ b/src/generated/swagger/configv1/models/log_parser_grok_parser.go @@ -0,0 +1,51 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// LogParserGrokParser log parser grok parser +// +// swagger:model LogParserGrokParser +type LogParserGrokParser struct { + + // The grok pattern to apply. Named capture groups become named fields in + // the extracted log. + Pattern string `json:"pattern,omitempty"` +} + +// Validate validates this log parser grok parser +func (m *LogParserGrokParser) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this log parser grok parser based on context it is used +func (m *LogParserGrokParser) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *LogParserGrokParser) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *LogParserGrokParser) UnmarshalBinary(b []byte) error { + var res LogParserGrokParser + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/src/generated/swagger/configv1/models/log_parser_parser_type.go b/src/generated/swagger/configv1/models/log_parser_parser_type.go index 466a67d..9fbd1b4 100644 --- a/src/generated/swagger/configv1/models/log_parser_parser_type.go +++ b/src/generated/swagger/configv1/models/log_parser_parser_type.go @@ -38,6 +38,9 @@ const ( // LogParserParserTypeKEYVALUE captures enum value "KEY_VALUE" LogParserParserTypeKEYVALUE LogParserParserType = "KEY_VALUE" + + // LogParserParserTypeGROK captures enum value "GROK" + LogParserParserTypeGROK LogParserParserType = "GROK" ) // for schema @@ -45,7 +48,7 @@ var logParserParserTypeEnum []interface{} func init() { var res []LogParserParserType - if err := json.Unmarshal([]byte(`["JSON","REGEX","KEY_VALUE"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["JSON","REGEX","KEY_VALUE","GROK"]`), &res); err != nil { panic(err) } for _, v := range res { diff --git a/src/generated/swagger/configv1/models/partition_filter_condition.go b/src/generated/swagger/configv1/models/partition_filter_condition.go index e3b1391..4823e6c 100644 --- a/src/generated/swagger/configv1/models/partition_filter_condition.go +++ b/src/generated/swagger/configv1/models/partition_filter_condition.go @@ -7,6 +7,7 @@ package models import ( "context" + "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" @@ -18,12 +19,21 @@ import ( // swagger:model PartitionFilterCondition type PartitionFilterCondition struct { - // Deprecated. Use `log_filter` instead. + // Deprecated. Use `log_filter`, `metric_filters`, or `trace_filter` instead. DatasetSlug string `json:"dataset_slug,omitempty"` // log filter LogFilter *Configv1LogSearchFilter `json:"log_filter,omitempty"` + // If set, matches incoming metric data by label. If multiple label + // filters are specified, an incoming metric must match every label + // filter to match the condition. Label values support glob patterns, + // including matching multiple patterns with an `OR`, such as + // `service:{svc1,svc2}`. + // + // Exactly one of `log_filter`, `metric_filters`, or `trace_filter` must be set. + MetricFilters []*Configv1LabelFilter `json:"metric_filters"` + // trace filter TraceFilter *Configv1TraceSearchFilter `json:"trace_filter,omitempty"` } @@ -36,6 +46,10 @@ func (m *PartitionFilterCondition) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateMetricFilters(formats); err != nil { + res = append(res, err) + } + if err := m.validateTraceFilter(formats); err != nil { res = append(res, err) } @@ -65,6 +79,32 @@ func (m *PartitionFilterCondition) validateLogFilter(formats strfmt.Registry) er return nil } +func (m *PartitionFilterCondition) validateMetricFilters(formats strfmt.Registry) error { + if swag.IsZero(m.MetricFilters) { // not required + return nil + } + + for i := 0; i < len(m.MetricFilters); i++ { + if swag.IsZero(m.MetricFilters[i]) { // not required + continue + } + + if m.MetricFilters[i] != nil { + if err := m.MetricFilters[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("metric_filters" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("metric_filters" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + func (m *PartitionFilterCondition) validateTraceFilter(formats strfmt.Registry) error { if swag.IsZero(m.TraceFilter) { // not required return nil @@ -92,6 +132,10 @@ func (m *PartitionFilterCondition) ContextValidate(ctx context.Context, formats res = append(res, err) } + if err := m.contextValidateMetricFilters(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateTraceFilter(ctx, formats); err != nil { res = append(res, err) } @@ -123,6 +167,31 @@ func (m *PartitionFilterCondition) contextValidateLogFilter(ctx context.Context, return nil } +func (m *PartitionFilterCondition) contextValidateMetricFilters(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.MetricFilters); i++ { + + if m.MetricFilters[i] != nil { + + if swag.IsZero(m.MetricFilters[i]) { // not required + return nil + } + + if err := m.MetricFilters[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("metric_filters" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("metric_filters" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + func (m *PartitionFilterCondition) contextValidateTraceFilter(ctx context.Context, formats strfmt.Registry) error { if m.TraceFilter != nil { diff --git a/src/generated/swagger/configv1/spec.json b/src/generated/swagger/configv1/spec.json index f602c4d..2c9cb5c 100644 --- a/src/generated/swagger/configv1/spec.json +++ b/src/generated/swagger/configv1/spec.json @@ -634,7 +634,7 @@ "ConsumptionBudgetPriorityFilter": { "properties": { "dataset_slug": { - "description": "If set, matches incoming data that belongs to the specified dataset.\n\nExactly one of `dataset_slug` or `log_filter` must be set.", + "description": "Deprecated. Use `log_filter` instead.", "type": "string" }, "log_filter": { @@ -646,7 +646,9 @@ "ConsumptionBudgetSKUGroup": { "enum": [ "LOG_PERSISTED_BYTES", - "LOG_PROCESSED_BYTES" + "LOG_PROCESSED_BYTES", + "METRIC_PERSISTED_SERIES", + "METRIC_ALL" ], "type": "string" }, @@ -674,7 +676,8 @@ }, "ConsumptionBudgetUnit": { "enum": [ - "NATIVE" + "NATIVE", + "CREDITS" ], "type": "string" }, @@ -1247,6 +1250,21 @@ }, "type": "object" }, + "LogControlRuleParseField": { + "description": "ParseField is the configuration for a parse field action.", + "properties": { + "source": { + "$ref": "#/definitions/configv1LogFieldPath" + }, + "destination": { + "$ref": "#/definitions/configv1LogFieldPath" + }, + "parser": { + "$ref": "#/definitions/LogIngestConfigLogParser" + } + }, + "type": "object" + }, "LogControlRuleReplaceField": { "description": "ReplaceField is the configuration for a replace field action.", "properties": { @@ -1343,6 +1361,9 @@ }, "key_value_parser": { "$ref": "#/definitions/LogParserKeyValueParser" + }, + "grok_parser": { + "$ref": "#/definitions/LogParserGrokParser" } }, "type": "object" @@ -1430,6 +1451,15 @@ }, "type": "object" }, + "LogParserGrokParser": { + "properties": { + "pattern": { + "description": "The grok pattern to apply. Named capture groups become named fields in \nthe extracted log.", + "type": "string" + } + }, + "type": "object" + }, "LogParserKeyValueParser": { "description": "A parser to extract key/value pairs from a string.\nIf duplicate keys are found, the first instance is used.", "properties": { @@ -1452,7 +1482,8 @@ "enum": [ "JSON", "REGEX", - "KEY_VALUE" + "KEY_VALUE", + "GROK" ], "type": "string" }, @@ -2026,12 +2057,19 @@ "PartitionFilterCondition": { "properties": { "dataset_slug": { - "description": "Deprecated. Use `log_filter` instead.", + "description": "Deprecated. Use `log_filter`, `metric_filters`, or `trace_filter` instead.", "type": "string" }, "log_filter": { "$ref": "#/definitions/configv1LogSearchFilter" }, + "metric_filters": { + "description": "If set, matches incoming metric data by label. If multiple label\nfilters are specified, an incoming metric must match every label\nfilter to match the condition. Label values support glob patterns,\nincluding matching multiple patterns with an `OR`, such as\n`service:{svc1,svc2}`.\n\nExactly one of `log_filter`, `metric_filters`, or `trace_filter` must be set.", + "items": { + "$ref": "#/definitions/configv1LabelFilter" + }, + "type": "array" + }, "trace_filter": { "$ref": "#/definitions/configv1TraceSearchFilter" } @@ -5259,6 +5297,9 @@ }, "emit_metrics": { "$ref": "#/definitions/LogControlRuleEmitMetrics" + }, + "parse_field": { + "$ref": "#/definitions/LogControlRuleParseField" } }, "type": "object" @@ -5276,7 +5317,8 @@ "SAMPLE", "DROP_FIELD", "REPLACE_FIELD", - "EMIT_METRICS" + "EMIT_METRICS", + "PARSE_FIELD" ], "type": "string" }, From 34f281e7d139a7a8bf5be6d198f0117f3db58ae2 Mon Sep 17 00:00:00 2001 From: Cody Gibb Date: Tue, 14 Apr 2026 14:39:29 -0700 Subject: [PATCH 2/2] Update CHANGELOG for new consumption fields --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65cdb35..a5859e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +Added: +* Add `metric_filters` and `trace_filter` fields to `v1/config/ConsumptionConfig` partition filter conditions. +* Add `METRIC_PERSISTED_SERIES` and `METRIC_ALL` SKU groups and `CREDITS` unit to `v1/config/ConsumptionBudget`. + ## v1.25.0 Added: