Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions service/matching/matching_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -2877,17 +2877,17 @@ func (e *matchingEngineImpl) pollTask(
// emitTaskDispatchLatency emits latency metrics for a task dispatched to a worker.
// Here is what task_dispatch_latency measures vs schedule_to_start_latency:
//
// Latency | task_dispatch | schedule_to_start
// Latency | task_dispatch | schedule_to_start
//
// --------------------------------------------------+------------------+------------------
// -------------------------------------------------+------------------+------------------
//
// transfer task processing | excluded | included
// record*TaskStarted latency | included | partial
// task forward latency | included | included
// poll forward latency | excluded for now | excluded
// backlog delay | included | included
// sync match delay | included | included
// rescheduling of the same task attempt by History | resets latency | does not reset
// transfer task processing | excluded | included
// record*TaskStarted latency | included | partial
// task forward latency | included | included
// poll forward latency | excluded for now | excluded
// backlog delay | included | included
// sync match delay | included | included
// rescheduling of the same task attempt by History | resets latency | does not reset
//
// ----------------------------------------------------------------------------------------
func (e *matchingEngineImpl) emitTaskDispatchLatency(
Expand Down
2 changes: 1 addition & 1 deletion service/matching/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ func (task *internalTask) isSyncMatchTask() bool {
}

func (task *internalTask) getCreateTime() *timestamppb.Timestamp {
if task.forwardInfo != nil && task.forwardInfo.GetCreateTime() != nil {
if task.forwardInfo.GetCreateTime() != nil {
return task.forwardInfo.GetCreateTime()
} else if task.event != nil {
return task.event.Data.GetCreateTime()
Expand Down
16 changes: 8 additions & 8 deletions tests/task_queue_stats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,46 +113,46 @@ func runTaskQueueStatsTests(t *testing.T, usePriMatcher bool) {
// Note: runWithMatchingBehavior already configures partition count based on forwarding behavior.
// Do NOT override MatchingNumTaskqueueReadPartitions/WritePartitions inside the subtest.
t.Run("TestMultipleTasks_WithMatchingBehavior_ValidateStats", func(t *testing.T) {
runSuiteWithMatchingBehaviors(t, baseOpts, usePriMatcher, func(s *taskQueueStatsSuite) {
runTaskQueueStatsSuiteWithMatchingBehaviors(t, baseOpts, usePriMatcher, func(s *taskQueueStatsSuite) {
s.OverrideDynamicConfig(dynamicconfig.MatchingLongPollExpirationInterval, 10*time.Second)
s.OverrideDynamicConfig(dynamicconfig.TaskQueueInfoByBuildIdTTL, 1*time.Millisecond)
s.publishConsumeWorkflowTasksValidateStats(4, false)
})
})

t.Run("TestCurrentVersionAbsorbsUnversionedBacklog_NoRamping", func(t *testing.T) {
runSuiteWithMatchingBehaviors(t, baseOpts, usePriMatcher, func(s *taskQueueStatsSuite) {
runTaskQueueStatsSuiteWithMatchingBehaviors(t, baseOpts, usePriMatcher, func(s *taskQueueStatsSuite) {
s.currentVersionAbsorbsUnversionedBacklogNoRamping()
})
})

t.Run("TestRampingAndCurrentAbsorbUnversionedBacklog", func(t *testing.T) {
runSuiteWithMatchingBehaviors(t, baseOpts, usePriMatcher, func(s *taskQueueStatsSuite) {
runTaskQueueStatsSuiteWithMatchingBehaviors(t, baseOpts, usePriMatcher, func(s *taskQueueStatsSuite) {
s.rampingAndCurrentAbsorbsUnversionedBacklog()
})
})

t.Run("TestCurrentAbsorbsUnversionedBacklog_WhenRampingToUnversioned", func(t *testing.T) {
runSuiteWithMatchingBehaviors(t, baseOpts, usePriMatcher, func(s *taskQueueStatsSuite) {
runTaskQueueStatsSuiteWithMatchingBehaviors(t, baseOpts, usePriMatcher, func(s *taskQueueStatsSuite) {
s.currentAbsorbsUnversionedBacklogWhenRampingToUnversioned()
})
})

t.Run("TestRampingAbsorbsUnversionedBacklog_WhenCurrentIsUnversioned", func(t *testing.T) {
runSuiteWithMatchingBehaviors(t, baseOpts, usePriMatcher, func(s *taskQueueStatsSuite) {
runTaskQueueStatsSuiteWithMatchingBehaviors(t, baseOpts, usePriMatcher, func(s *taskQueueStatsSuite) {
s.rampingAbsorbsUnversionedBacklogWhenCurrentIsUnversioned()
})
})

t.Run("TestInactiveVersionDoesNotAbsorbUnversionedBacklog", func(t *testing.T) {
runSuiteWithMatchingBehaviors(t, baseOpts, usePriMatcher, func(s *taskQueueStatsSuite) {
runTaskQueueStatsSuiteWithMatchingBehaviors(t, baseOpts, usePriMatcher, func(s *taskQueueStatsSuite) {
s.inactiveVersionDoesNotAbsorbUnversionedBacklog()
})
})
}

// runSuiteWithMatchingBehaviors runs a test with all combinations of matching behaviors.
func runSuiteWithMatchingBehaviors(
// runTaskQueueStatsSuiteWithMatchingBehaviors runs a task queue stats test with all combinations of matching behaviors.
func runTaskQueueStatsSuiteWithMatchingBehaviors(
t *testing.T,
baseOpts []testcore.TestOption,
usePriMatcher bool,
Expand Down
2 changes: 0 additions & 2 deletions tests/task_queue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -963,8 +963,6 @@ func (s *TaskQueueSuite) TestTaskDispatchLatencyMetric_Nexus() {

func (s *TaskQueueSuite) testTaskDispatchLatencyMetric(scenario func(s *testcore.TestEnv, expectedForwarded, expectedSource, expectedPartitionID string, forwardDelay time.Duration)) {
baseOpts := []testcore.TestOption{
testcore.WithDynamicConfig(dynamicconfig.MatchingUseNewMatcher, true),
testcore.WithDynamicConfig(dynamicconfig.MatchingForwarderMaxChildrenPerNode, 3),
testcore.WithDynamicConfig(dynamicconfig.MatchingEmitTaskDispatchLatencyAtPoll, true),
}

Expand Down
4 changes: 3 additions & 1 deletion tests/testcore/matching_behavior.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ func (b MatchingBehavior) Name() string {

// Options returns the TestOptions to configure matching behavior.
func (b MatchingBehavior) Options() []TestOption {
var opts []TestOption
opts := []TestOption{
WithDynamicConfig(dynamicconfig.MatchingForwarderMaxChildrenPerNode, 3),
Copy link
Contributor

Choose a reason for hiding this comment

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

add this to https://github.com/temporalio/temporal/blob/main/tests/testcore/functional_test_base.go#L621 also (and we should consolidate those so there's only one copy of this logic)

}
if b.ForceTaskForward || b.ForcePollForward {
opts = append(opts,
WithDynamicConfig(dynamicconfig.MatchingNumTaskqueueReadPartitions, 13),
Expand Down
Loading