-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #319 from grafana/darrenjaneczek/config-job-aggreg…
…ation refactor: config for job aggregation strings
- Loading branch information
Showing
9 changed files
with
77 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
local makePrefix(groups) = std.join('_', groups), | ||
local makeGroupBy(groups) = std.join(', ', groups), | ||
|
||
local group_by_cluster = makeGroupBy($._config.cluster_labels), | ||
|
||
_group_config+:: { | ||
// Each group prefix is composed of `_`-separated labels | ||
group_prefix_jobs: makePrefix($._config.job_labels), | ||
group_prefix_clusters: makePrefix($._config.cluster_labels), | ||
|
||
// Each group-by label list is `, `-separated and unique identifies | ||
group_by_job: makeGroupBy($._config.job_labels), | ||
group_by_cluster: group_by_cluster, | ||
}, | ||
|
||
// The following works around the deprecation of `$._config.alert_aggregation_labels` | ||
// - 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 = ( | ||
{ | ||
alert_aggregation_labels: null, | ||
} + super._config | ||
).alert_aggregation_labels, | ||
|
||
_config+:: { | ||
alert_aggregation_labels: | ||
if alert_aggregation_labels_override != null | ||
then std.trace( | ||
||| | ||
Deprecated: _config.alert_aggregation_labels | ||
This field has been explicitly overridden to "%s". | ||
Instead, express the override in terms of _config.cluster_labels. | ||
E.g., cluster_labels: %s will automatically convert to "%s". | ||
||| % [ | ||
alert_aggregation_labels_override, | ||
$._config.cluster_labels, | ||
group_by_cluster, | ||
], | ||
alert_aggregation_labels_override | ||
) | ||
else group_by_cluster, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
(import 'config.libsonnet') + | ||
(import 'groups.libsonnet') + | ||
(import 'dashboards.libsonnet') + | ||
(import 'alerts.libsonnet') + | ||
(import 'recording_rules.libsonnet') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters