Skip to content

Conversation

@Shivs11
Copy link
Member

@Shivs11 Shivs11 commented May 28, 2025

What changed?

  • adding helpful metrics for queries so that we can understand customer impact

Metrics added in this PR are:

(Directly related to entity workflows)

  • WorkerDeploymentCreated
  • WorkerDeploymentVersionCreated
  • WorkerDeploymentVersionCreatedManagedByController
  • WorkerDeploymentVersionVisibilityQueryCount

(Not directly related to entity workflows)

  • WorkflowResetCount
  • WorkflowQuerySuccessCount
  • WorkflowQueryTimeoutCount
  • WorkflowQueryFailureCount
  • WorkflowTasksCompleted

Why?

  • vis

How did you test it?

  • built
  • run locally and tested manually
  • covered by existing tests
  • added new unit test(s)
  • added new functional test(s)

Potential risks

  • None

@Shivs11 Shivs11 force-pushed the shahab/versioning-metrics branch from 34253fa to cb580e2 Compare May 28, 2025 13:55
@Shivs11 Shivs11 marked this pull request as ready for review May 28, 2025 21:21
@Shivs11 Shivs11 requested a review from a team as a code owner May 28, 2025 21:21
return nil, consts.ErrQueryEnteredInvalidState
}
case workflow.QueryCompletionTypeUnblocked:
msResp, err := api.GetMutableState(ctx, shardContext, workflowKey, workflowConsistencyChecker)
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure pulling this call out is better :) I was suggesting to keep this part untouched. in line 182 you can get the behavior from the mutableState that we already have. (and then the behavior directly to emitWorkflowQueryMetrics)

Copy link
Member Author

Choose a reason for hiding this comment

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

If I extract behaviour outside, then this block of code (which I have now restored) won't get the chance to pass the most up-to-date behaviour

what I have now done is just pass msResp according to the scope it's in

Copy link
Contributor

Choose a reason for hiding this comment

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

why not? it can pass workflow.GetEffectiveVersioningBehavior(msResp.GetVersioningInfo()) instead of the old behavior

Copy link
Contributor

@ShahabT ShahabT left a comment

Choose a reason for hiding this comment

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

approved with a minor comment

emitWorkflowQueryMetrics(
metricsHandler,
nsEntry,
msResp,
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I still think the function should just get a behavior and we should pass workflow.GetEffectiveVersioningBehavior(msResp.GetVersioningInfo()) in here.

Then line 183 will just be behavior := mutableState.GetEffectiveBehavior() instead of msResp, err := api.MutableStateToGetResponse(mutableState)

Copy link
Member Author

Choose a reason for hiding this comment

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

i thought about that too, but inside emitWorkflowQueryMetrics we are using msResp to generate two different tags - one for versioningBehaviour, the other for WorkflowStatus tag. Sure, one could argue we could just pass these two as separate arguments but I think it's easier to read when not done so - moreover, if we were to increase the number of tags on this metric, there's a high chance those new tags might come from a MS field and it'll be nice to have msResp be present.

@Shivs11 Shivs11 enabled auto-merge (squash) May 29, 2025 16:19
@Shivs11 Shivs11 merged commit 5b4dcb9 into main May 29, 2025
56 checks passed
@Shivs11 Shivs11 deleted the shahab/versioning-metrics branch May 29, 2025 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants