Skip to content

Commit

Permalink
Add metric for async request payload size
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaddoll committed May 2, 2024
1 parent 959c5bf commit 7256764
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions common/metrics/defs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2178,6 +2178,8 @@ const (

HashringViewIdentifier

AsyncRequestPayloadSize

NumCommonMetrics // Needs to be last on this list for iota numbering
)

Expand Down Expand Up @@ -2817,6 +2819,8 @@ var MetricDefs = map[ServiceIdx]map[int]metricDefinition{
IsolationGroupStateHealthy: {metricName: "isolation_group_healthy", metricType: Counter},
ValidatedWorkflowCount: {metricName: "task_validator_count", metricType: Counter},
HashringViewIdentifier: {metricName: "hashring_view_identifier", metricType: Counter},

AsyncRequestPayloadSize: {metricName: "async_request_payload_size_per_domain", metricRollupName: "async_request_payload_size", metricType: Timer},
},
History: {
TaskRequests: {metricName: "task_requests", metricType: Counter},
Expand Down
2 changes: 2 additions & 0 deletions service/frontend/api/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1771,6 +1771,7 @@ func (wh *WorkflowHandler) StartWorkflowExecutionAsync(
if err != nil {
return nil, fmt.Errorf("failed to encode StartWorkflowExecutionAsyncRequest: %v", err)
}
scope.RecordTimer(metrics.AsyncRequestPayloadSize, time.Duration(len(payload)))

// propagate the headers from the context to the message
header := &shared.Header{
Expand Down Expand Up @@ -2351,6 +2352,7 @@ func (wh *WorkflowHandler) SignalWithStartWorkflowExecutionAsync(
if err != nil {
return nil, fmt.Errorf("failed to encode SignalWithStartWorkflowExecutionAsyncRequest: %v", err)
}
scope.RecordTimer(metrics.AsyncRequestPayloadSize, time.Duration(len(payload)))

// propagate the headers from the context to the message
header := &shared.Header{
Expand Down

0 comments on commit 7256764

Please sign in to comment.