statemachine.go ×4

Frontier kind: Code frontier

unlabeled · c_032f50e64ee9

13 tests · 2409 LOC · 121 files · introduces 0 tests · 26 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
7 ranges26 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
368 ranges2409 lines · 121 files · Browse complete extent
All tests (intent)
13 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.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

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

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

go.temporal.io/server/chasm/lib/activity/activity.go 15 introduced LOC · 3 ranges

Open complete file

1574 // lastHeartbeatDetails returns the details recorded by the most recent heartbeat, or nil if
1575 // the activity never heartbeated.
1576 > func (a *Activity) lastHeartbeatDetails(ctx chasm.Context) *commonpb.Payloads { activity.go
1577 > heartbeat, ok := a.LastHeartbeat.TryGet(ctx)
1578 > if !ok {
1579 return nil
1580 }
2033 timeoutType enumspb.TimeoutType,
2034 fromStatus activitypb.ActivityExecutionStatus,
2035 > ) { activity.go
2036 > // Record start-to-close latency only while an attempt is running. SCHEDULED (incl. retry
2037 > // backoff) and PAUSED have no running attempt and a possibly-stale StartedTime.
2038 > attemptRunning := fromStatus != activitypb.ACTIVITY_EXECUTION_STATUS_SCHEDULED &&
2039 > fromStatus != activitypb.ACTIVITY_EXECUTION_STATUS_PAUSED
2040 > if attemptRunning {
2041 if startedTime := a.LastAttempt.Get(ctx).GetStartedTime(); startedTime != nil {
2042 metrics.ActivityStartToCloseLatency.With(handler).Record(time.Since(startedTime.AsTime()))
2044 }
2045
2046 > scheduleToCloseLatency := time.Since(a.GetScheduleTime().AsTime()) activity.go
2047 > metrics.ActivityScheduleToCloseLatency.With(handler).Record(scheduleToCloseLatency)
2048 >
2049 > timeoutTag := metrics.StringTag("timeout_type", timeoutType.String())
2050 > metrics.ActivityTaskTimeout.With(handler).Record(1, timeoutTag)
2051 > metrics.ActivityTimeout.With(handler).Record(1, timeoutTag)
2052 }
2053
go.temporal.io/server/chasm/lib/activity/statemachine.go 11 introduced LOC · 4 ranges

Open complete file

375 },
376 activitypb.ACTIVITY_EXECUTION_STATUS_TIMED_OUT,
377 > func(a *Activity, ctx chasm.MutableContext, event timeoutEvent) error { statemachine.go
378 > timeoutType := event.timeoutType
379 >
380 > return a.StoreOrSelf(ctx).RecordCompleted(ctx, func(ctx chasm.MutableContext) error {
381 > var err error
382 > switch timeoutType {
383 case enumspb.TIMEOUT_TYPE_SCHEDULE_TO_START,
384 enumspb.TIMEOUT_TYPE_SCHEDULE_TO_CLOSE:
399 err = fmt.Errorf("unhandled activity timeout: %v", timeoutType)
400 }
401 > if err != nil { statemachine.go
402 return err
403 }
404 > if event.retryState == enumspb.RETRY_STATE_TIMEOUT { statemachine.go
405 if err := a.recordScheduleToStartOrCloseTimeoutFailure(
406 ctx,
412 }
413
414 > a.emitOnTimedOutMetrics(ctx, event.metricsHandler, timeoutType, event.fromStatus) statemachine.go
415 >
416 > return nil
417 })
418 },