Commit 54ef6e6e authored by Bob Van Landuyt's avatar Bob Van Landuyt

Rename some queue urgencies

This renames the default queue urgency from `default` to `low` and the
latency without SLOs from `none` to `throttled`.
parent f8d715ce
This diff is collapsed.
...@@ -8,7 +8,7 @@ module WorkerAttributes ...@@ -8,7 +8,7 @@ module WorkerAttributes
VALID_RESOURCE_BOUNDARIES = [:memory, :cpu, :unknown].freeze VALID_RESOURCE_BOUNDARIES = [:memory, :cpu, :unknown].freeze
# Urgencies that workers can declare through the `urgencies` attribute # Urgencies that workers can declare through the `urgencies` attribute
VALID_URGENCIES = [:high, :default, :none].freeze VALID_URGENCIES = [:high, :low, :throttled].freeze
NAMESPACE_WEIGHTS = { NAMESPACE_WEIGHTS = {
auto_devops: 2, auto_devops: 2,
...@@ -65,7 +65,7 @@ module WorkerAttributes ...@@ -65,7 +65,7 @@ module WorkerAttributes
end end
def get_urgency def get_urgency
worker_attributes[:urgency] || :default worker_attributes[:urgency] || :low
end end
# Set this attribute on a job when it will call to services outside of the # Set this attribute on a job when it will call to services outside of the
......
...@@ -130,7 +130,7 @@ following attributes: ...@@ -130,7 +130,7 @@ following attributes:
- `has_external_dependencies` - whether or not the queue connects to external - `has_external_dependencies` - whether or not the queue connects to external
services. For example, all importers have this set to `true`. services. For example, all importers have this set to `true`.
- `urgency` - how important it is that this queue's jobs run - `urgency` - how important it is that this queue's jobs run
quickly. Can be `high`, `default`, or `none`. For example, the quickly. Can be `high`, `low`, or `throttled`. For example, the
`authorized_projects` queue is used to refresh user permissions, and `authorized_projects` queue is used to refresh user permissions, and
is high urgency. is high urgency.
- `name` - the queue name. The other attributes are typically more useful as - `name` - the queue name. The other attributes are typically more useful as
......
...@@ -124,13 +124,13 @@ Consider skipping the cop if you're not confident your job can safely run multip ...@@ -124,13 +124,13 @@ Consider skipping the cop if you're not confident your job can safely run multip
## Job urgency ## Job urgency
Jobs can have an `urgency` attribute set, which can be `:high`, Jobs can have an `urgency` attribute set, which can be `:high`,
`:default`, or `:none`. These have the below targets: `:low`, or `:throttled`. These have the below targets:
| **Urgency** | **Queue Scheduling Target** | **Execution Latency Requirement** | | **Urgency** | **Queue Scheduling Target** | **Execution Latency Requirement** |
|-------------|-----------------------------|------------------------------------| |--------------|-----------------------------|------------------------------------|
| `:high` | 100 milliseconds | p50 of 1 second, p99 of 10 seconds | | `:high` | 100 milliseconds | p50 of 1 second, p99 of 10 seconds |
| `:default` | 1 minute | Maximum run time of 1 hour | | `:low` | 1 minute | Maximum run time of 1 hour |
| `:none` | None | Maximum run time of 1 hour | | `:throttled` | None | Maximum run time of 1 hour |
To set a job's urgency, use the `urgency` class method: To set a job's urgency, use the `urgency` class method:
...@@ -175,7 +175,7 @@ these jobs also have very strict execution duration requirements: ...@@ -175,7 +175,7 @@ these jobs also have very strict execution duration requirements:
If a worker cannot meet these expectations, then it cannot be treated as a If a worker cannot meet these expectations, then it cannot be treated as a
`urgency :high` worker: consider redesigning the worker, or splitting the `urgency :high` worker: consider redesigning the worker, or splitting the
work between two different workers, one with `urgency :high` code that work between two different workers, one with `urgency :high` code that
executes quickly, and the other with `urgency :default`, which has no executes quickly, and the other with `urgency :low`, which has no
execution latency requirements (but also has lower scheduling targets). execution latency requirements (but also has lower scheduling targets).
## Jobs with External Dependencies ## Jobs with External Dependencies
......
This diff is collapsed.
...@@ -124,7 +124,7 @@ describe Gitlab::SidekiqConfig::CliMethods do ...@@ -124,7 +124,7 @@ describe Gitlab::SidekiqConfig::CliMethods do
name: 'a', name: 'a',
feature_category: :category_a, feature_category: :category_a,
has_external_dependencies: false, has_external_dependencies: false,
urgency: :default, urgency: :low,
resource_boundary: :cpu resource_boundary: :cpu
}, },
{ {
...@@ -145,7 +145,7 @@ describe Gitlab::SidekiqConfig::CliMethods do ...@@ -145,7 +145,7 @@ describe Gitlab::SidekiqConfig::CliMethods do
name: 'c', name: 'c',
feature_category: :category_c, feature_category: :category_c,
has_external_dependencies: false, has_external_dependencies: false,
urgency: :none, urgency: :throttled,
resource_boundary: :memory resource_boundary: :memory
} }
] ]
...@@ -168,9 +168,9 @@ describe Gitlab::SidekiqConfig::CliMethods do ...@@ -168,9 +168,9 @@ describe Gitlab::SidekiqConfig::CliMethods do
# urgency # urgency
'urgency=high' | %w(a:2 b) 'urgency=high' | %w(a:2 b)
'urgency=default' | %w(a) 'urgency=low' | %w(a)
'urgency=high,default,none' | %w(a a:2 b c) 'urgency=high,low,throttled' | %w(a a:2 b c)
'urgency=default|urgency=none' | %w(a c) 'urgency=low|urgency=throttled' | %w(a c)
'urgency!=high' | %w(a c) 'urgency!=high' | %w(a c)
# name # name
......
...@@ -88,7 +88,7 @@ describe Gitlab::SidekiqConfig::Worker do ...@@ -88,7 +88,7 @@ describe Gitlab::SidekiqConfig::Worker do
attributes_a = { attributes_a = {
feature_category: :source_code_management, feature_category: :source_code_management,
has_external_dependencies: false, has_external_dependencies: false,
urgency: :default, urgency: :low,
resource_boundary: :memory, resource_boundary: :memory,
weight: 2, weight: 2,
idempotent: true idempotent: true
......
...@@ -9,7 +9,7 @@ describe Gitlab::SidekiqMiddleware::ClientMetrics do ...@@ -9,7 +9,7 @@ describe Gitlab::SidekiqMiddleware::ClientMetrics do
let(:queue) { :test } let(:queue) { :test }
let(:worker_class) { worker.class } let(:worker_class) { worker.class }
let(:job) { {} } let(:job) { {} }
let(:default_labels) { { queue: queue.to_s, boundary: "", external_dependencies: "no", feature_category: "", urgency: "default" } } let(:default_labels) { { queue: queue.to_s, boundary: "", external_dependencies: "no", feature_category: "", urgency: "low" } }
shared_examples "a metrics client middleware" do shared_examples "a metrics client middleware" do
context "with mocked prometheus" do context "with mocked prometheus" do
...@@ -80,8 +80,8 @@ describe Gitlab::SidekiqMiddleware::ClientMetrics do ...@@ -80,8 +80,8 @@ describe Gitlab::SidekiqMiddleware::ClientMetrics do
context "no urgency" do context "no urgency" do
it_behaves_like "a metrics client middleware" do it_behaves_like "a metrics client middleware" do
let(:urgency) { :none } let(:urgency) { :throttled }
let(:labels) { default_labels.merge(urgency: "none") } let(:labels) { default_labels.merge(urgency: "throttled") }
end end
end end
......
...@@ -11,7 +11,7 @@ describe Gitlab::SidekiqMiddleware::ServerMetrics do ...@@ -11,7 +11,7 @@ describe Gitlab::SidekiqMiddleware::ServerMetrics do
let(:job) { {} } let(:job) { {} }
let(:job_status) { :done } let(:job_status) { :done }
let(:labels_with_job_status) { labels.merge(job_status: job_status.to_s) } let(:labels_with_job_status) { labels.merge(job_status: job_status.to_s) }
let(:default_labels) { { queue: queue.to_s, boundary: "", external_dependencies: "no", feature_category: "", urgency: "default" } } let(:default_labels) { { queue: queue.to_s, boundary: "", external_dependencies: "no", feature_category: "", urgency: "low" } }
shared_examples "a metrics middleware" do shared_examples "a metrics middleware" do
context "with mocked prometheus" do context "with mocked prometheus" do
...@@ -202,11 +202,11 @@ describe Gitlab::SidekiqMiddleware::ServerMetrics do ...@@ -202,11 +202,11 @@ describe Gitlab::SidekiqMiddleware::ServerMetrics do
end end
context "combined" do context "combined" do
let(:urgency) { :none } let(:urgency) { :throttled }
let(:external_dependencies) { true } let(:external_dependencies) { true }
let(:resource_boundary) { :cpu } let(:resource_boundary) { :cpu }
let(:feature_category) { :authentication } let(:feature_category) { :authentication }
let(:labels) { default_labels.merge(urgency: "none", external_dependencies: "yes", boundary: "cpu", feature_category: "authentication") } let(:labels) { default_labels.merge(urgency: "throttled", external_dependencies: "yes", boundary: "cpu", feature_category: "authentication") }
it_behaves_like "a metrics middleware" it_behaves_like "a metrics middleware"
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment