-
Notifications
You must be signed in to change notification settings - Fork 55
refactor: config for job aggregation strings #319
Conversation
- to make it easier to override, define "cluster_namespace_job" in $._config as `job_aggregation_prefix`. - added some `job_aggregation_labels_*` as well The resulting output does not change (unless config is overridden).
|
I am hoping for some feedback on the variable names, to ensure that they are appropriate. |
56quarters
left a comment
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.
LGTM, but I'd wait for someone from the Cortex team
pracucci
left a comment
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.
Thanks for working on this! I left few comments 🙏
simplify mapping by extending $._config Co-authored-by: Marco Pracucci <[email protected]>
defines group-related strings based off of array-based parameters in _config. deprecated _config.alert_aggregation_labels with a std.trace warning, while maintaining (temporary?) backward compatibility.
defines group-related strings based off of array-based parameters in _config. deprecated _config.alert_aggregation_labels with a std.trace warning, while maintaining (temporary?) backward compatibility.
defines group-related strings based off of array-based parameters in _config. deprecated _config.alert_aggregation_labels with a std.trace warning, while maintaining (temporary?) backward compatibility.
|
@pracucci , with the |
pracucci
left a comment
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.
LGTM (modulo a comment about alert_aggregation_labels_override). Please also add a CHANGELOG entry to explain the new config options.
| // - If an override of that value is detected, a warning will be printed | ||
| // - If no override was detected, it will be set to the `group_by_cluster` value, | ||
| // which will replace it altogether in the future. | ||
| local alert_aggregation_labels_override = ( |
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.
Good job here! I'm just wondering if we actually need this complexity. What we typically do is to introduce a breaking change (eg. stop using alert_aggregation_labels) and document it in the CHANGELOG. This mixin policy doesn't guarantee backward compatibility.
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.
I was concerned that my change could cause a phantom failure for someone, where their custom override would just stop working without any warning/error.
A plain old "error if alert_aggregation_labels is defined" would be less complex and solve my concern.
Let me know if/how you want this addressed in this PR.
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.
Let's not block on this. What you did looks correct, I'm just a bit worried about its maintenance, but not a blocker.
I would start as smallest as possible because the potential replacement is huge. If this PR solves your use case, I would start from here and work on it on incremental PRs. |
…czek/config-job-aggregation refactor: config for job aggregation strings
What this PR does:
(Updated based on suggestions below)
job_labels: ['cluster', 'namespace', 'job']cluster_labels: ['cluster', 'namespace']$._group_config, which gets mixed in where it is needed.namespacehard-coded in the query -- it has been updated to use the composition from$._cluster_labels._config.alert_aggregation_labels, since it is now a function of$._cluster_labelscluster_labelslist instead, which is what will happen ifalert_aggregation_labelsis not overridden.The resulting output does not change (unless any of the new lists in config are overridden), except in exactly one case where it was recommended to replace a hard-coded reference from
namespacetocluster, namespace, composed from$._config.cluster_labels.Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]