Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark state transition & completion metrics with namespace activeness #3831

Merged
merged 4 commits into from
Jan 30, 2023
Merged

Mark state transition & completion metrics with namespace activeness #3831

merged 4 commits into from
Jan 30, 2023

Conversation

wxing1292
Copy link
Contributor

What changed?

  • Mark state transition & completion metrics with namespace activeness

Why?
Better metrics

How did you test it?
Existing tests

Potential risks
N/A

Is hotfix candidate?
N/A

@wxing1292 wxing1292 requested a review from a team as a code owner January 24, 2023 20:34
@wxing1292 wxing1292 enabled auto-merge (squash) January 24, 2023 21:53
@wxing1292 wxing1292 disabled auto-merge January 24, 2023 22:13
Copy link
Contributor

@yux0 yux0 left a comment

Choose a reason for hiding this comment

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

Will this change make metrics have a dip or spike during failover? When ns is active/passive in both clusters?

).Record(
mutableState.GetExecutionInfo().StateTransitionCount,
metrics.NamespaceTag(namespaceEntry.Name().String()),
metrics.NamespaceStateTag(namespaceState(clusterMetadata, convert.Int64Ptr(mutableState.GetCurrentVersion()))),
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: MutableStateFailoverVersion(mutableState)?

}

// default value, need to special handle
if *mutableStateCurrentVersion == 0 {
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 think logic can be shorten as

if (*mutableStateCurrentVersion == 0) || clusterMetadata.IsVersionFromSameCluster(...) {
    return namespaceStateActive
}

any reason to pass mutableStateCurrentVersion as a pointer instead of just scalar value?

newWorkflowSnapshot *persistence.WorkflowSnapshot,
newWorkflowEventsSeq []*persistence.WorkflowEvents,
) (int64, error)

ConflictResolveWorkflowExecution(
ctx context.Context,
conflictResolveMode persistence.ConflictResolveWorkflowMode,
resetWorkflowFailoverVersion int64,
Copy link
Contributor

Choose a reason for hiding this comment

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

should we just pass all FailoverVersions as int64 to be consistent here?

namespaceStateUnknown = "_unknown_"
)

func namespaceState(
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: rename to something like getNamespaceState

@meiliang86 meiliang86 merged commit 9a4f19e into temporalio:master Jan 30, 2023
@wxing1292 wxing1292 deleted the metrics branch February 23, 2023 20:47
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.

5 participants