fx.Provide(
QueueSchedulerRateLimiterProvider,
return tqm
},
queues.NewDLQWriter,
fx.Annotated{
Frontier kind: Code frontier
unlabeled · c_1ebe468d0b98
14 tests · 3942 LOC · 181 files · introduces 0 tests · 225 LOC · 7 files
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.
Every exact file and test below is linked only from the concept that introduces it.
go.temporal.io/server/common/persistence/client/TestQuotasSuite/TestAPITypeCallOriginPriorityOverrideMappinggo.temporal.io/server/common/persistence/client/TestQuotasSuite/TestBackgroundTypeAPIPriorityOverrideMappinggo.temporal.io/server/common/persistence/client/TestQuotasSuite/TestCallerTypeDefaultPriorityMappinggo.temporal.io/server/common/persistence/client/TestQuotasSuite/TestRequestPrioritiesOrderedgo.temporal.io/server/common/rpc/interceptor/TestMethodToPatternMappinggo.temporal.io/server/common/rpc/interceptor/TestNamespaceSuite/TestFrontendAPIMetricsgo.temporal.io/server/common/rpc/interceptor/TestNamespaceSuite/TestHistoryAPIMetricsgo.temporal.io/server/common/rpc/interceptor/TestNamespaceSuite/TestMatchingAPIMetricsgo.temporal.io/server/service/frontend/configs/TestQuotasSuite/TestExecutionAPIPrioritiesOrderedgo.temporal.io/server/service/frontend/configs/TestQuotasSuite/TestExecutionAPIToPriorityMappinggo.temporal.io/server/service/frontend/configs/TestQuotasSuite/TestNamespaceReplicationInducingAPIPrioritiesOrderedgo.temporal.io/server/service/frontend/configs/TestQuotasSuite/TestNamespaceReplicationInducingAPIToPriorityMappinggo.temporal.io/server/service/frontend/configs/TestQuotasSuite/TestNamespaceReplicationInducingAPIsgo.temporal.io/server/service/frontend/configs/TestQuotasSuite/TestVisibilityAPIPrioritiesOrderedgo.temporal.io/server/service/frontend/configs/TestQuotasSuite/TestVisibilityAPIToPriorityMappinggo.temporal.io/server/service/frontend/configs/TestQuotasSuite/TestVisibilityAPIsgo.temporal.io/server/common/circuitbreaker/TestTSCBWithDynamicSettingsgo.temporal.io/server/common/dynamicconfig/TestDeepCopy_OtherReferenceTypes_Nilgo.temporal.io/server/service/matching/configs/TestQuotasSuite/TestAPIPrioritiesOrderedgo.temporal.io/server/service/matching/configs/TestQuotasSuite/TestAPIToPriorityMappingEvery collected test enters the hierarchy at exactly one concept.
No tests are introduced at this concept. Its intent tests are introduced by other concepts.
Every collected source range enters the hierarchy at exactly one concept.
7 files ranked by introduced lines: 225 introduced LOC across 16 ranges. Expand a file to inspect source; the > gutter marks introduced lines.
fx.Provide(
QueueSchedulerRateLimiterProvider,
return tqm
},
queues.NewDLQWriter,
fx.Annotated{
outboundParams outboundQueueFactoryParams,
config *configs.Config,
factories := []QueueFactory{}
if _, ok := registry.GetCategoryByID(tasks.CategoryIDArchival); ok {
factories = append(factories, NewArchivalQueueFactory(archivalParams))
}
return additionalQueueFactories{
Factories: factories,
}
}
timeSource clock.TimeSource,
logger log.SnTaggedLogger,
return queues.NewPrioritySchedulerRateLimiter(
calculator.NewLoggedNamespaceCalculator(
shard.NewOwnershipAwareNamespaceQuotaCalculator(
ownershipBasedQuotaScaler,
serviceResolver,
config.TaskSchedulerNamespaceMaxQPS,
config.TaskSchedulerGlobalNamespaceMaxQPS,
),
log.With(logger, tag.ComponentTaskScheduler, tag.ScopeNamespace),
).GetQuota,
calculator.NewLoggedCalculator(
shard.NewOwnershipAwareQuotaCalculator(
ownershipBasedQuotaScaler,
serviceResolver,
config.TaskSchedulerMaxQPS,
config.TaskSchedulerGlobalMaxQPS,
),
log.With(logger, tag.ComponentTaskScheduler, tag.ScopeHost),
).GetQuota,
// TODO: reuse persistence rate limit calculator in PersistenceRateLimitingParamsProvider
shard.NewOwnershipAwareNamespaceQuotaCalculator(
ownershipBasedQuotaScaler,
serviceResolver,
config.PersistenceNamespaceMaxQPS,
config.PersistenceGlobalNamespaceMaxQPS,
).GetQuota,
shard.NewOwnershipAwareQuotaCalculator(
ownershipBasedQuotaScaler,
serviceResolver,
config.PersistenceMaxQPS,
config.PersistenceGlobalMaxQPS,
).GetQuota,
)
}
func QueueFactoryLifetimeHooks(
params QueueFactoriesLifetimeHookParams,
params.Lifecycle.Append(
fx.Hook{
OnStart: func(context.Context) error {
for _, factory := range params.Factories {
factory.Start()
func NewTimerQueueFactory(
params timerQueueFactoryParams,
return &timerQueueFactory{
timerQueueFactoryParams: params,
QueueFactoryBase: QueueFactoryBase{
HostScheduler: queues.NewScheduler(
params.ClusterMetadata.GetCurrentClusterName(),
queues.SchedulerOptions{
WorkerCount: params.Config.TimerProcessorSchedulerWorkerCount,
ActiveNamespaceWeights: params.Config.TimerProcessorSchedulerActiveRoundRobinWeights,
StandbyNamespaceWeights: params.Config.TimerProcessorSchedulerStandbyRoundRobinWeights,
InactiveNamespaceDeletionDelay: params.Config.TaskSchedulerInactiveChannelDeletionDelay,
ExecutionAwareSchedulerOptions: ctasks.ExecutionAwareSchedulerOptions{
Enabled: params.Config.TaskSchedulerEnableExecutionQueueScheduler,
MaxQueues: params.Config.TaskSchedulerExecutionQueueSchedulerMaxQueues,
QueueTTL: params.Config.TaskSchedulerExecutionQueueSchedulerQueueTTL,
QueueConcurrency: params.Config.TaskSchedulerExecutionQueueSchedulerQueueConcurrency,
},
},
params.NamespaceRegistry,
params.Logger,
params.MetricsHandler,
params.TimeSource,
),
HostPriorityAssigner: queues.NewPriorityAssigner(
params.NamespaceRegistry,
params.ClusterMetadata.GetCurrentClusterName(),
),
HostReaderRateLimiter: queues.NewReaderPriorityRateLimiter(
NewHostRateLimiterRateFn(
params.Config.TimerProcessorMaxPollHostRPS,
params.Config.PersistenceMaxQPS,
timerQueuePersistenceMaxRPSRatio,
),
int64(params.Config.TimerQueueMaxReaderCount()),
),
Tracer: params.TracerProvider.Tracer(telemetry.ComponentQueueTimer),
},
}
}
func (f *timerQueueFactory) CreateQueue(
func NewTransferQueueFactory(
params transferQueueFactoryParams,
return &transferQueueFactory{
transferQueueFactoryParams: params,
QueueFactoryBase: QueueFactoryBase{
HostScheduler: queues.NewScheduler(
params.ClusterMetadata.GetCurrentClusterName(),
queues.SchedulerOptions{
WorkerCount: params.Config.TransferProcessorSchedulerWorkerCount,
ActiveNamespaceWeights: params.Config.TransferProcessorSchedulerActiveRoundRobinWeights,
StandbyNamespaceWeights: params.Config.TransferProcessorSchedulerStandbyRoundRobinWeights,
InactiveNamespaceDeletionDelay: params.Config.TaskSchedulerInactiveChannelDeletionDelay,
ExecutionAwareSchedulerOptions: ctasks.ExecutionAwareSchedulerOptions{
Enabled: params.Config.TaskSchedulerEnableExecutionQueueScheduler,
MaxQueues: params.Config.TaskSchedulerExecutionQueueSchedulerMaxQueues,
QueueTTL: params.Config.TaskSchedulerExecutionQueueSchedulerQueueTTL,
QueueConcurrency: params.Config.TaskSchedulerExecutionQueueSchedulerQueueConcurrency,
},
},
params.NamespaceRegistry,
params.Logger,
params.MetricsHandler,
params.TimeSource,
),
HostPriorityAssigner: queues.NewPriorityAssigner(
params.NamespaceRegistry,
params.ClusterMetadata.GetCurrentClusterName(),
),
HostReaderRateLimiter: queues.NewReaderPriorityRateLimiter(
NewHostRateLimiterRateFn(
params.Config.TransferProcessorMaxPollHostRPS,
params.Config.PersistenceMaxQPS,
transferQueuePersistenceMaxRPSRatio,
),
int64(params.Config.TransferQueueMaxReaderCount()),
),
Tracer: params.TracerProvider.Tracer(telemetry.ComponentQueueTransfer),
},
}
}
func (f *transferQueueFactory) CreateQueue(
func NewVisibilityQueueFactory(
params visibilityQueueFactoryParams,
return &visibilityQueueFactory{
visibilityQueueFactoryParams: params,
QueueFactoryBase: QueueFactoryBase{
HostScheduler: queues.NewScheduler(
params.ClusterMetadata.GetCurrentClusterName(),
queues.SchedulerOptions{
WorkerCount: params.Config.VisibilityProcessorSchedulerWorkerCount,
ActiveNamespaceWeights: params.Config.VisibilityProcessorSchedulerActiveRoundRobinWeights,
StandbyNamespaceWeights: params.Config.VisibilityProcessorSchedulerStandbyRoundRobinWeights,
InactiveNamespaceDeletionDelay: params.Config.TaskSchedulerInactiveChannelDeletionDelay,
ExecutionAwareSchedulerOptions: ctasks.ExecutionAwareSchedulerOptions{
Enabled: params.Config.TaskSchedulerEnableExecutionQueueScheduler,
MaxQueues: params.Config.TaskSchedulerExecutionQueueSchedulerMaxQueues,
QueueTTL: params.Config.TaskSchedulerExecutionQueueSchedulerQueueTTL,
QueueConcurrency: params.Config.TaskSchedulerExecutionQueueSchedulerQueueConcurrency,
},
},
params.NamespaceRegistry,
params.Logger,
params.MetricsHandler,
params.TimeSource,
),
HostPriorityAssigner: queues.NewPriorityAssigner(
params.NamespaceRegistry,
params.ClusterMetadata.GetCurrentClusterName(),
),
HostReaderRateLimiter: queues.NewReaderPriorityRateLimiter(
NewHostRateLimiterRateFn(
params.Config.VisibilityProcessorMaxPollHostRPS,
params.Config.PersistenceMaxQPS,
visibilityQueuePersistenceMaxRPSRatio,
),
int64(params.Config.VisibilityQueueMaxReaderCount()),
),
Tracer: params.TracerProvider.Tracer(telemetry.ComponentQueueVisibility),
},
}
}
func (f *visibilityQueueFactory) CreateQueue(
func NewMemoryScheduledQueueFactory(
params memoryScheduledQueueFactoryParams,
logger := log.With(params.Logger, tag.ComponentMemoryScheduledQueue)
metricsHandler := params.MetricsHandler.WithTags(metrics.OperationTag(metrics.OperationMemoryScheduledQueueProcessorScope))
hostScheduler := ctasks.NewFIFOScheduler[ctasks.Task](
&ctasks.FIFOSchedulerOptions{
QueueSize: 0, // Don't buffer tasks in scheduler. If all workers are busy memoryScheduledQueue reschedules tasks into itself.
WorkerCount: params.Config.MemoryTimerProcessorSchedulerWorkerCount,
},
logger,
)
return &memoryScheduledQueueFactory{
scheduler: hostScheduler,
priorityAssigner: queues.NewPriorityAssigner(
params.NamespaceRegistry,
params.ClusterMetadata.GetCurrentClusterName(),
),
namespaceRegistry: params.NamespaceRegistry,
clusterMetadata: params.ClusterMetadata,
workflowCache: params.WorkflowCache,
timeSource: params.TimeSource,
chasmRegistry: params.ChasmRegistry,
metricsHandler: metricsHandler,
tracer: params.TracerProvider.Tracer(telemetry.ComponentQueueMemory),
logger: logger,
executorWrapper: params.ExecutorWrapper,
}
}
func (f *memoryScheduledQueueFactory) Start() {
perInstanceQuota func() int,
globalQuota func() int,
return &OwnershipAwareQuotaCalculator{
ClusterAwareQuotaCalculator: calculator.ClusterAwareQuotaCalculator{
MemberCounter: memberCounter,
PerInstanceQuota: perInstanceQuota,
GlobalQuota: globalQuota,
},
scaler: scaler,
}
}
func (c *OwnershipAwareQuotaCalculator) GetQuota() float64 {
ownership_based_quota_calculator.go
if quota, ok := getOwnershipScaledQuota(c.scaler, c.GlobalQuota()); ok {
return quota
}
}
perInstanceQuota func(namespace string) int,
globalQuota func(namespace string) int,
return &OwnershipAwareNamespaceQuotaCalculator{
ClusterAwareNamespaceQuotaCalculator: calculator.ClusterAwareNamespaceQuotaCalculator{
MemberCounter: memberCounter,
PerInstanceQuota: perInstanceQuota,
GlobalQuota: globalQuota,
},
scaler: scaler,
}
}
func (c *OwnershipAwareNamespaceQuotaCalculator) GetQuota(namespace string) float64 {
scaler OwnershipBasedQuotaScaler,
globalLimit int,
if globalLimit > 0 && scaler != nil {
if scaleFactor, ok := scaler.ScaleFactor(); ok {
return scaleFactor * float64(globalLimit), true
}
}
}
namespaceRegistry namespace.Registry,
config *configs.Config,
return &OutboundQueueCircuitBreakerPool{
CircuitBreakerPool: NewCircuitBreakerPool(
func(key tasks.TaskGroupNamespaceIDAndDestination) circuitbreaker.TwoStepCircuitBreaker {
// This is intentionally not failing the function in case of error. The circuit breaker is
// agnostic to Task implementation, and thus the settings function is not expected to return