Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
38 changes: 38 additions & 0 deletions openapi/openapiv2.json
Original file line number Diff line number Diff line change
Expand Up @@ -10045,6 +10045,28 @@
}
}
},
"v1Action": {
"type": "object",
"properties": {
"actionCount": {
"type": "integer",
"format": "int32"
}
}
},
"v1ActionMetadata": {
"type": "object",
"properties": {
"actions": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/v1Action"
},
"description": "A history event can be attributed to multiple actions\nEx. EVENT_TYPE_WORKFLOW_EXECUTION_STARTED, which is used by both Start\nWorkflow and Scheduled Workflow actions."
}
}
},
"v1ActivityExecutionInfo": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -12461,6 +12483,10 @@
},
"description": "Links associated with the event."
},
"serverMetadata": {
"$ref": "#/definitions/v1ServerMetadata",
"description": "The event details. The type must match that in `event_type`.\nActions metering metadata for the event."
},
"workflowExecutionStartedEventAttributes": {
"$ref": "#/definitions/v1WorkflowExecutionStartedEventAttributes"
},
Expand Down Expand Up @@ -14989,6 +15015,18 @@
}
}
},
"v1ServerMetadata": {
"type": "object",
"properties": {
"actionMetadata": {
"$ref": "#/definitions/v1ActionMetadata"
},
"eventSize": {
"type": "integer",
"format": "int32"
}
}
},
"v1SetCurrentDeploymentResponse": {
"type": "object",
"properties": {
Expand Down
31 changes: 31 additions & 0 deletions openapi/openapiv3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7237,6 +7237,23 @@ paths:
$ref: '#/components/schemas/Status'
components:
schemas:
Action:
type: object
properties:
actionCount:
type: integer
format: int32
ActionMetadata:
type: object
properties:
actions:
type: array
items:
$ref: '#/components/schemas/Action'
description: |-
A history event can be attributed to multiple actions
Ex. EVENT_TYPE_WORKFLOW_EXECUTION_STARTED, which is used by both Start
Workflow and Scheduled Workflow actions.
ActivityExecutionInfo:
type: object
properties:
Expand Down Expand Up @@ -9707,6 +9724,12 @@ components:
items:
$ref: '#/components/schemas/Link'
description: Links associated with the event.
serverMetadata:
allOf:
- $ref: '#/components/schemas/ServerMetadata'
description: |-
The event details. The type must match that in `event_type`.
Actions metering metadata for the event.
workflowExecutionStartedEventAttributes:
$ref: '#/components/schemas/WorkflowExecutionStartedEventAttributes'
workflowExecutionCompletedEventAttributes:
Expand Down Expand Up @@ -12612,6 +12635,14 @@ components:
properties:
nonRetryable:
type: boolean
ServerMetadata:
type: object
properties:
actionMetadata:
$ref: '#/components/schemas/ActionMetadata'
eventSize:
type: integer
format: int32
SetCurrentDeploymentRequest:
type: object
properties:
Expand Down
4 changes: 4 additions & 0 deletions temporal/api/history/v1/message.proto
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import "temporal/api/update/v1/message.proto";
import "temporal/api/workflow/v1/message.proto";
import "temporal/api/sdk/v1/task_complete_metadata.proto";
import "temporal/api/sdk/v1/user_metadata.proto";
import "temporal/api/server/v1/message.proto";

// Always the first event in workflow history
message WorkflowExecutionStartedEventAttributes {
Expand Down Expand Up @@ -1115,6 +1116,9 @@ message HistoryEvent {
// Links associated with the event.
repeated temporal.api.common.v1.Link links = 302;
// The event details. The type must match that in `event_type`.
// Actions metering metadata for the event.
temporal.api.server.v1.ServerMetadata server_metadata = 303;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think most of the fields here could be considered server metadata, you could just inline the ActionMetadata here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having a separate server metadata field would make sense if it is supposed to be applied in other places though.

Copy link
Member

@cretz cretz Jan 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately the PR where the discussion was occurring was closed. But bringing back the discussion from #701 (comment), I do not believe we should inundate history with redundant information. If people can iterate history and count actions, they can iterate history and count (certain) events.

We should not use the burden of having to read history, which already has many cryptic elements and we provide UIs and CLIs for understanding, as justification for adding redundant data.

Also, this doesn't even solve the problem of missing data (e.g. query and heartbeat counts). History is not the place for this information IMO. We should have a more general discussion about how one can derive action count from history, but this not only doesn't solve that, it inundates everyone's history format with redundant information.


oneof attributes {
WorkflowExecutionStartedEventAttributes workflow_execution_started_event_attributes = 6;
WorkflowExecutionCompletedEventAttributes workflow_execution_completed_event_attributes = 7;
Expand Down
24 changes: 24 additions & 0 deletions temporal/api/server/v1/message.proto
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think we need an entirely new proto package for this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do need a new package, please use a different name: we have temporal.server.api... for internal protos which is already somewhat confusing, let's not also have temporal.api.server. Maybe temporal.api.metering or temporal.api.cloudmetering to be clear this is a cloud concept?

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
syntax = "proto3";

package temporal.api.server.v1;

option go_package = "go.temporal.io/api/server/v1;server";
option java_package = "io.temporal.api.server.v1";
option java_outer_classname = "MessageProto";
option java_multiple_files = true;

message ActionMetadata {
// A history event can be attributed to multiple actions
// Ex. EVENT_TYPE_WORKFLOW_EXECUTION_STARTED, which is used by both Start
// Workflow and Scheduled Workflow actions.
repeated Action actions = 1;
}

message Action {
int32 action_count = 1;
}

message ServerMetadata {
ActionMetadata action_metadata = 1;
int32 event_size = 2;
}
Loading