Skip to content

Commit

Permalink
Metering metadata propagation (#3965)
Browse files Browse the repository at this point in the history
* Update proto submodule
  • Loading branch information
Sushisource authored Feb 16, 2023
1 parent 2db4175 commit 7ab7e9c
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 10 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ require (
go.opentelemetry.io/otel/metric v0.34.0
go.opentelemetry.io/otel/sdk v1.11.2
go.opentelemetry.io/otel/sdk/metric v0.34.0
go.temporal.io/api v1.17.0
go.temporal.io/api v1.18.1
go.temporal.io/sdk v1.21.1
go.temporal.io/version v0.3.0
go.uber.org/atomic v1.10.0
Expand Down Expand Up @@ -121,7 +121,7 @@ require (
go.uber.org/dig v1.15.0 // indirect
golang.org/x/crypto v0.3.0 // indirect
golang.org/x/mod v0.7.0 // indirect
golang.org/x/net v0.6.0 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
golang.org/x/tools v0.3.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -867,8 +867,8 @@ go.opentelemetry.io/proto/otlp v0.15.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI
go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw=
go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U=
go.temporal.io/api v1.16.0/go.mod h1:u3qLbaVTffmcZQbf9ueB+16LKmhkftH79SJOV517MDk=
go.temporal.io/api v1.17.0 h1:fVhGK9+FNAZv34YJGGnJaevnvZVsIuCFdOVhlikreeY=
go.temporal.io/api v1.17.0/go.mod h1:sCN2tPg4ZlrE0GDp8o1X40MBP7X4C9c7p7lzVS18qeU=
go.temporal.io/api v1.18.1 h1:kC3TS0iVXaAKe12L39I37b9X59x4p7E6512EfG/+RCU=
go.temporal.io/api v1.18.1/go.mod h1:VWdEGKUWRYKMkKJPo3wONuGZKay+d5L641b+JRuw0Bo=
go.temporal.io/sdk v1.21.1 h1:SJCzSsZLBsFiHniJ+E7Yy74pcAs1lg7NbFnsUJ4ggIM=
go.temporal.io/sdk v1.21.1/go.mod h1:Pq3Mp7p0lWNFM+YS2guBy8V/lJySh329AcyS+Wj/Wmo=
go.temporal.io/version v0.3.0 h1:dMrei9l9NyHt8nG6EB8vAwDLLTwx2SvRyucCSumAiig=
Expand Down Expand Up @@ -1008,8 +1008,8 @@ golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws=
golang.org/x/net v0.6.0 h1:L4ZwwTvKW9gr0ZMS1yrHD9GZhIuVjOBBnaKH+SPQK0Q=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down
2 changes: 2 additions & 0 deletions service/history/workflow/history_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ func (b *HistoryBuilder) AddWorkflowTaskCompletedEvent(
identity string,
checksum string,
sdkMetadata *sdkpb.WorkflowTaskCompletedMetadata,
meteringMetadata *commonpb.MeteringMetadata,
) *historypb.HistoryEvent {
event := b.createNewHistoryEvent(enumspb.EVENT_TYPE_WORKFLOW_TASK_COMPLETED, b.timeSource.Now())
event.Attributes = &historypb.HistoryEvent_WorkflowTaskCompletedEventAttributes{
Expand All @@ -259,6 +260,7 @@ func (b *HistoryBuilder) AddWorkflowTaskCompletedEvent(
Identity: identity,
BinaryChecksum: checksum,
SdkMetadata: sdkMetadata,
MeteringMetadata: meteringMetadata,
},
}

Expand Down
9 changes: 6 additions & 3 deletions service/history/workflow/history_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,13 +668,15 @@ func (s *historyBuilderSuite) TestWorkflowTaskCompleted() {
scheduledEventID := rand.Int63()
startedEventID := rand.Int63()
checksum := "random checksum"
metadata := &sdkpb.WorkflowTaskCompletedMetadata{CoreUsedFlags: []uint32{1, 2, 3}, LangUsedFlags: []uint32{4, 5, 6}}
sdkMetadata := &sdkpb.WorkflowTaskCompletedMetadata{CoreUsedFlags: []uint32{1, 2, 3}, LangUsedFlags: []uint32{4, 5, 6}}
meteringMeta := &commonpb.MeteringMetadata{NonfirstLocalActivityExecutionAttempts: 42}
event := s.historyBuilder.AddWorkflowTaskCompletedEvent(
scheduledEventID,
startedEventID,
testIdentity,
checksum,
metadata,
sdkMetadata,
meteringMeta,
)
s.Equal(event, s.flush())
s.Equal(&historypb.HistoryEvent{
Expand All @@ -689,7 +691,8 @@ func (s *historyBuilderSuite) TestWorkflowTaskCompleted() {
StartedEventId: startedEventID,
Identity: testIdentity,
BinaryChecksum: checksum,
SdkMetadata: metadata,
SdkMetadata: sdkMetadata,
MeteringMetadata: meteringMeta,
},
},
}, event)
Expand Down
1 change: 1 addition & 0 deletions service/history/workflow/workflow_task_state_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ func (m *workflowTaskStateMachine) AddWorkflowTaskCompletedEvent(
request.Identity,
request.BinaryChecksum,
request.SdkMetadata,
request.MeteringMetadata,
)

err := m.afterAddWorkflowTaskCompletedEvent(event, maxResetPoints)
Expand Down

0 comments on commit 7ab7e9c

Please sign in to comment.