Skip to content

Commit

Permalink
Merge pull request grafana/cortex-jsonnet#391 from grafana/split-limi…
Browse files Browse the repository at this point in the history
…ts-config

Split limits config into a variable we can reuse
  • Loading branch information
gouthamve authored Sep 13, 2021
2 parents 60c5a8b + 2f255ac commit 66b972b
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 13 deletions.
24 changes: 24 additions & 0 deletions operations/mimir/config.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,30 @@
// These are the defaults.
limits: $._config.overrides.extra_small_user,

// These are all the flags for the default limits.
distributorLimitsConfig: {
'distributor.ingestion-rate-limit-strategy': 'global',
'distributor.ingestion-rate-limit': $._config.limits.ingestion_rate,
'distributor.ingestion-burst-size': $._config.limits.ingestion_burst_size,
},
ingesterLimitsConfig: {
'ingester.max-series-per-user': $._config.limits.max_series_per_user,
'ingester.max-series-per-metric': $._config.limits.max_series_per_metric,
'ingester.max-global-series-per-user': $._config.limits.max_global_series_per_user,
'ingester.max-global-series-per-metric': $._config.limits.max_global_series_per_metric,
'ingester.max-series-per-query': $._config.limits.max_series_per_query,
'ingester.max-samples-per-query': $._config.limits.max_samples_per_query,
},
rulerLimitsConfig: {
'ruler.max-rules-per-rule-group': $._config.limits.ruler_max_rules_per_rule_group,
'ruler.max-rule-groups-per-tenant': $._config.limits.ruler_max_rule_groups_per_tenant,
},
compactorLimitsConfig: {
'compactor.blocks-retention-period': $._config.limits.compactor_blocks_retention_period,
},

limitsConfig: self.distributorLimitsConfig + self.ingesterLimitsConfig + self.rulerLimitsConfig + self.compactorLimitsConfig,

overrides_configmap: 'overrides',

overrides: {
Expand Down
5 changes: 1 addition & 4 deletions operations/mimir/distributor.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
$._config.grpcConfig +
$._config.ringConfig +
$._config.distributorConfig +
$._config.distributorLimitsConfig +
{
target: 'distributor',

Expand All @@ -29,10 +30,6 @@
'server.grpc.keepalive.max-connection-age-grace': '5m',
'server.grpc.keepalive.max-connection-idle': '1m',

'distributor.ingestion-rate-limit-strategy': 'global',
'distributor.ingestion-rate-limit': $._config.limits.ingestion_rate,
'distributor.ingestion-burst-size': $._config.limits.ingestion_burst_size,

// The ingestion rate global limit requires the distributors to form a ring.
'distributor.ring.consul.hostname': 'consul.%s.svc.cluster.local:8500' % $._config.namespace,
'distributor.ring.prefix': '',
Expand Down
7 changes: 1 addition & 6 deletions operations/mimir/ingester.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
$._config.storageConfig +
$._config.blocksStorageConfig +
$._config.distributorConfig + // This adds the distributor ring flags to the ingester.
$._config.ingesterLimitsConfig +
{
target: 'ingester',

Expand All @@ -24,12 +25,6 @@

// Limits config.
'ingester.max-chunk-idle': $._config.max_chunk_idle,
'ingester.max-series-per-user': $._config.limits.max_series_per_user,
'ingester.max-series-per-metric': $._config.limits.max_series_per_metric,
'ingester.max-global-series-per-user': $._config.limits.max_global_series_per_user,
'ingester.max-global-series-per-metric': $._config.limits.max_global_series_per_metric,
'ingester.max-series-per-query': $._config.limits.max_series_per_query,
'ingester.max-samples-per-query': $._config.limits.max_samples_per_query,
'runtime-config.file': '/etc/cortex/overrides.yaml',
'server.grpc-max-concurrent-streams': 10000,
'server.grpc-max-send-msg-size-bytes': 10 * 1024 * 1024,
Expand Down
2 changes: 0 additions & 2 deletions operations/mimir/ruler.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
'ruler.ring.consul.hostname': 'consul.%s.svc.cluster.local:8500' % $._config.namespace,

// Limits
'ruler.max-rules-per-rule-group': $._config.limits.ruler_max_rules_per_rule_group,
'ruler.max-rule-groups-per-tenant': $._config.limits.ruler_max_rule_groups_per_tenant,
'server.grpc-max-send-msg-size-bytes': 10 * 1024 * 1024,
'server.grpc-max-recv-msg-size-bytes': 10 * 1024 * 1024,

Expand Down
2 changes: 1 addition & 1 deletion operations/mimir/tsdb.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
$._config.grpcConfig +
$._config.storageConfig +
$._config.blocksStorageConfig +
$._config.compactorLimitsConfig +
{
target: 'compactor',

Expand All @@ -162,7 +163,6 @@

// Limits config.
'runtime-config.file': '/etc/cortex/overrides.yaml',
'compactor.blocks-retention-period': $._config.limits.compactor_blocks_retention_period,
},

compactor_ports:: $.util.defaultPorts,
Expand Down

0 comments on commit 66b972b

Please sign in to comment.