Skip to content
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

refactor: config for job aggregation strings #319

Merged
merged 8 commits into from
Jun 10, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cortex-mixin/alerts/alerts.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
{
alert: 'CortexRequestLatency',
expr: |||
cluster_namespace_job_route:cortex_request_duration_seconds:99quantile{route!~"metrics|/frontend.Frontend/Process|ready|/schedulerpb.SchedulerForFrontend/FrontendLoop|/schedulerpb.SchedulerForQuerier/QuerierLoop"}
%(job_aggregation_prefix)s_route:cortex_request_duration_seconds:99quantile{route!~"metrics|/frontend.Frontend/Process|ready|/schedulerpb.SchedulerForFrontend/FrontendLoop|/schedulerpb.SchedulerForQuerier/QuerierLoop"}
>
%(cortex_p99_latency_threshold_seconds)s
||| % $._config,
Expand Down
5 changes: 5 additions & 0 deletions cortex-mixin/config.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
compactor: 'compactor.*', // Match also custom compactor deployments.
},

// Aggregation strings related to "jobs"
job_aggregation_prefix: 'cluster_namespace_job',
darrenjaneczek marked this conversation as resolved.
Show resolved Hide resolved
job_aggregation_labels_recording_rules: 'cluster, namespace, job',
job_aggregation_labels_active_series: 'namespace',

// Labels used to in alert aggregations - should uniquely identify
// a single Cortex cluster.
alert_aggregation_labels: 'cluster, namespace',
Expand Down
13 changes: 10 additions & 3 deletions cortex-mixin/dashboards/writes.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,24 @@ local utils = import 'mixin-utils/utils.libsonnet';
})
.addPanel(
$.panel('Samples / s') +
$.statPanel('sum(cluster_namespace_job:cortex_distributor_received_samples:rate5m{%s})' % $.jobMatcher($._config.job_names.distributor), format='reqps')
$.statPanel(
'sum(%(jobAggregationPrefix)s:cortex_distributor_received_samples:rate5m{%(job)s})' % {
job: $.jobMatcher($._config.job_names.distributor),
jobAggregationPrefix: $._config.job_aggregation_prefix,
},
darrenjaneczek marked this conversation as resolved.
Show resolved Hide resolved
format='reqps'
)
)
.addPanel(
$.panel('Active Series') +
$.statPanel(|||
sum(cortex_ingester_memory_series{%(ingester)s}
/ on(namespace) group_left
max by (namespace) (cortex_distributor_replication_factor{%(distributor)s}))
/ on(%(labels)s) group_left
max by (%(labels)s) (cortex_distributor_replication_factor{%(distributor)s}))
||| % {
ingester: $.jobMatcher($._config.job_names.ingester),
distributor: $.jobMatcher($._config.job_names.distributor),
labels: $._config.job_aggregation_labels_active_series,
darrenjaneczek marked this conversation as resolved.
Show resolved Hide resolved
}, format='short')
)
.addPanel(
Expand Down
11 changes: 6 additions & 5 deletions cortex-mixin/recording_rules.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ local utils = import 'mixin-utils/utils.libsonnet';
name: 'cortex_received_samples',
rules: [
{
record: 'cluster_namespace_job:cortex_distributor_received_samples:rate5m',
record: '%(job_aggregation_prefix)s:cortex_distributor_received_samples:rate5m' % $._config,
expr: |||
sum by (cluster, namespace, job) (rate(cortex_distributor_received_samples_total[5m]))
|||,
sum by (%(job_aggregation_labels_recording_rules)s) (rate(cortex_distributor_received_samples_total[5m]))
||| % $._config,
},
],
},
Expand All @@ -64,6 +64,7 @@ local utils = import 'mixin-utils/utils.libsonnet';
max_samples_per_sec_per_ingester: 80e3,
max_samples_per_sec_per_distributor: 240e3,
limit_utilisation_target: 0.6,
job_aggregation_prefix: $._config.job_aggregation_prefix,
},
name: 'cortex_scaling_rules',
rules: [
Expand All @@ -89,7 +90,7 @@ local utils = import 'mixin-utils/utils.libsonnet';
ceil(
quantile_over_time(0.99,
sum by (cluster, namespace) (
cluster_namespace_job:cortex_distributor_received_samples:rate5m
%(job_aggregation_prefix)s:cortex_distributor_received_samples:rate5m
)[24h:]
)
/ %(max_samples_per_sec_per_distributor)s
Expand Down Expand Up @@ -123,7 +124,7 @@ local utils = import 'mixin-utils/utils.libsonnet';
ceil(
quantile_over_time(0.99,
sum by (cluster, namespace) (
cluster_namespace_job:cortex_distributor_received_samples:rate5m
%(job_aggregation_prefix)s:cortex_distributor_received_samples:rate5m
)[24h:]
)
* 3 / %(max_samples_per_sec_per_ingester)s
Expand Down