Skip to content

Commit d8216ae

Browse files
Allow fairness weight overrides via UpdateTaskQueueConfig API (#626)
<!-- Describe what has changed in this PR --> **What changed?** + Added two update fairness weight maps to the UpdateTaskQueueConfig api request. + Added a fairness_weights map in the taskQueueConfig message to enable persistence and return response. <!-- Tell your future self why have you made these changes --> **Why?** + Allow override of fairness weights for individual fairness keys via UpdateTaskQueueConfig api. <!-- Are there any breaking changes on binary or code level? --> **Breaking changes** + No. <!-- If this breaks the Server, please provide the Server PR to merge right after this PR was merged. --> **Server PR** --------- Co-authored-by: Stephan Behnke <[email protected]> Co-authored-by: Stephan Behnke <[email protected]>
1 parent aa75b3e commit d8216ae

File tree

4 files changed

+54
-0
lines changed

4 files changed

+54
-0
lines changed

openapi/openapiv2.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9065,6 +9065,21 @@
90659065
"updateFairnessKeyRateLimitDefault": {
90669066
"$ref": "#/definitions/UpdateTaskQueueConfigRequestRateLimitUpdate",
90679067
"description": "Update to the default fairness key rate limit.\nIf not set, this configuration is unchanged.\nIf the `rate_limit` field in the `RateLimitUpdate` is missing, remove the existing rate limit."
9068+
},
9069+
"setFairnessWeightOverrides": {
9070+
"type": "object",
9071+
"additionalProperties": {
9072+
"type": "number",
9073+
"format": "float"
9074+
},
9075+
"description": "If set, overrides the fairness weight for each specified fairness key.\nFairness keys not listed in this map will keep their existing overrides (if any)."
9076+
},
9077+
"unsetFairnessWeightOverrides": {
9078+
"type": "array",
9079+
"items": {
9080+
"type": "string"
9081+
},
9082+
"description": "If set, removes any existing fairness weight overrides for each specified fairness key.\nFairness weights for corresponding keys fall back to the values set during task creation (if any),\nor to the default weight of 1.0."
90689083
}
90699084
}
90709085
},
@@ -15292,6 +15307,14 @@
1529215307
"fairnessKeysRateLimitDefault": {
1529315308
"$ref": "#/definitions/v1RateLimitConfig",
1529415309
"description": "If set, each individual fairness key will be limited to this rate, scaled by the weight of the fairness key."
15310+
},
15311+
"fairnessWeightOverrides": {
15312+
"type": "object",
15313+
"additionalProperties": {
15314+
"type": "number",
15315+
"format": "float"
15316+
},
15317+
"description": "If set, overrides the fairness weights for the corresponding fairness keys."
1529515318
}
1529615319
}
1529715320
},

openapi/openapiv3.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12339,6 +12339,12 @@ components:
1233912339
allOf:
1234012340
- $ref: '#/components/schemas/RateLimitConfig'
1234112341
description: If set, each individual fairness key will be limited to this rate, scaled by the weight of the fairness key.
12342+
fairnessWeightOverrides:
12343+
type: object
12344+
additionalProperties:
12345+
type: number
12346+
format: float
12347+
description: If set, overrides the fairness weights for the corresponding fairness keys.
1234212348
TaskQueueReachability:
1234312349
type: object
1234412350
properties:
@@ -12919,6 +12925,22 @@ components:
1291912925
Update to the default fairness key rate limit.
1292012926
If not set, this configuration is unchanged.
1292112927
If the `rate_limit` field in the `RateLimitUpdate` is missing, remove the existing rate limit.
12928+
setFairnessWeightOverrides:
12929+
type: object
12930+
additionalProperties:
12931+
type: number
12932+
format: float
12933+
description: |-
12934+
If set, overrides the fairness weight for each specified fairness key.
12935+
Fairness keys not listed in this map will keep their existing overrides (if any).
12936+
unsetFairnessWeightOverrides:
12937+
type: array
12938+
items:
12939+
type: string
12940+
description: |-
12941+
If set, removes any existing fairness weight overrides for each specified fairness key.
12942+
Fairness weights for corresponding keys fall back to the values set during task creation (if any),
12943+
or to the default weight of 1.0.
1292212944
UpdateTaskQueueConfigRequest_RateLimitUpdate:
1292312945
type: object
1292412946
properties:

temporal/api/taskqueue/v1/message.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,4 +343,6 @@ message TaskQueueConfig {
343343
RateLimitConfig queue_rate_limit = 1;
344344
// If set, each individual fairness key will be limited to this rate, scaled by the weight of the fairness key.
345345
RateLimitConfig fairness_keys_rate_limit_default = 2;
346+
// If set, overrides the fairness weights for the corresponding fairness keys.
347+
map<string, float> fairness_weight_overrides = 3;
346348
}

temporal/api/workflowservice/v1/request_response.proto

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2528,6 +2528,13 @@ message UpdateTaskQueueConfigRequest {
25282528
// If not set, this configuration is unchanged.
25292529
// If the `rate_limit` field in the `RateLimitUpdate` is missing, remove the existing rate limit.
25302530
RateLimitUpdate update_fairness_key_rate_limit_default = 6;
2531+
// If set, overrides the fairness weight for each specified fairness key.
2532+
// Fairness keys not listed in this map will keep their existing overrides (if any).
2533+
map<string, float> set_fairness_weight_overrides = 7;
2534+
// If set, removes any existing fairness weight overrides for each specified fairness key.
2535+
// Fairness weights for corresponding keys fall back to the values set during task creation (if any),
2536+
// or to the default weight of 1.0.
2537+
repeated string unset_fairness_weight_overrides = 8;
25312538
}
25322539

25332540
message UpdateTaskQueueConfigResponse {

0 commit comments

Comments
 (0)