Skip to content

Conversation

@Shivs11
Copy link
Member

@Shivs11 Shivs11 commented May 28, 2025

What changed?

  • metrics for DeploymentTransition + VersioningOverride

Why?

  • versioning-0.32

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

  • a little new to this side of the code involving versioning so a bit scared about doing things wrong, hopefully I am not

@Shivs11 Shivs11 requested a review from a team as a code owner May 28, 2025 19:38
@Shivs11 Shivs11 changed the title metrics for DeploymentTransition + VersioningOverride Versioning Metrics pt2: DeploymentTransition + VersioningOverride May 28, 2025
}

// Versioning Override set via UpdateWorkflowExecutionOptionsRequest
if versioningOverride != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

the API may be called for other things too. let's only emit the metric if effective behavior OR effective version changes.

metrics.NamespaceTag(ms.namespaceEntry.Name().String()),
metrics.VersioningBehaviorBeforeOverrideTag(enumspb.VERSIONING_BEHAVIOR_UNSPECIFIED),
metrics.VersioningBehaviorAfterOverrideTag(startRequest.GetStartRequest().GetVersioningOverride().GetBehavior()), //nolint:staticcheck // SA1019: worker versioning v0.31
metrics.VersioningOverrideOnNewWorkflowTag(prevRunID == ""),
Copy link
Contributor

Choose a reason for hiding this comment

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

it'd be super cool if instead we could have the following values:
_new, _child, _can, _retry, _cron. For the last three you can look at the initiator field.

Add a _existing to the list to cover the case of UpdateOptions.

Copy link
Member Author

Choose a reason for hiding this comment

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

let me know if you like with what I just came up with

Comment on lines 8161 to 8163
metrics.EffectiveDeploymentBeforeTransitionTag(worker_versioning.ExternalWorkerDeploymentVersionToString(worker_versioning.ExternalWorkerDeploymentVersionFromDeployment(preTransitionEffectiveDeployment))),
metrics.EffectiveDeploymentAfterTransitionTag(worker_versioning.ExternalWorkerDeploymentVersionToString(worker_versioning.ExternalWorkerDeploymentVersionFromDeployment(deployment))),
),
Copy link
Contributor

Choose a reason for hiding this comment

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

I think here we just want two bools: from_unversioned=true/false, to_unversioned=true/false

if prevRunID == "" {
return &tagImpl{key: runInitiator, value: newRun}
} else if attributes.GetInitiator() == enumspb.CONTINUE_AS_NEW_INITIATOR_WORKFLOW {
return &tagImpl{key: runInitiator, value: childRun}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return &tagImpl{key: runInitiator, value: childRun}
return &tagImpl{key: runInitiator, value: canRun}

Comment on lines 61 to 66
newRun = "__new"
existingRun = "__existing"
childRun = "__child"
canRun = "__can"
retryRun = "__retry"
cronRun = "__cron"
Copy link
Contributor

Choose a reason for hiding this comment

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

actually, I don't think we need the __ prefixes for this values, it's not like these are special or place-holder values, these are all the values that the tag can get.

Comment on lines +8163 to +8164
metrics.FromUnversionedTag(worker_versioning.ExternalWorkerDeploymentVersionToString(worker_versioning.ExternalWorkerDeploymentVersionFromDeployment(preTransitionEffectiveDeployment))),
metrics.ToUnversionedTag(worker_versioning.ExternalWorkerDeploymentVersionToString(worker_versioning.ExternalWorkerDeploymentVersionFromDeployment(deployment))),
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 have FromUnversionedTag get a deployment directly? it's nice to not introduce new code that uses strings.

Copy link
Member Author

Choose a reason for hiding this comment

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

Passing the deployment as is to the tags file and letting that be responsible for converting the deployment into a string doesn't sound like it's responsibility - moreover, passing in deployment to tags and calling worker_versioning package also didn't work since it introduced a cyclic chain of imports!

@Shivs11 Shivs11 enabled auto-merge (squash) May 29, 2025 16:19
@Shivs11 Shivs11 merged commit 36fd39b into main May 29, 2025
56 checks passed
@Shivs11 Shivs11 deleted the ss/v3_metrics_transition_override branch May 29, 2025 16:36
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