configs

package
v1.25.0-116.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// These names do not map to an underlying gRPC service. This format is used for consistency with the
	// gRPC API names on which the authorizer - the consumer of this string - may depend.
	OpenAPIV3APIName                                = "/temporal.api.openapi.v1.OpenAPIService/GetOpenAPIV3Docs"
	OpenAPIV2APIName                                = "/temporal.api.openapi.v1.OpenAPIService/GetOpenAPIV2Docs"
	DispatchNexusTaskByNamespaceAndTaskQueueAPIName = "/temporal.api.nexusservice.v1.NexusService/DispatchByNamespaceAndTaskQueue"
	DispatchNexusTaskByEndpointAPIName              = "/temporal.api.nexusservice.v1.NexusService/DispatchByEndpoint"
	CompleteNexusOperation                          = "/temporal.api.nexusservice.v1.NexusService/CompleteNexusOperation"
)
View Source
const (
	// OperatorPriority is used to give precedence to calls coming from web UI or tctl
	OperatorPriority = 0
)

Variables

View Source
var (
	// ExecutionAPICountLimitOverride determines how many tokens each of these API calls consumes from their
	// corresponding quota, which is determined by dynamicconfig.FrontendMaxConcurrentLongRunningRequestsPerInstance. If
	// the value is not set, then the method is not considered a long-running request and the number of concurrent
	// requests will not be throttled. The Poll* methods here are long-running because they block until there is a task
	// available. The GetWorkflowExecutionHistory method is blocking only if WaitNewEvent is true, otherwise it is not
	// long-running. The QueryWorkflow and UpdateWorkflowExecution methods are long-running because they both block
	// until a background WFT is complete.
	ExecutionAPICountLimitOverride = map[string]int{
		"/temporal.api.workflowservice.v1.WorkflowService/PollActivityTaskQueue":       1,
		"/temporal.api.workflowservice.v1.WorkflowService/PollWorkflowTaskQueue":       1,
		"/temporal.api.workflowservice.v1.WorkflowService/PollWorkflowExecutionUpdate": 1,
		"/temporal.api.workflowservice.v1.WorkflowService/QueryWorkflow":               1,
		"/temporal.api.workflowservice.v1.WorkflowService/UpdateWorkflowExecution":     1,
		"/temporal.api.workflowservice.v1.WorkflowService/GetWorkflowExecutionHistory": 1,
		"/temporal.api.workflowservice.v1.WorkflowService/PollNexusTaskQueue":          1,

		"/temporal.api.workflowservice.v1.WorkflowService/ExecuteMultiOperation": 1,

		DispatchNexusTaskByNamespaceAndTaskQueueAPIName: 1,
		DispatchNexusTaskByEndpointAPIName:              1,
	}

	// APIToPriority determines common API priorities.
	// If APIs rely on visibility, they should be added to VisibilityAPIToPriority.
	// If APIs result in replication in namespace replication queue, they belong to NamespaceReplicationInducingAPIToPriority
	APIToPriority = map[string]int{

		"/temporal.api.workflowservice.v1.WorkflowService/GetClusterInfo":      0,
		"/temporal.api.workflowservice.v1.WorkflowService/GetSystemInfo":       0,
		"/temporal.api.workflowservice.v1.WorkflowService/GetSearchAttributes": 0,
		"/temporal.api.workflowservice.v1.WorkflowService/DescribeNamespace":   0,
		"/temporal.api.workflowservice.v1.WorkflowService/ListNamespaces":      0,
		"/temporal.api.workflowservice.v1.WorkflowService/DeprecateNamespace":  0,

		"/temporal.api.workflowservice.v1.WorkflowService/SignalWorkflowExecution":          1,
		"/temporal.api.workflowservice.v1.WorkflowService/SignalWithStartWorkflowExecution": 1,
		"/temporal.api.workflowservice.v1.WorkflowService/StartWorkflowExecution":           1,
		"/temporal.api.workflowservice.v1.WorkflowService/UpdateWorkflowExecution":          1,
		"/temporal.api.workflowservice.v1.WorkflowService/ExecuteMultiOperation":            1,
		"/temporal.api.workflowservice.v1.WorkflowService/CreateSchedule":                   1,
		"/temporal.api.workflowservice.v1.WorkflowService/StartBatchOperation":              1,
		DispatchNexusTaskByNamespaceAndTaskQueueAPIName:                                     1,
		DispatchNexusTaskByEndpointAPIName:                                                  1,

		"/temporal.api.workflowservice.v1.WorkflowService/RequestCancelWorkflowExecution": 2,
		"/temporal.api.workflowservice.v1.WorkflowService/TerminateWorkflowExecution":     2,
		"/temporal.api.workflowservice.v1.WorkflowService/ResetWorkflowExecution":         2,
		"/temporal.api.workflowservice.v1.WorkflowService/DeleteWorkflowExecution":        2,
		"/temporal.api.workflowservice.v1.WorkflowService/GetWorkflowExecutionHistory":    2,
		"/temporal.api.workflowservice.v1.WorkflowService/UpdateSchedule":                 2,
		"/temporal.api.workflowservice.v1.WorkflowService/PatchSchedule":                  2,
		"/temporal.api.workflowservice.v1.WorkflowService/DeleteSchedule":                 2,
		"/temporal.api.workflowservice.v1.WorkflowService/StopBatchOperation":             2,

		"/temporal.api.workflowservice.v1.WorkflowService/DescribeWorkflowExecution":     3,
		"/temporal.api.workflowservice.v1.WorkflowService/GetWorkerBuildIdCompatibility": 3,
		"/temporal.api.workflowservice.v1.WorkflowService/GetWorkerVersioningRules":      3,
		"/temporal.api.workflowservice.v1.WorkflowService/ListTaskQueuePartitions":       3,
		"/temporal.api.workflowservice.v1.WorkflowService/QueryWorkflow":                 3,
		"/temporal.api.workflowservice.v1.WorkflowService/DescribeSchedule":              3,
		"/temporal.api.workflowservice.v1.WorkflowService/ListScheduleMatchingTimes":     3,
		"/temporal.api.workflowservice.v1.WorkflowService/DescribeBatchOperation":        3,

		"/temporal.api.workflowservice.v1.WorkflowService/RecordActivityTaskHeartbeat":      4,
		"/temporal.api.workflowservice.v1.WorkflowService/RecordActivityTaskHeartbeatById":  4,
		"/temporal.api.workflowservice.v1.WorkflowService/RespondActivityTaskCanceled":      4,
		"/temporal.api.workflowservice.v1.WorkflowService/RespondActivityTaskCanceledById":  4,
		"/temporal.api.workflowservice.v1.WorkflowService/RespondActivityTaskFailed":        4,
		"/temporal.api.workflowservice.v1.WorkflowService/RespondActivityTaskFailedById":    4,
		"/temporal.api.workflowservice.v1.WorkflowService/RespondActivityTaskCompleted":     4,
		"/temporal.api.workflowservice.v1.WorkflowService/RespondActivityTaskCompletedById": 4,
		"/temporal.api.workflowservice.v1.WorkflowService/RespondWorkflowTaskCompleted":     4,
		"/temporal.api.workflowservice.v1.WorkflowService/RespondWorkflowTaskFailed":        4,
		"/temporal.api.workflowservice.v1.WorkflowService/RespondQueryTaskCompleted":        4,
		"/temporal.api.workflowservice.v1.WorkflowService/RespondNexusTaskCompleted":        4,
		"/temporal.api.workflowservice.v1.WorkflowService/RespondNexusTaskFailed":           4,
		CompleteNexusOperation: 4,

		"/temporal.api.workflowservice.v1.WorkflowService/PollWorkflowTaskQueue":              5,
		"/temporal.api.workflowservice.v1.WorkflowService/PollActivityTaskQueue":              5,
		"/temporal.api.workflowservice.v1.WorkflowService/PollWorkflowExecutionUpdate":        5,
		"/temporal.api.workflowservice.v1.WorkflowService/PollNexusTaskQueue":                 5,
		"/temporal.api.workflowservice.v1.WorkflowService/ResetStickyTaskQueue":               5,
		"/temporal.api.workflowservice.v1.WorkflowService/GetWorkflowExecutionHistoryReverse": 5,

		OpenAPIV3APIName: 6,
		OpenAPIV2APIName: 6,
	}

	ExecutionAPIPrioritiesOrdered = []int{0, 1, 2, 3, 4, 5, 6}

	VisibilityAPIToPriority = map[string]int{
		"/temporal.api.workflowservice.v1.WorkflowService/CountWorkflowExecutions":        1,
		"/temporal.api.workflowservice.v1.WorkflowService/ScanWorkflowExecutions":         1,
		"/temporal.api.workflowservice.v1.WorkflowService/ListOpenWorkflowExecutions":     1,
		"/temporal.api.workflowservice.v1.WorkflowService/ListClosedWorkflowExecutions":   1,
		"/temporal.api.workflowservice.v1.WorkflowService/ListWorkflowExecutions":         1,
		"/temporal.api.workflowservice.v1.WorkflowService/ListArchivedWorkflowExecutions": 1,

		"/temporal.api.workflowservice.v1.WorkflowService/GetWorkerTaskReachability": 1,
		"/temporal.api.workflowservice.v1.WorkflowService/ListSchedules":             1,
		"/temporal.api.workflowservice.v1.WorkflowService/ListBatchOperations":       1,
		"/temporal.api.workflowservice.v1.WorkflowService/DescribeTaskQueue":         1,
	}

	VisibilityAPIPrioritiesOrdered = []int{0, 1}

	// Special rate limiting for APIs that may insert replication tasks into a namespace replication queue.
	// The replication queue is used to propagate critical failover messages and this mapping prevents flooding the
	// queue and delaying failover.
	NamespaceReplicationInducingAPIToPriority = map[string]int{
		"/temporal.api.workflowservice.v1.WorkflowService/RegisterNamespace":                1,
		"/temporal.api.workflowservice.v1.WorkflowService/UpdateNamespace":                  1,
		"/temporal.api.workflowservice.v1.WorkflowService/UpdateWorkerBuildIdCompatibility": 2,
		"/temporal.api.workflowservice.v1.WorkflowService/UpdateWorkerVersioningRules":      2,
	}

	NamespaceReplicationInducingAPIPrioritiesOrdered = []int{0, 1, 2}
)

Functions

func NewExecutionPriorityRateLimiter

func NewExecutionPriorityRateLimiter(
	rateBurstFn quotas.RateBurst,
	operatorRPSRatio dynamicconfig.FloatPropertyFn,
) quotas.RequestRateLimiter

func NewNamespaceReplicationInducingAPIPriorityRateLimiter added in v1.21.0

func NewNamespaceReplicationInducingAPIPriorityRateLimiter(
	rateBurstFn quotas.RateBurst,
	operatorRPSRatio dynamicconfig.FloatPropertyFn,
) quotas.RequestRateLimiter

func NewRequestToRateLimiter

func NewRequestToRateLimiter(
	executionRateBurstFn quotas.RateBurst,
	visibilityRateBurstFn quotas.RateBurst,
	namespaceReplicationInducingRateBurstFn quotas.RateBurst,
	operatorRPSRatio dynamicconfig.FloatPropertyFn,
) quotas.RequestRateLimiter

func NewVisibilityPriorityRateLimiter

func NewVisibilityPriorityRateLimiter(
	rateBurstFn quotas.RateBurst,
	operatorRPSRatio dynamicconfig.FloatPropertyFn,
) quotas.RequestRateLimiter

Types

type NamespaceRateBurstImpl added in v1.14.4

type NamespaceRateBurstImpl struct {
	// contains filtered or unexported fields
}

func NewNamespaceRateBurst added in v1.14.0

func NewNamespaceRateBurst(
	namespaceName string,
	rateFn quotas.NamespaceRateFn,
	burstRatioFn dynamicconfig.FloatPropertyFnWithNamespaceFilter,
) *NamespaceRateBurstImpl

func (*NamespaceRateBurstImpl) Burst added in v1.14.4

func (c *NamespaceRateBurstImpl) Burst() int

func (*NamespaceRateBurstImpl) Rate added in v1.14.4

func (c *NamespaceRateBurstImpl) Rate() float64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL