client.go ×5

Frontier kind: Joint frontier

unlabeled · c_0938c07582e8

6 tests · 2855 LOC · 142 files · introduces 1 test · 77 LOC · 3 files

Introduces — evidence that enters the hierarchy at this concept

Code
7 ranges77 lines · 3 files
Tests
1 test

Contains — complete concept membership

All code (extent)
446 ranges2855 lines · 142 files · Browse complete extent
All tests (intent)
6 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

1 test introduced at this concept.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

3 files ranked by introduced lines: 77 introduced LOC across 7 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/worker/workerdeployment/client.go 68 introduced LOC · 5 ranges

Open complete file

1583 }
1584
1585 > func (d *ClientImpl) convertAndRecordError(operation string, deploymentName string, retErr *error, args ...any) func() { client.go
1586 > start := time.Now()
1587 > return func() {
1588 > elapsed := time.Since(start)
1589 >
1590 > // TODO: add metrics recording here
1591 >
1592 > if *retErr != nil {
1593 if isFailedPreconditionOrNotFound(*retErr) {
1594 d.logger.Debug("deployment client failure due to a failed precondition or not found error",
1640 }
1641 }
1642 > } else { client.go
1643 > d.logger.Debug("deployment client success",
1644 > tag.Operation(operation),
1645 > tag.Deployment(deploymentName),
1646 > tag.Duration("elapsed", elapsed),
1647 > tag.Any("args", args),
1648 > )
1649 > }
1650 }
1651 }
2013 deploymentName, buildID string,
2014 revisionNumber int64,
2015 > ) (retErr error) { client.go
2016 > //revive:disable-next-line:defer
2017 > defer d.convertAndRecordError("SignalVersionReactivation", deploymentName, &retErr, buildID)()
2018 >
2019 > key := reactivationVersionKey{
2020 > namespaceID: namespaceEntry.ID().String(),
2021 > deploymentName: deploymentName,
2022 > buildID: buildID,
2023 > }
2024 > metricsHandler := d.metricsHandler.WithTags(
2025 > metrics.CacheTypeTag(metrics.ReactivationSignalDedupCacheTypeTagValue),
2026 > metrics.OperationTag(metrics.ReactivationSignalDedupScope),
2027 > metrics.NamespaceIDTag(namespaceEntry.ID().String()),
2028 > )
2029 > metrics.CacheRequests.With(metricsHandler).Record(1)
2030 >
2031 > if stored := d.highestRevSignaledToVersionWf.Get(key); stored != nil {
2032 if storedRev, ok := stored.(int64); ok && revisionNumber <= storedRev {
2033 // This pod has already signaled the target version workflow at this revision
2037 }
2038 }
2039 > metrics.CacheMissCounter.With(metricsHandler).Record(1) client.go
2040 >
2041 > workflowID := GenerateVersionWorkflowID(deploymentName, buildID)
2042 >
2043 > // Deterministic UUID v5 RequestId derived from the revision number. Multiple history
2044 > // pods that independently decide to reactivate the same version at the same revision
2045 > // compute the same RequestId and fold into a single signal delivery, since the receiver
2046 > // dedups on RequestId.
2047 > //
2048 > // Revision alone is enough input because the dedup is scoped to this one version
2049 > // workflow (addressed by workflowID); different (deployment, build) pairs at the same
2050 > // revision don't collide because they're different workflows.
2051 > requestID := uuid.NewSHA1(
2052 > uuid.Nil,
2053 > []byte("reactivation-signal:"+strconv.FormatInt(revisionNumber, 10)),
2054 > ).String()
2055 >
2056 > signalRequest := &historyservice.SignalWorkflowExecutionRequest{
2057 > NamespaceId: namespaceEntry.ID().String(),
2058 > SignalRequest: &workflowservice.SignalWorkflowExecutionRequest{
2059 > Namespace: namespaceEntry.Name().String(),
2060 > WorkflowExecution: &commonpb.WorkflowExecution{
2061 > WorkflowId: workflowID,
2062 > },
2063 > SignalName: ReactivateVersionSignalName,
2064 > Input: nil,
2065 > Identity: "history-service",
2066 > RequestId: requestID,
2067 > },
2068 > }
2069 >
2070 > _, err := d.historyClient.SignalWorkflowExecution(ctx, signalRequest)
2071 > if err != nil {
2072 return err
2073 }
2075 // Record success so subsequent calls to the same version workflow for this or older
2076 // revisions skip the RPC.
2077 > d.highestRevSignaledToVersionWf.Put(key, revisionNumber) client.go
2078 > return nil
2079 }
2080
go.temporal.io/server/service/worker/workerdeployment/util.go 7 introduced LOC · 1 range

Open complete file

158 // GenerateVersionWorkflowID is a helper that generates a system accepted
159 // workflowID which are used in our Worker Deployment Version workflows
160 > func GenerateVersionWorkflowID(deploymentName string, buildID string) string { util.go
161 > versionString := worker_versioning.ExternalWorkerDeploymentVersionToString(&deploymentpb.WorkerDeploymentVersion{
162 > DeploymentName: deploymentName,
163 > BuildId: buildID,
164 > })
165 > return worker_versioning.WorkerDeploymentVersionWorkflowIDPrefix + worker_versioning.WorkerDeploymentVersionDelimiter + versionString
166 > }
167
168 func DecodeWorkerDeploymentMemo(memo *commonpb.Memo) (*deploymentspb.WorkerDeploymentWorkflowMemo, error) {
go.temporal.io/server/common/metrics/tags.go 2 introduced LOC · 1 range

Open complete file

111 func NamespaceIDTag(value string) Tag {
112 if len(value) == 0 {
113 > value = unknownValue tags.go
114 > }
115 return Tag{Key: namespaceID, Value: value}
116 }