Skip to content

Commit ec8d4ef

Browse files
authored
VersionLocalState in sync with VersionSummary + Activation/Deactivation timestamps (#585)
_**READ BEFORE MERGING:** All PRs require approval by both Server AND SDK teams before merging! This is why the number of required approvals is "2" and not "1"--two reviewers from the same team is NOT sufficient. If your PR is not approved by someone in BOTH teams, it may be summarily reverted._ <!-- Describe what has changed in this PR --> **What changed?** - Added two new timestamps to signify when a version first/last receives traffic in the `WorkerDeploymentVersionInfo` and `WorkerDeploymentInfo`. Added missing fields from VersionLocalState that were not present in VersionSummary. <!-- Tell your future self why have you made these changes --> **Why?** - Adding the two new timestamps shall allow operators to have more visibility into when a version gets activated/deactivated. - The reason fields from `VersionLocalState` were added to the `VersionSummary` is because the UI, right now, is querying a bunch of different places to get information about a specific version. This might be annoying and the aim of this PR is to make VersionSummary the source of truth for information related to a specific version. A nice cherry on top is that this shall also reduce the number of API calls to get information about a version. <!-- Are there any breaking changes on binary or code level? --> **Breaking changes** - None <!-- If this breaks the Server, please provide the Server PR to merge right after this PR was merged. --> **Server PR** - temporalio/temporal#7736)
1 parent 9263046 commit ec8d4ef

File tree

3 files changed

+111
-7
lines changed

3 files changed

+111
-7
lines changed

openapi/openapiv2.json

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7104,7 +7104,37 @@
71047104
"format": "date-time"
71057105
},
71067106
"drainageStatus": {
7107-
"$ref": "#/definitions/v1VersionDrainageStatus"
7107+
"$ref": "#/definitions/v1VersionDrainageStatus",
7108+
"description": "Deprecated. Use `drainage_info` instead."
7109+
},
7110+
"drainageInfo": {
7111+
"$ref": "#/definitions/v1VersionDrainageInfo",
7112+
"title": "Information about workflow drainage to help the user determine when it is safe\nto decommission a Version. Not present while version is current or ramping"
7113+
},
7114+
"currentSinceTime": {
7115+
"type": "string",
7116+
"format": "date-time",
7117+
"description": "Unset if not current."
7118+
},
7119+
"rampingSinceTime": {
7120+
"type": "string",
7121+
"format": "date-time",
7122+
"description": "Unset if not ramping. Updated when the version first starts ramping, not on each ramp change."
7123+
},
7124+
"routingUpdateTime": {
7125+
"type": "string",
7126+
"format": "date-time",
7127+
"description": "Last time `current_since_time`, `ramping_since_time, or `ramp_percentage` of this version changed."
7128+
},
7129+
"firstActivationTime": {
7130+
"type": "string",
7131+
"format": "date-time",
7132+
"description": "Timestamp when this version first became current or ramping."
7133+
},
7134+
"lastDeactivationTime": {
7135+
"type": "string",
7136+
"format": "date-time",
7137+
"description": "Timestamp when this version last stopped being current or ramping."
71087138
}
71097139
}
71107140
},
@@ -14933,12 +14963,22 @@
1493314963
"currentSinceTime": {
1493414964
"type": "string",
1493514965
"format": "date-time",
14936-
"description": "\nNil if not current."
14966+
"description": "\nUnset if not current."
1493714967
},
1493814968
"rampingSinceTime": {
1493914969
"type": "string",
1494014970
"format": "date-time",
14941-
"description": "\nNil if not ramping. Updated when the version first starts ramping, not on each ramp change."
14971+
"description": "\nUnset if not ramping. Updated when the version first starts ramping, not on each ramp change."
14972+
},
14973+
"firstActivationTime": {
14974+
"type": "string",
14975+
"format": "date-time",
14976+
"description": "Timestamp when this version first became current or ramping."
14977+
},
14978+
"lastDeactivationTime": {
14979+
"type": "string",
14980+
"format": "date-time",
14981+
"description": "Timestamp when this version last stopped being current or ramping."
1494214982
},
1494314983
"rampPercentage": {
1494414984
"type": "number",

openapi/openapiv3.yaml

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12221,7 +12221,40 @@ components:
1222112221
- VERSION_DRAINAGE_STATUS_DRAINING
1222212222
- VERSION_DRAINAGE_STATUS_DRAINED
1222312223
type: string
12224+
description: Deprecated. Use `drainage_info` instead.
1222412225
format: enum
12226+
drainageInfo:
12227+
allOf:
12228+
- $ref: '#/components/schemas/VersionDrainageInfo'
12229+
description: |-
12230+
Information about workflow drainage to help the user determine when it is safe
12231+
to decommission a Version. Not present while version is current or ramping
12232+
currentSinceTime:
12233+
type: string
12234+
description: |-
12235+
Unset if not current.
12236+
(-- api-linter: core::0140::prepositions=disabled
12237+
aip.dev/not-precedent: 'Since' captures the field semantics despite being a preposition. --)
12238+
format: date-time
12239+
rampingSinceTime:
12240+
type: string
12241+
description: |-
12242+
Unset if not ramping. Updated when the version first starts ramping, not on each ramp change.
12243+
(-- api-linter: core::0140::prepositions=disabled
12244+
aip.dev/not-precedent: 'Since' captures the field semantics despite being a preposition. --)
12245+
format: date-time
12246+
routingUpdateTime:
12247+
type: string
12248+
description: Last time `current_since_time`, `ramping_since_time, or `ramp_percentage` of this version changed.
12249+
format: date-time
12250+
firstActivationTime:
12251+
type: string
12252+
description: Timestamp when this version first became current or ramping.
12253+
format: date-time
12254+
lastDeactivationTime:
12255+
type: string
12256+
description: Timestamp when this version last stopped being current or ramping.
12257+
format: date-time
1222512258
WorkerDeploymentOptions:
1222612259
type: object
1222712260
properties:
@@ -12290,14 +12323,22 @@ components:
1229012323
description: |-
1229112324
(-- api-linter: core::0140::prepositions=disabled
1229212325
aip.dev/not-precedent: 'Since' captures the field semantics despite being a preposition. --)
12293-
Nil if not current.
12326+
Unset if not current.
1229412327
format: date-time
1229512328
rampingSinceTime:
1229612329
type: string
1229712330
description: |-
1229812331
(-- api-linter: core::0140::prepositions=disabled
1229912332
aip.dev/not-precedent: 'Since' captures the field semantics despite being a preposition. --)
12300-
Nil if not ramping. Updated when the version first starts ramping, not on each ramp change.
12333+
Unset if not ramping. Updated when the version first starts ramping, not on each ramp change.
12334+
format: date-time
12335+
firstActivationTime:
12336+
type: string
12337+
description: Timestamp when this version first became current or ramping.
12338+
format: date-time
12339+
lastDeactivationTime:
12340+
type: string
12341+
description: Timestamp when this version last stopped being current or ramping.
1230112342
format: date-time
1230212343
rampPercentage:
1230312344
type: number

temporal/api/deployment/v1/message.proto

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,19 @@ message WorkerDeploymentVersionInfo {
107107

108108
// (-- api-linter: core::0140::prepositions=disabled
109109
// aip.dev/not-precedent: 'Since' captures the field semantics despite being a preposition. --)
110-
// Nil if not current.
110+
// Unset if not current.
111111
google.protobuf.Timestamp current_since_time = 5;
112112

113113
// (-- api-linter: core::0140::prepositions=disabled
114114
// aip.dev/not-precedent: 'Since' captures the field semantics despite being a preposition. --)
115-
// Nil if not ramping. Updated when the version first starts ramping, not on each ramp change.
115+
// Unset if not ramping. Updated when the version first starts ramping, not on each ramp change.
116116
google.protobuf.Timestamp ramping_since_time = 6;
117117

118+
// Timestamp when this version first became current or ramping.
119+
google.protobuf.Timestamp first_activation_time = 12;
120+
// Timestamp when this version last stopped being current or ramping.
121+
google.protobuf.Timestamp last_deactivation_time = 13;
122+
118123
// Range: [0, 100]. Must be zero if the version is not ramping (i.e. `ramping_since_time` is nil).
119124
// Can be in the range [0, 100] if the version is ramping.
120125
float ramp_percentage = 7;
@@ -193,7 +198,25 @@ message WorkerDeploymentInfo {
193198
// Required.
194199
WorkerDeploymentVersion deployment_version = 4;
195200
google.protobuf.Timestamp create_time = 2;
201+
// Deprecated. Use `drainage_info` instead.
196202
enums.v1.VersionDrainageStatus drainage_status = 3;
203+
// Information about workflow drainage to help the user determine when it is safe
204+
// to decommission a Version. Not present while version is current or ramping
205+
VersionDrainageInfo drainage_info = 5;
206+
// Unset if not current.
207+
// (-- api-linter: core::0140::prepositions=disabled
208+
// aip.dev/not-precedent: 'Since' captures the field semantics despite being a preposition. --)
209+
google.protobuf.Timestamp current_since_time = 6;
210+
// Unset if not ramping. Updated when the version first starts ramping, not on each ramp change.
211+
// (-- api-linter: core::0140::prepositions=disabled
212+
// aip.dev/not-precedent: 'Since' captures the field semantics despite being a preposition. --)
213+
google.protobuf.Timestamp ramping_since_time = 7;
214+
// Last time `current_since_time`, `ramping_since_time, or `ramp_percentage` of this version changed.
215+
google.protobuf.Timestamp routing_update_time = 8;
216+
// Timestamp when this version first became current or ramping.
217+
google.protobuf.Timestamp first_activation_time = 9;
218+
// Timestamp when this version last stopped being current or ramping.
219+
google.protobuf.Timestamp last_deactivation_time = 10;
197220
}
198221
}
199222

0 commit comments

Comments
 (0)