Atlas › Test

TestShardLingerTimeout

Exact test identity: go.temporal.io/server/service/history/shard/TestShardControllerSuite/TestShardLingerTimeout

Package
go.temporal.io/server/service/history/shard
Suite / test hierarchy
TestShardControllerSuite/TestShardLingerTimeout
Test
TestShardLingerTimeout
Introduced at
controller_impl.go ×1 Frontier kind: Joint frontier
Covered ranges
923
Covered lines
5283
Covered files
188

Covered source

Expand a file to inspect source; the > gutter marks covered lines.

go.temporal.io/server/service/history/shard/context_impl.go 556 covered LOC · 110 ranges

Open complete file

210 }
211
212 > func (s *ContextImpl) GetShardID() int32 { context_impl.go
213 > // constant from initialization, no need for locks
214 > return s.shardID
215 > }
216
217 func (s *ContextImpl) GetRangeID() int64 {
265 func (s *ContextImpl) GetEngine(
266 ctx context.Context,
267 > ) (historyi.Engine, error) { context_impl.go
268 > return s.engineFuture.Get(ctx)
269 > }
270
271 func (s *ContextImpl) AssertOwnership(
272 ctx context.Context,
273 > ) error { context_impl.go
274 > if err := s.ioSemaphoreAcquire(ctx); err != nil {
275 > return err context_impl.go
276 > }
277 > defer s.ioSemaphoreRelease() context_impl.go
278 >
279 > s.wLock()
280 >
281 > // timeout check should be done within the shard lock, in case of shard lock contention
282 > ctx, cancel, err := s.newDetachedContext(ctx)
283 > if err != nil {
284 s.wUnlock()
285 return err
286 }
287 > defer cancel() context_impl.go
288 >
289 > if err := s.errorByState(); err != nil {
290 s.wUnlock()
291 return err
292 }
293
294 > request := &persistence.AssertShardOwnershipRequest{ context_impl.go
295 > ShardID: s.shardID,
296 > RangeID: s.getRangeIDLocked(),
297 > }
298 > s.wUnlock()
299 >
300 > err = s.persistenceShardManager.AssertShardOwnership(ctx, request)
301 > return s.handleWriteError(request.RangeID, err)
302 }
303
1100 }
1101
1102 > func (s *ContextImpl) GetConfig() *configs.Config { context_impl.go
1103 > // constant from initialization, no need for locks
1104 > return s.config
1105 > }
1106
1107 func (s *ContextImpl) GetEventsCache() events.Cache {
1110 }
1111
1112 > func (s *ContextImpl) GetLogger() log.Logger { context_impl.go
1113 > // constant from initialization, no need for locks
1114 > return s.contextTaggedLogger
1115 > }
1116
1117 func (s *ContextImpl) GetThrottledLogger() log.Logger {
1120 }
1121
1122 > func (s *ContextImpl) getRangeIDLocked() int64 { context_impl.go
1123 > return s.shardInfo.GetRangeId()
1124 > }
1125
1126 > func (s *ContextImpl) errorByState() error { context_impl.go
1127 > s.stateLock.Lock()
1128 > defer s.stateLock.Unlock()
1129 >
1130 > switch s.state {
1131 case contextStateInitialized, contextStateAcquiring:
1132 return ErrShardStatusUnknown
1133 > case contextStateAcquired: context_impl.go
1134 > return nil
1135 case contextStateStopping, contextStateStopped:
1136 return s.newShardClosedErrorWithShardID()
1158 }
1159
1160 > func (s *ContextImpl) renewRangeLocked(isStealing bool) error { context_impl.go
1161 > // We must drain all in-flight requests before updating the rangeID.
1162 > // This is because requests are conditioned on rangeID, if rangeID
1163 > // is updated before draining them, those requests could fail.
1164 > // This also means renew rangeID will be the only in-flight request
1165 > // when it's issued, so it doesn't matter if semaphore is acquired or not
1166 > // before calling this method.
1167 > s.taskKeyManager.drainTaskRequests()
1168 >
1169 > updatedShardInfo := trimShardInfo(s.config, s.clusterMetadata.GetAllClusterInfo(), s.copyShardInfo(s.shardInfo))
1170 > updatedShardInfo.RangeId++
1171 > if isStealing {
1172 > updatedShardInfo.StolenSinceRenew++
1173 > }
1174
1175 > ctx, cancel := s.newIOContext() context_impl.go
1176 > defer cancel()
1177 >
1178 > previousRangeID := s.getRangeIDLocked()
1179 > err := s.persistenceShardManager.UpdateShard(ctx, &persistence.UpdateShardRequest{
1180 > ShardInfo: updatedShardInfo,
1181 > PreviousRangeID: previousRangeID,
1182 > })
1183 > if err != nil {
1184 // Failure in updating shard to grab new RangeID
1185 s.contextTaggedLogger.Error("Persistent store operation failure",
1193
1194 // Range is successfully updated in cassandra now update shard context to reflect new range
1195 > s.contextTaggedLogger.Info("Range updated for shardID", context_impl.go
1196 > tag.ShardRangeID(updatedShardInfo.RangeId),
1197 > tag.PreviousShardRangeID(s.shardInfo.RangeId),
1198 > )
1199 >
1200 > s.shardInfo = trimShardInfo(s.config, s.clusterMetadata.GetAllClusterInfo(), s.copyShardInfo(updatedShardInfo))
1201 > s.taskKeyManager.setRangeID(s.shardInfo.RangeId)
1202 >
1203 > return nil
1204 }
1205
1206 > func (s *ContextImpl) monitorQueueMetrics() { context_impl.go
1207 > timer := time.NewTimer(queueMetricUpdateInterval)
1208 > defer timer.Stop()
1209 >
1210 > done := s.lifecycleCtx.Done()
1211 > for {
1212 > select {
1213 > case <-done: context_impl.go
1214 > return
1215 case <-timer.C:
1216 s.emitShardInfoMetricsLogs()
1350 }
1351
1352 > func (s *ContextImpl) GetCurrentTime(cluster string) time.Time { context_impl.go
1353 > if cluster != s.GetClusterMetadata().GetCurrentClusterName() {
1354 s.wLock()
1355 defer s.wUnlock()
1356 return s.getOrUpdateRemoteClusterInfoLocked(cluster).CurrentTime
1357 }
1358 > return s.timeSource.Now().UTC() context_impl.go
1359 }
1360
1361 > func (s *ContextImpl) getLastUpdatedTime() time.Time { context_impl.go
1362 > s.rLock()
1363 > defer s.rUnlock()
1364 > return s.lastUpdated
1365 > }
1366
1367 func (s *ContextImpl) handleReadError(err error) error {
1384 requestRangeID int64,
1385 err error,
1386 > ) error { context_impl.go
1387 > s.wLock()
1388 > defer s.wUnlock()
1389 >
1390 > return s.handleWriteErrorLocked(requestRangeID, err)
1391 > }
1392
1393 func (s *ContextImpl) handleWriteErrorLocked(
1394 requestRangeID int64,
1395 err error,
1396 > ) error { context_impl.go
1397 >
1398 > if requestRangeID != s.getRangeIDLocked() {
1399 return err
1400 }
1401
1402 > if valid := s.IsValid(); !valid { context_impl.go
1403 return err
1404 }
1405 > switch err.(type) { context_impl.go
1406 > case nil: context_impl.go
1407 > // Persistence success: update max read level
1408 > return nil
1409
1410 case *persistence.AppendHistoryTimeoutError:
1442 }
1443
1444 > func (s *ContextImpl) maybeRecordShardAcquisitionLatency(ownershipChanged bool) { context_impl.go
1445 > if ownershipChanged {
1446 > metrics.ShardContextAcquisitionLatency.With(s.GetMetricsHandler()).
1447 > Record(s.GetCurrentTime(s.GetClusterMetadata().GetCurrentClusterName()).Sub(s.getLastUpdatedTime()),
1448 > metrics.OperationTag(metrics.ShardInfoScope),
1449 > )
1450 > }
1451 }
1452
1453 > func (s *ContextImpl) createEngine() historyi.Engine { context_impl.go
1454 > s.contextTaggedLogger.Info("", tag.LifeCycleStarting, tag.ComponentShardEngine)
1455 > engine := s.engineFactory.CreateEngine(s)
1456 > engine.Start()
1457 > s.contextTaggedLogger.Info("", tag.LifeCycleStarted, tag.ComponentShardEngine)
1458 > return engine
1459 > }
1460
1461 // start should only be called by the controller.
1462 > func (s *ContextImpl) start() { context_impl.go
1463 > _ = s.transition(contextRequestAcquire{})
1464 > }
1465
1466 func (s *ContextImpl) UnloadForOwnershipLost() {
1469
1470 // FinishStop should only be called by the controller.
1471 > func (s *ContextImpl) FinishStop() { context_impl.go
1472 > // After this returns, engineFuture.Set may not be called anymore, so if we don't get see
1473 > // an Engine here, we won't ever have one.
1474 > _ = s.transition(contextRequestFinishStop{})
1475 >
1476 > // Use a context that we know is cancelled so that this doesn't block.
1477 > engine, _ := s.engineFuture.Get(s.lifecycleCtx)
1478 >
1479 > // Stop the engine if it was running (outside the lock but before returning).
1480 > if engine != nil {
1481 > s.contextTaggedLogger.Info("", tag.LifeCycleStopping, tag.ComponentShardEngine) context_impl.go
1482 > engine.Stop()
1483 > s.contextTaggedLogger.Info("", tag.LifeCycleStopped, tag.ComponentShardEngine)
1484 > }
1485
1486 // Run finalizer to cleanup any of the shard's associated resources that are registered.
1487 > if s.finalizer != nil { context_impl.go
1488 > s.finalizer.Run(s.config.ShardFinalizerTimeout()) context_impl.go
1489 > }
1490 }
1491
1492 > func (s *ContextImpl) IsValid() bool { context_impl.go
1493 > s.stateLock.Lock()
1494 > defer s.stateLock.Unlock()
1495 > return s.state < contextStateStopping
1496 > }
1497
1498 func (s *ContextImpl) GetLifecycleContext() context.Context {
1506 }
1507
1508 > func (s *ContextImpl) wLock() { context_impl.go
1509 > handler := s.metricsHandler.WithTags(metrics.OperationTag(metrics.ShardInfoScope))
1510 > metrics.LockRequests.With(handler).Record(1)
1511 > startTime := time.Now().UTC()
1512 > defer func() { metrics.LockLatency.With(handler).Record(time.Since(startTime)) }()
1513
1514 > s.rwLock.Lock() context_impl.go
1515 }
1516
1517 > func (s *ContextImpl) rLock() { context_impl.go
1518 > handler := s.metricsHandler.WithTags(metrics.OperationTag(metrics.ShardInfoScope))
1519 > metrics.LockRequests.With(handler).Record(1)
1520 > startTime := time.Now().UTC()
1521 > defer func() { metrics.LockLatency.With(handler).Record(time.Since(startTime)) }()
1522
1523 > s.rwLock.RLock() context_impl.go
1524 }
1525
1526 > func (s *ContextImpl) wUnlock() { context_impl.go
1527 > s.rwLock.Unlock()
1528 > }
1529
1530 > func (s *ContextImpl) rUnlock() { context_impl.go
1531 > s.rwLock.RUnlock()
1532 > }
1533
1534 func (s *ContextImpl) ioSemaphoreAcquire(
1535 ctx context.Context,
1536 > ) (retErr error) { context_impl.go
1537 > priority := locks.PriorityHigh
1538 > callerInfo := headers.GetCallerInfo(ctx)
1539 > if callerInfo.CallerType == headers.CallerTypePreemptable {
1540 priority = locks.PriorityLow
1541 }
1542
1543 > handler := s.metricsHandler.WithTags(metrics.OperationTag(metrics.ShardInfoScope), metrics.PriorityTag(priority)) context_impl.go
1544 > metrics.SemaphoreRequests.With(handler).Record(1)
1545 > startTime := time.Now().UTC()
1546 > defer func() {
1547 > metrics.SemaphoreLatency.With(handler).Record(time.Since(startTime))
1548 > if retErr != nil {
1549 > metrics.SemaphoreFailures.With(handler).Record(1) context_impl.go
1550 > }
1551 }()
1552
1553 > return s.ioSemaphore.Acquire(ctx, priority, 1) context_impl.go
1554 }
1555
1556 > func (s *ContextImpl) ioSemaphoreRelease() { context_impl.go
1557 > s.ioSemaphore.Release(1)
1558 > }
1559
1560 > func (s *ContextImpl) transition(request contextRequest) error { context_impl.go
1561 > /* State transitions:
1562 >
1563 > The normal pattern:
1564 > Initialized
1565 > controller calls start()
1566 > Acquiring
1567 > acquireShard gets the shard
1568 > Acquired
1569 >
1570 > If we get a transient error from persistence:
1571 > Acquired
1572 > transient error: handleErrorLocked calls transition(contextRequestLost)
1573 > Acquiring
1574 > acquireShard gets the shard
1575 > Acquired
1576 >
1577 > If we get shard ownership lost:
1578 > Acquired
1579 > ShardOwnershipLostError: handleErrorLocked calls transition(contextRequestStop)
1580 > Stopping
1581 > controller removes from map and calls FinishStop()
1582 > Stopped
1583 >
1584 > Stopping can be triggered internally (if we get a ShardOwnershipLostError, or fail to acquire the rangeid
1585 > lock after several minutes) or externally (from controller, e.g. controller shutting down or admin force-
1586 > unload shard). If it's triggered internally, we transition to Stopping, then make an asynchronous callback
1587 > to controller, which will remove us from the map and call FinishStop(), which will transition to Stopped and
1588 > stop the engine. If it's triggered externally, we'll skip over Stopping and go straight to Stopped.
1589 >
1590 > If we transition externally to Stopped, and the acquireShard goroutine is still running, we can't kill it,
1591 > but we should make sure that it can't do anything: the context it uses for persistence ops will be
1592 > canceled, and if it tries to transition states, it will fail.
1593 >
1594 > Invariants:
1595 > - Once state is Stopping, it can only go to Stopped.
1596 > - Once state is Stopped, it can't go anywhere else.
1597 > - At the start of acquireShard, state must be Acquiring.
1598 > - By the end of acquireShard, state must not be Acquiring: either acquireShard set it to Acquired, or the
1599 > controller set it to Stopped.
1600 > - If state is Acquiring, acquireShard should be running in the background.
1601 > - Only acquireShard can use contextRequestAcquired (i.e. transition from Acquiring to Acquired).
1602 > - Once state has reached Acquired at least once, and not reached Stopped, engineFuture must be set.
1603 > - Only the controller may call start() and FinishStop().
1604 > - The controller must call FinishStop() for every ContextImpl it creates.
1605 >
1606 > */
1607 >
1608 > s.stateLock.Lock()
1609 > defer s.stateLock.Unlock()
1610 >
1611 > setStateAcquiring := func() {
1612 > s.state = contextStateAcquiring context_impl.go
1613 > s.contextTaggedLogger.Info("", tag.LifeCycleStarted, tag.ComponentShardContext)
1614 > go s.acquireShard()
1615 > }
1616
1617 > setStateStopping := func(request contextRequestStop) { context_impl.go
1618 s.state = contextStateStopping
1619 s.stopReason = request.reason
1627 }
1628
1629 > setStateStopped := func() { context_impl.go
1630 > s.state = contextStateStopped context_impl.go
1631 > s.contextTaggedLogger.Info("", tag.LifeCycleStopped, tag.ComponentShardContext)
1632 > // Do this again in case we skipped the stopping state, which could happen
1633 > // when calling CloseShardByID or the controller is shutting down.
1634 > s.lifecycleCancel()
1635 > }
1636
1637 > switch s.state { context_impl.go
1638 > case contextStateInitialized: context_impl.go
1639 > switch request := request.(type) {
1640 > case contextRequestAcquire:
1641 > setStateAcquiring()
1642 > return nil
1643 case contextRequestStop:
1644 setStateStopping(request)
1648 return nil
1649 }
1650 > case contextStateAcquiring: context_impl.go
1651 > switch request := request.(type) {
1652 case contextRequestAcquire:
1653 return nil // nothing to do, already acquiring
1654 > case contextRequestAcquired: context_impl.go
1655 > s.state = contextStateAcquired
1656 > if request.engine != nil {
1657 > // engineFuture.Set should only be called inside stateLock when state is context_impl.go
1658 > // Acquiring, so that other code (i.e. FinishStop) can know that after a state
1659 > // transition to Stopping/Stopped, engineFuture cannot be Set.
1660 > if s.engineFuture.Ready() {
1661 // defensive check, this should never happen
1662 s.contextTaggedLogger.Warn("transition to acquired with engine set twice")
1663 return errInvalidTransition
1664 }
1665 > s.engineFuture.Set(request.engine, nil) context_impl.go
1666 }
1667 > if !s.engineFuture.Ready() { context_impl.go
1668 // we should either have an engine from a previous transition, or set one now
1669 s.contextTaggedLogger.Warn("transition to acquired but no engine set")
1671 }
1672
1673 > return nil context_impl.go
1674 case contextRequestLost:
1675 return nil // nothing to do, already acquiring
1681 return nil
1682 }
1683 > case contextStateAcquired: context_impl.go
1684 > switch request := request.(type) {
1685 case contextRequestAcquire:
1686 return nil // nothing to do, already acquired
1691 setStateStopping(request)
1692 return nil
1693 > case contextRequestFinishStop: context_impl.go
1694 > setStateStopped()
1695 > return nil
1696 }
1697 case contextStateStopping:
1720 // notifyQueueProcessor sends notification to all queue processors for triggering a load
1721 // NOTE: this method assumes engineFuture is already in a ready state.
1722 > func (s *ContextImpl) notifyQueueProcessor() { context_impl.go
1723 > // use a cancelled ctx so the method won't be blocked if engineFuture is not ready
1724 > cancelledCtx, cancel := context.WithCancel(context.Background())
1725 > cancel()
1726 >
1727 > // we will get the engine when the Future is ready
1728 > engine, err := s.engineFuture.Get(cancelledCtx)
1729 > if err != nil {
1730 s.contextTaggedLogger.Warn("tried to notify queue processor when engine is not ready")
1731 return
1732 }
1733
1734 > now := s.timeSource.Now() context_impl.go
1735 > fakeTasks := make(map[tasks.Category][]tasks.Task)
1736 > for _, category := range s.taskCategoryRegistry.GetCategories() {
1737 > fakeTasks[category] = []tasks.Task{tasks.NewFakeTask(definition.WorkflowKey{}, category, now)}
1738 > }
1739
1740 > engine.NotifyNewTasks(fakeTasks) context_impl.go
1741 }
1742
1743 > func (s *ContextImpl) updateHandoverNamespacePendingTaskID() { context_impl.go
1744 > s.wLock()
1745 >
1746 > if s.errorByState() != nil {
1747 // if not in acquired state, this function will be called again
1748 // later when shard is re-acquired.
1751 }
1752
1753 > maxReplicationTaskID := s.getMaxReplicationTaskID() context_impl.go
1754 > s.handoverTracker.ResolvePendingTaskIDs(maxReplicationTaskID)
1755 > s.wUnlock()
1756 >
1757 > s.notifyReplicationQueueProcessor(maxReplicationTaskID)
1758 }
1759
1760 > func (s *ContextImpl) getMaxReplicationTaskID() int64 { context_impl.go
1761 > return s.taskKeyManager.getExclusiveReaderHighWatermark(tasks.CategoryReplication).TaskID - 1
1762 > }
1763
1764 > func (s *ContextImpl) notifyReplicationQueueProcessor(taskID int64) { context_impl.go
1765 > // Replication ack level won't exceed the max taskID it received via task notification.
1766 > // Since here we want it's ack level to advance to at least the input taskID, we need to
1767 > // trigger an fake notification.
1768 >
1769 > cancelledCtx, cancel := context.WithCancel(context.Background())
1770 > cancel()
1771 >
1772 > engine, err := s.engineFuture.Get(cancelledCtx)
1773 > if err != nil {
1774 s.contextTaggedLogger.Warn("tried to notify replication queue processor when engine is not ready")
1775 return
1776 }
1777
1778 > fakeReplicationTask := tasks.NewFakeTask(definition.WorkflowKey{}, tasks.CategoryReplication, tasks.MinimumKey.FireTime) context_impl.go
1779 > fakeReplicationTask.SetTaskID(taskID)
1780 >
1781 > engine.NotifyNewTasks(map[tasks.Category][]tasks.Task{
1782 > tasks.CategoryReplication: {fakeReplicationTask},
1783 > })
1784 }
1785
1786 > func (s *ContextImpl) loadShardMetadata(ownershipChanged *bool) error { context_impl.go
1787 > // Only have to do this once, we can just re-acquire the rangeid lock after that
1788 > s.rLock()
1789 > if s.shardInfo != nil {
1790 s.rUnlock()
1791 return nil
1792 }
1793 > s.rUnlock() context_impl.go
1794 >
1795 > // We don't have any shardInfo yet, load it (outside of context rwlock)
1796 > ctx, cancel := s.newIOContext()
1797 > defer cancel()
1798 > resp, err := s.persistenceShardManager.GetOrCreateShard(ctx, &persistence.GetOrCreateShardRequest{
1799 > ShardID: s.shardID,
1800 > LifecycleContext: s.lifecycleCtx,
1801 > })
1802 > if err != nil {
1803 s.contextTaggedLogger.Error("Failed to load shard", tag.Error(err))
1804 return err
1805 }
1806 > *ownershipChanged = resp.ShardInfo.Owner != s.owner context_impl.go
1807 > shardInfo := trimShardInfo(s.config, s.clusterMetadata.GetAllClusterInfo(), s.copyShardInfo(resp.ShardInfo))
1808 > shardInfo.Owner = s.owner
1809 >
1810 > // initialize the cluster current time to be the same as ack level
1811 > remoteClusterInfos := make(map[string]*remoteClusterInfo)
1812 > var taskMinScheduledTime time.Time
1813 > currentClusterName := s.GetClusterMetadata().GetCurrentClusterName()
1814 > taskCategories := s.taskCategoryRegistry.GetCategories()
1815 > for clusterName, info := range s.GetClusterMetadata().GetAllClusterInfo() {
1816 > if !info.Enabled {
1817 continue
1818 }
1819
1820 > exclusiveMaxReadTime := tasks.DefaultFireTime context_impl.go
1821 > for categoryID, queueState := range shardInfo.QueueStates {
1822 > category, ok := taskCategories[int(categoryID)] context_impl.go
1823 > if !ok || category.Type() != tasks.CategoryTypeScheduled {
1824 > continue
1825 }
1826
1827 > exclusiveMaxReadTime = util.MaxTime(exclusiveMaxReadTime, timestamp.TimeValue(queueState.ExclusiveReaderHighWatermark.FireTime)) context_impl.go
1828 }
1829
1833 // Once we validate the rest of the code can worker correctly with higher precision, the code should simply be
1834 // taskMinScheduledTime = util.MaxTime(taskMinScheduledTime, maxReadTime)
1835 > taskMinScheduledTime = util.MaxTime( context_impl.go
1836 > taskMinScheduledTime,
1837 > exclusiveMaxReadTime.Add(common.ScheduledTaskMinPrecision).Truncate(common.ScheduledTaskMinPrecision),
1838 > )
1839 >
1840 > if clusterName != currentClusterName {
1841 remoteClusterInfos[clusterName] = &remoteClusterInfo{
1842 CurrentTime: exclusiveMaxReadTime,
1847 }
1848
1849 > s.wLock() context_impl.go
1850 > defer s.wUnlock()
1851 >
1852 > s.shardInfo = shardInfo
1853 > s.remoteClusterInfos = remoteClusterInfos
1854 > s.taskKeyManager.setTaskMinScheduledTime(taskMinScheduledTime)
1855 >
1856 > return nil
1857 }
1858
1920 }
1921
1922 > func (s *ContextImpl) acquireShard() { context_impl.go
1923 > // This is called in two contexts: initially acquiring the rangeid lock, and trying to
1924 > // re-acquire it after a persistence error. In both cases, we retry the acquire operation
1925 > // (renewRangeLocked) for 5 minutes. Each individual attempt uses shardIOTimeout (by default, 5s) as
1926 > // the timeout. This lets us handle a few minutes of persistence unavailability without
1927 > // dropping and reloading the whole shard context, which is relatively expensive (includes
1928 > // caches that would have to be refilled, etc.).
1929 > //
1930 > // We stop retrying on any of:
1931 > // 1. We succeed in acquiring the rangeid lock.
1932 > // 2. We get ShardOwnershipLostError or lifecycleCtx ended.
1933 > // 3. The state changes to Stopping or Stopped.
1934 > //
1935 > // If the shard controller sees that service resolver has assigned ownership to someone
1936 > // else, it will call FinishStop, which will trigger case 3 above, and also cancel
1937 > // lifecycleCtx. The persistence operations called here use lifecycleCtx as their context,
1938 > // so if we were blocked in any of them, they should return immediately with a context
1939 > // canceled error.
1940 > policy := s.acquireShardRetryPolicy
1941 > if policy == nil {
1942 > policy = backoff.NewExponentialRetryPolicy(1 * time.Second).WithExpirationInterval(5 * time.Minute) context_impl.go
1943 > }
1944
1945 // Remember this value across attempts
1946 > ownershipChanged := false context_impl.go
1947 >
1948 > op := func() error {
1949 > if !s.IsValid() {
1950 return s.newShardClosedErrorWithShardID()
1951 }
1952
1953 // Initial load of shard metadata
1954 > err := s.loadShardMetadata(&ownershipChanged) context_impl.go
1955 > if err != nil {
1956 return err
1957 }
1967 // in-flight requests before making the call. So it's guaranteed that the renew rangeID
1968 // UpdateShard call is the only one in flight.
1969 > s.wLock() context_impl.go
1970 > err = s.renewRangeLocked(true)
1971 > s.wUnlock()
1972 > if err != nil {
1973 return err
1974 }
1975
1976 > s.contextTaggedLogger.Info("Acquired shard") context_impl.go
1977 >
1978 > // The first time we get the shard, we have to create the engine
1979 > var engine historyi.Engine
1980 > if !s.engineFuture.Ready() {
1981 > s.maybeRecordShardAcquisitionLatency(ownershipChanged) context_impl.go
1982 > engine = s.createEngine()
1983 > }
1984
1985 // NOTE: engine is created & started before setting shard state to acquired.
1987 // -> information for handover namespace is recorded before shard can servce traffic
1988 // -> upon shard reload, no history api or task can go through for ns in handover state
1989 > err = s.transition(contextRequestAcquired{engine: engine}) context_impl.go
1990 >
1991 > if err != nil {
1992 if engine != nil {
1993 // We tried to set the engine but the context was already stopped
1999 // we know engineFuture must be ready here, and we can notify queue processor
2000 // to trigger a load as queue max level can be updated to a newer value
2001 > s.notifyQueueProcessor() context_impl.go
2002 > // This runs until the lifecycleCtx is cancelled, so we only need to start it once
2003 > s.queueMetricEmitter.Do(func() {
2004 > go s.monitorQueueMetrics()
2005 > })
2006
2007 > s.updateHandoverNamespacePendingTaskID() context_impl.go
2008 >
2009 > return nil
2010 }
2011
2012 // keep retrying except ShardOwnershipLostError or lifecycle context ended
2013 > acquireShardRetryable := func(err error) (isRetryable bool) { context_impl.go
2014 defer func() {
2015 s.contextTaggedLogger.Error(
2028 return true
2029 }
2030 > err := backoff.ThrottleRetry(op, policy, acquireShardRetryable) context_impl.go
2031 > if err != nil {
2032 // We got an non-retryable error, e.g. ShardOwnershipLostError
2033 s.contextTaggedLogger.Error("Couldn't acquire shard", tag.Error(err))
2072 endpointRegistry chasm.EndpointRegistry,
2073 handoverTrackerFactory HandoverTrackerFactory,
2074 > ) (*ContextImpl, error) { context_impl.go
2075 > hostIdentity := hostInfoProvider.HostInfo().Identity()
2076 > sequenceID := atomic.AddInt64(&shardContextSequenceID, 1)
2077 >
2078 > lifecycleCtx, lifecycleCancel := context.WithCancel(context.Background())
2079 >
2080 > ioConcurrency := historyConfig.ShardIOConcurrency()
2081 > if ioConcurrency != 1 && persistenceConfig.DataStores[persistenceConfig.DefaultStore].Cassandra != nil {
2082 throttledLogger.Warn(
2083 fmt.Sprintf("Cassandra persistence implementation only supports %v == 1", dynamicconfig.ShardIOConcurrency),
2087 }
2088
2089 > taggedLogger := log.With(logger, tag.ShardID(shardID), tag.Address(hostIdentity)) context_impl.go
2090 > shardContext := &ContextImpl{
2091 > state: contextStateInitialized,
2092 > shardID: shardID,
2093 > owner: fmt.Sprintf("%s-%v-%v", hostIdentity, sequenceID, uuid.NewString()),
2094 > stringRepr: fmt.Sprintf("Shard(%d)", shardID),
2095 > executionManager: persistenceExecutionManager,
2096 > metricsHandler: metricsHandler,
2097 > eventLogger: eventLogger,
2098 > closeCallback: closeCallback,
2099 > config: historyConfig,
2100 > finalizer: finalizer.New(taggedLogger, metricsHandler),
2101 > contextTaggedLogger: taggedLogger,
2102 > throttledLogger: log.With(throttledLogger, tag.ShardID(shardID), tag.Address(hostIdentity)),
2103 > engineFactory: factory,
2104 > persistenceShardManager: persistenceShardManager,
2105 > clientBean: clientBean,
2106 > historyClient: historyClient,
2107 > payloadSerializer: payloadSerializer,
2108 > timeSource: timeSource,
2109 > namespaceRegistry: namespaceRegistry,
2110 > saProvider: saProvider,
2111 > saMapperProvider: saMapperProvider,
2112 > clusterMetadata: clusterMetadata,
2113 > archivalMetadata: archivalMetadata,
2114 > hostInfoProvider: hostInfoProvider,
2115 > taskCategoryRegistry: taskCategoryRegistry,
2116 > lifecycleCtx: lifecycleCtx,
2117 > lifecycleCancel: lifecycleCancel,
2118 > engineFuture: future.NewFuture[historyi.Engine](),
2119 > queueMetricEmitter: sync.Once{},
2120 > ioSemaphore: locks.NewPrioritySemaphore(ioConcurrency),
2121 > stateMachineRegistry: stateMachineRegistry,
2122 > chasmRegistry: chasmRegistry,
2123 > chasmWorkflowRegistry: chasmWorkflowRegistry,
2124 > endpointRegistry: endpointRegistry,
2125 > businessIDRateLimiters: cache.New(
2126 > historyConfig.BusinessIDReuseLimiterCacheSize(),
2127 > &cache.Options{TTL: historyConfig.BusinessIDReuseLimiterCacheTTL()},
2128 > ),
2129 > }
2130 > shardContext.taskKeyManager = newTaskKeyManager(
2131 > shardContext.taskCategoryRegistry,
2132 > timeSource,
2133 > historyConfig,
2134 > shardContext.GetLogger(),
2135 > func() error {
2136 return shardContext.renewRangeLocked(false)
2137 },
2138 )
2139 > shardContext.handoverTracker = handoverTrackerFactory(HandoverTrackerParams{ context_impl.go
2140 > ClusterMetadata: clusterMetadata,
2141 > GetMaxReplicationTaskID: shardContext.getMaxReplicationTaskID,
2142 > ErrorByStateFn: shardContext.errorByState,
2143 > NotifyReplicationFn: shardContext.notifyReplicationQueueProcessor,
2144 > NamespaceRegistry: namespaceRegistry,
2145 > Logger: taggedLogger,
2146 > })
2147 > if shardContext.GetConfig().EnableHostLevelEventsCache() {
2148 shardContext.eventsCache = eventsCache
2149 > } else { context_impl.go
2150 > shardContext.eventsCache = events.NewShardLevelEventsCache(
2151 > shardContext.executionManager,
2152 > shardContext.config,
2153 > shardContext.metricsHandler,
2154 > shardContext.contextTaggedLogger,
2155 > false,
2156 > )
2157 > }
2158 > shardContext.initLastUpdatesTime()
2159 > return shardContext, nil
2160 }
2161
2162 > func (s *ContextImpl) initLastUpdatesTime() { context_impl.go
2163 > // We need to set lastUpdate time to "now" - "wait between shard updates time" + "first update interval".
2164 > // This is done to make sure that first shard update` will happen around "first update interval" after "now".
2165 > // The idea is to allow queue to persist even in the case of (relativly) constantly
2166 > // moving shards between hosts.
2167 > // Note: it still may prevent queue from progressing if shard moving rate is too high
2168 > lastUpdated := s.timeSource.Now()
2169 > lastUpdated = lastUpdated.Add(-1 * s.config.ShardUpdateMinInterval())
2170 > lastUpdated = lastUpdated.Add(s.config.ShardFirstUpdateInterval())
2171 > s.lastUpdated = lastUpdated
2172 > }
2173
2174 // TODO: why do we need a deep copy here?
2175 > func (s *ContextImpl) copyShardInfo(shardInfo *persistencespb.ShardInfo) *persistencespb.ShardInfo { context_impl.go
2176 > // need to ser/de to make a deep copy of queue state
2177 > queueStates := make(map[int32]*persistencespb.QueueState, len(shardInfo.QueueStates))
2178 > for k, v := range shardInfo.QueueStates {
2179 > blob, _ := s.payloadSerializer.QueueStateToBlob(v) context_impl.go
2180 > queueState, _ := s.payloadSerializer.QueueStateFromBlob(blob)
2181 > queueStates[k] = queueState
2182 > }
2183
2184 > return &persistencespb.ShardInfo{ context_impl.go
2185 > ShardId: shardInfo.ShardId,
2186 > Owner: shardInfo.Owner,
2187 > RangeId: shardInfo.RangeId,
2188 > StolenSinceRenew: shardInfo.StolenSinceRenew,
2189 > ReplicationDlqAckLevel: maps.Clone(shardInfo.ReplicationDlqAckLevel),
2190 > UpdateTime: shardInfo.UpdateTime,
2191 > QueueStates: queueStates,
2192 > }
2193 }
2194
2212 }
2213
2214 > func (s *ContextImpl) GetMetricsHandler() metrics.Handler { context_impl.go
2215 > return s.metricsHandler
2216 > }
2217
2218 > func (s *ContextImpl) GetTimeSource() cclock.TimeSource { context_impl.go
2219 > return s.timeSource
2220 > }
2221
2222 func (s *ContextImpl) GetNamespaceRegistry() namespace.Registry {
2232 }
2233
2234 > func (s *ContextImpl) GetClusterMetadata() cluster.Metadata { context_impl.go
2235 > return s.clusterMetadata
2236 > }
2237
2238 func (s *ContextImpl) GetArchivalMetadata() archiver.ArchivalMetadata {
2303 func (s *ContextImpl) newDetachedContext(
2304 ctx context.Context,
2305 > ) (context.Context, context.CancelFunc, error) { context_impl.go
2306 > if err := ctx.Err(); err != nil {
2307 return nil, nil, err
2308 }
2309
2310 > detachedContext := rpc.CopyContextValues(s.lifecycleCtx, ctx) context_impl.go
2311 >
2312 > var cancel context.CancelFunc
2313 > deadline, ok := ctx.Deadline()
2314 > if ok {
2315 > timeout := max(deadline.Sub(s.GetTimeSource().Now()), minContextTimeout) context_impl.go
2316 > detachedContext, cancel = context.WithTimeout(detachedContext, timeout)
2317 > } else { context_impl.go
2318 cancel = func() {}
2319 }
2320
2321 > return detachedContext, cancel, nil context_impl.go
2322 }
2323
2324 > func (s *ContextImpl) newIOContext() (context.Context, context.CancelFunc) { context_impl.go
2325 > ctx, cancel := context.WithTimeout(s.lifecycleCtx, s.config.ShardIOTimeout())
2326 > ctx = headers.SetCallerInfo(ctx, headers.SystemBackgroundHighCallerInfo)
2327 >
2328 > return ctx, cancel
2329 > }
2330
2331 // newShardClosedErrorWithShardID when shard is closed and a req cannot be processed
2341 allClusterInfo map[string]cluster.ClusterInformation,
2342 shardInfo *persistencespb.ShardInfo,
2343 > ) *persistencespb.ShardInfo { context_impl.go
2344 > if shardInfo.QueueStates != nil && shardInfo.QueueStates[int32(tasks.CategoryIDReplication)] != nil {
2345 > for readerID := range shardInfo.QueueStates[int32(tasks.CategoryIDReplication)].ReaderStates { context_impl.go
2346 > clusterID, _ := ReplicationReaderIDToClusterShardID(readerID)
2347 > _, clusterInfo, found := clusterNameInfoFromClusterID(allClusterInfo, clusterID)
2348 > if !found || !cluster.IsReplicationEnabledForCluster(clusterInfo, cfg.EnableSeparateReplicationEnableFlag()) {
2349 > delete(shardInfo.QueueStates[int32(tasks.CategoryIDReplication)].ReaderStates, readerID)
2350 > }
2351 }
2352 > if len(shardInfo.QueueStates[int32(tasks.CategoryIDReplication)].ReaderStates) == 0 { context_impl.go
2353 > delete(shardInfo.QueueStates, int32(tasks.CategoryIDReplication))
2354 > }
2355 }
2356 > return shardInfo context_impl.go
2357 }
2358
2360 allClusterInfo map[string]cluster.ClusterInformation,
2361 clusterID int64,
2362 > ) (string, cluster.ClusterInformation, bool) { context_impl.go
2363 > for name, info := range allClusterInfo {
2364 > if info.InitialFailoverVersion == clusterID {
2365 return name, info, true
2366 }
2367 }
2368 > return "", cluster.ClusterInformation{}, false context_impl.go
2369 }
go.temporal.io/server/service/history/configs/config.go 392 covered LOC · 1 range

Open complete file

445 dc *dynamicconfig.Collection,
446 numberOfShards int32,
447 > ) *Config { config.go
448 > cfg := &Config{
449 > NumberOfShards: numberOfShards,
450 >
451 > EnableReplicationStream: dynamicconfig.EnableReplicationStream.Get(dc),
452 > EmitReplicationLifecycleEvents: dynamicconfig.EmitReplicationLifecycleEvents.Get(dc),
453 > EnableCloseInboundReplicationStreamOnShutdown: dynamicconfig.EnableCloseInboundReplicationStreamOnShutdown.Get(dc),
454 > EnableSeparateReplicationEnableFlag: dynamicconfig.EnableSeparateReplicationEnableFlag.Get(dc),
455 > HistoryReplicationDLQV2: dynamicconfig.EnableHistoryReplicationDLQV2.Get(dc),
456 >
457 > RPS: dynamicconfig.HistoryRPS.Get(dc),
458 > NamespaceRPS: dynamicconfig.HistoryNamespaceRPS.Get(dc),
459 > OperatorRPSRatio: dynamicconfig.OperatorRPSRatio.Get(dc),
460 > MaxIDLengthLimit: dynamicconfig.MaxIDLengthLimit.Get(dc),
461 > PersistenceMaxQPS: dynamicconfig.HistoryPersistenceMaxQPS.Get(dc),
462 > PersistenceGlobalMaxQPS: dynamicconfig.HistoryPersistenceGlobalMaxQPS.Get(dc),
463 > PersistenceNamespaceMaxQPS: dynamicconfig.HistoryPersistenceNamespaceMaxQPS.Get(dc),
464 > PersistenceGlobalNamespaceMaxQPS: dynamicconfig.HistoryPersistenceGlobalNamespaceMaxQPS.Get(dc),
465 > PersistencePerShardNamespaceMaxQPS: dynamicconfig.HistoryPersistencePerShardNamespaceMaxQPS.Get(dc),
466 > PersistenceDynamicRateLimitingParams: dynamicconfig.HistoryPersistenceDynamicRateLimitingParams.Get(dc),
467 > PersistenceQPSBurstRatio: dynamicconfig.PersistenceQPSBurstRatio.Get(dc),
468 > AlignMembershipChange: dynamicconfig.HistoryAlignMembershipChange.Get(dc),
469 > ShutdownDrainDuration: dynamicconfig.HistoryShutdownDrainDuration.Get(dc),
470 > StartupMembershipJoinDelay: dynamicconfig.HistoryStartupMembershipJoinDelay.Get(dc),
471 > AllowResetWithPendingChildren: dynamicconfig.AllowResetWithPendingChildren.Get(dc),
472 > MaxAutoResetPoints: dynamicconfig.HistoryMaxAutoResetPoints.Get(dc),
473 > DefaultWorkflowTaskTimeout: dynamicconfig.DefaultWorkflowTaskTimeout.Get(dc),
474 >
475 > MaxLocalParentWorkflowVerificationDuration: dynamicconfig.MaxLocalParentWorkflowVerificationDuration.Get(dc),
476 >
477 > VisibilityPersistenceMaxReadQPS: dynamicconfig.VisibilityPersistenceMaxReadQPS.Get(dc),
478 > VisibilityPersistenceMaxWriteQPS: dynamicconfig.VisibilityPersistenceMaxWriteQPS.Get(dc),
479 > VisibilityPersistenceSlowQueryThreshold: dynamicconfig.VisibilityPersistenceSlowQueryThreshold.Get(dc),
480 > EnableReadFromSecondaryVisibility: dynamicconfig.EnableReadFromSecondaryVisibility.Get(dc),
481 > VisibilityEnableShadowReadMode: dynamicconfig.VisibilityEnableShadowReadMode.Get(dc),
482 > SecondaryVisibilityWritingMode: dynamicconfig.SecondaryVisibilityWritingMode.Get(dc),
483 > VisibilityDisableOrderByClause: dynamicconfig.VisibilityDisableOrderByClause.Get(dc),
484 > VisibilityEnableManualPagination: dynamicconfig.VisibilityEnableManualPagination.Get(dc),
485 > VisibilityEnableUnifiedQueryConverter: dynamicconfig.VisibilityEnableUnifiedQueryConverter.Get(dc),
486 > VisibilityAllowList: dynamicconfig.VisibilityAllowList.Get(dc),
487 > SuppressErrorSetSystemSearchAttribute: dynamicconfig.SuppressErrorSetSystemSearchAttribute.Get(dc),
488 >
489 > EmitShardLagLog: dynamicconfig.EmitShardLagLog.Get(dc),
490 > EnableDataLossMetrics: dynamicconfig.EnableDataLossMetrics.Get(dc),
491 > // HistoryCacheLimitSizeBased should not change during runtime.
492 > HistoryCacheLimitSizeBased: dynamicconfig.HistoryCacheSizeBasedLimit.Get(dc)(),
493 > HistoryHostLevelCacheMaxSize: dynamicconfig.HistoryCacheHostLevelMaxSize.Get(dc),
494 > HistoryHostLevelCacheMaxSizeBytes: dynamicconfig.HistoryCacheHostLevelMaxSizeBytes.Get(dc),
495 > HistoryCacheTTL: dynamicconfig.HistoryCacheTTL.Get(dc),
496 > HistoryCacheNonUserContextLockTimeout: dynamicconfig.HistoryCacheNonUserContextLockTimeout.Get(dc),
497 > HistoryCacheBackgroundEvict: dynamicconfig.HistoryCacheBackgroundEvict.Get(dc),
498 > EnableWorkflowExecutionTimeoutTimer: dynamicconfig.EnableWorkflowExecutionTimeoutTimer.Get(dc),
499 > EnableUpdateWorkflowModeIgnoreCurrent: dynamicconfig.EnableUpdateWorkflowModeIgnoreCurrent.Get(dc),
500 > EnableTransitionHistory: dynamicconfig.EnableTransitionHistory.Get(dc),
501 > MaxCallbacksPerWorkflow: dynamicconfig.MaxCallbacksPerWorkflow.Get(dc),
502 > MaxCallbacksPerExecution: callback.MaxPerExecution.Get(dc),
503 > MaxCallbacksPerUpdateID: dynamicconfig.MaxCallbacksPerUpdateID.Get(dc),
504 > EnableChasm: dynamicconfig.EnableChasm.Get(dc),
505 > EnableChasmNexusWorkflowOperations: nexusoperation.EnableChasmWorkflowOperations.Get(dc),
506 > ChasmMaxInMemoryPureTasks: dynamicconfig.ChasmMaxInMemoryPureTasks.Get(dc),
507 >
508 > EnableCHASMSchedulerCreation: dynamicconfig.EnableCHASMSchedulerCreation.Get(dc),
509 > EnableCHASMSchedulerMigration: dynamicconfig.EnableCHASMSchedulerMigration.Get(dc),
510 >
511 > EnableCHASMCallbacks: dynamicconfig.EnableCHASMCallbacks.Get(dc),
512 > EnableCHASMSignalBacklinks: dynamicconfig.EnableCHASMSignalBacklinks.Get(dc),
513 > ExternalPayloadsEnabled: dynamicconfig.ExternalPayloadsEnabled.Get(dc),
514 > EnableWorkflowUpdateCallbacks: dynamicconfig.EnableWorkflowUpdateCallbacks.Get(dc),
515 >
516 > EventsShardLevelCacheMaxSizeBytes: dynamicconfig.EventsCacheMaxSizeBytes.Get(dc), // 512KB
517 > EventsHostLevelCacheMaxSizeBytes: dynamicconfig.EventsHostLevelCacheMaxSizeBytes.Get(dc), // 256MB
518 > EventsCacheTTL: dynamicconfig.EventsCacheTTL.Get(dc),
519 > EnableHostLevelEventsCache: dynamicconfig.EnableHostLevelEventsCache.Get(dc),
520 >
521 > RangeSizeBits: 20, // 20 bits for sequencer, 2^20 sequence number for any range
522 >
523 > AcquireShardInterval: dynamicconfig.AcquireShardInterval.Get(dc),
524 > AcquireShardConcurrency: dynamicconfig.AcquireShardConcurrency.Get(dc),
525 > ShardIOConcurrency: dynamicconfig.ShardIOConcurrency.Get(dc),
526 > ShardIOTimeout: dynamicconfig.ShardIOTimeout.Get(dc),
527 > ShardLingerOwnershipCheckQPS: dynamicconfig.ShardLingerOwnershipCheckQPS.Get(dc),
528 > ShardLingerTimeLimit: dynamicconfig.ShardLingerTimeLimit.Get(dc),
529 > ShardFinalizerTimeout: dynamicconfig.ShardFinalizerTimeout.Get(dc),
530 >
531 > HistoryClientOwnershipCachingEnabled: dynamicconfig.HistoryClientOwnershipCachingEnabled.Get(dc),
532 >
533 > StandbyClusterDelay: dynamicconfig.StandbyClusterDelay.Get(dc),
534 > StandbyTaskMissingEventsResendDelay: dynamicconfig.StandbyTaskMissingEventsResendDelay.Get(dc),
535 > StandbyTaskMissingEventsDiscardDelay: dynamicconfig.StandbyTaskMissingEventsDiscardDelay.Get(dc),
536 > ChasmStandbyTaskDiscardDelay: dynamicconfig.ChasmStandbyTaskDiscardDelay.Get(dc),
537 >
538 > QueuePendingTaskCriticalCount: dynamicconfig.QueuePendingTaskCriticalCount.Get(dc),
539 > QueueReaderStuckCriticalAttempts: dynamicconfig.QueueReaderStuckCriticalAttempts.Get(dc),
540 > QueueCriticalSlicesCount: dynamicconfig.QueueCriticalSlicesCount.Get(dc),
541 > QueuePendingTaskMaxCount: dynamicconfig.QueuePendingTaskMaxCount.Get(dc),
542 > QueueMaxPredicateSize: dynamicconfig.QueueMaxPredicateSize.Get(dc),
543 > QueueShrinkPredicateMaxPendingKeys: dynamicconfig.QueueShrinkPredicateMaxPendingKeys.Get(dc),
544 > QueueMoveGroupTaskCountBase: dynamicconfig.QueueMoveGroupTaskCountBase.Get(dc),
545 > QueueMoveGroupTaskCountMultiplier: dynamicconfig.QueueMoveGroupTaskCountMultiplier.Get(dc),
546 >
547 > TaskDLQEnabled: dynamicconfig.HistoryTaskDLQEnabled.Get(dc),
548 > TaskDLQUnexpectedErrorAttempts: dynamicconfig.HistoryTaskDLQUnexpectedErrorAttempts.Get(dc),
549 > TaskDLQInternalErrors: dynamicconfig.HistoryTaskDLQInternalErrors.Get(dc),
550 > TaskDLQErrorPattern: dynamicconfig.HistoryTaskDLQErrorPattern.Get(dc),
551 >
552 > TaskSchedulerEnableRateLimiter: dynamicconfig.TaskSchedulerEnableRateLimiter.Get(dc),
553 > TaskSchedulerEnableRateLimiterShadowMode: dynamicconfig.TaskSchedulerEnableRateLimiterShadowMode.Get(dc),
554 > TaskSchedulerRateLimiterStartupDelay: dynamicconfig.TaskSchedulerRateLimiterStartupDelay.Get(dc),
555 > TaskSchedulerGlobalMaxQPS: dynamicconfig.TaskSchedulerGlobalMaxQPS.Get(dc),
556 > TaskSchedulerMaxQPS: dynamicconfig.TaskSchedulerMaxQPS.Get(dc),
557 > TaskSchedulerNamespaceMaxQPS: dynamicconfig.TaskSchedulerNamespaceMaxQPS.Get(dc),
558 > TaskSchedulerGlobalNamespaceMaxQPS: dynamicconfig.TaskSchedulerGlobalNamespaceMaxQPS.Get(dc),
559 > TaskSchedulerInactiveChannelDeletionDelay: dynamicconfig.TaskSchedulerInactiveChannelDeletionDelay.Get(dc),
560 > TaskSchedulerEnableExecutionQueueScheduler: dynamicconfig.TaskSchedulerEnableExecutionQueueScheduler.Get(dc),
561 > TaskSchedulerExecutionQueueSchedulerMaxQueues: dynamicconfig.TaskSchedulerExecutionQueueSchedulerMaxQueues.Get(dc),
562 > TaskSchedulerExecutionQueueSchedulerQueueTTL: dynamicconfig.TaskSchedulerExecutionQueueSchedulerQueueTTL.Get(dc),
563 > TaskSchedulerExecutionQueueSchedulerQueueConcurrency: dynamicconfig.TaskSchedulerExecutionQueueSchedulerQueueConcurrency.Get(dc),
564 >
565 > TimerTaskBatchSize: dynamicconfig.TimerTaskBatchSize.Get(dc),
566 > TimerProcessorSchedulerWorkerCount: dynamicconfig.TimerProcessorSchedulerWorkerCount.Subscribe(dc),
567 > TimerProcessorSchedulerActiveRoundRobinWeights: dynamicconfig.TimerProcessorSchedulerActiveRoundRobinWeights.WithDefault(ConvertWeightsToDynamicConfigValue(DefaultActiveTaskPriorityWeight)).Get(dc),
568 > TimerProcessorSchedulerStandbyRoundRobinWeights: dynamicconfig.TimerProcessorSchedulerStandbyRoundRobinWeights.WithDefault(ConvertWeightsToDynamicConfigValue(DefaultStandbyTaskPriorityWeight)).Get(dc),
569 > TimerProcessorUpdateAckInterval: dynamicconfig.TimerProcessorUpdateAckInterval.Get(dc),
570 > TimerProcessorUpdateAckIntervalJitterCoefficient: dynamicconfig.TimerProcessorUpdateAckIntervalJitterCoefficient.Get(dc),
571 > TimerProcessorMaxPollRPS: dynamicconfig.TimerProcessorMaxPollRPS.Get(dc),
572 > TimerProcessorMaxPollHostRPS: dynamicconfig.TimerProcessorMaxPollHostRPS.Get(dc),
573 > TimerProcessorMaxPollInterval: dynamicconfig.TimerProcessorMaxPollInterval.Get(dc),
574 > TimerProcessorMaxPollIntervalJitterCoefficient: dynamicconfig.TimerProcessorMaxPollIntervalJitterCoefficient.Get(dc),
575 > TimerProcessorPollBackoffInterval: dynamicconfig.TimerProcessorPollBackoffInterval.Get(dc),
576 > TimerProcessorMaxTimeShift: dynamicconfig.TimerProcessorMaxTimeShift.Get(dc),
577 > TransferQueueMaxReaderCount: dynamicconfig.TransferQueueMaxReaderCount.Get(dc),
578 > RetentionTimerJitterDuration: dynamicconfig.RetentionTimerJitterDuration.Get(dc),
579 >
580 > MemoryTimerProcessorSchedulerWorkerCount: dynamicconfig.MemoryTimerProcessorSchedulerWorkerCount.Subscribe(dc),
581 >
582 > TransferTaskBatchSize: dynamicconfig.TransferTaskBatchSize.Get(dc),
583 > TransferProcessorSchedulerWorkerCount: dynamicconfig.TransferProcessorSchedulerWorkerCount.Subscribe(dc),
584 > TransferProcessorSchedulerActiveRoundRobinWeights: dynamicconfig.TransferProcessorSchedulerActiveRoundRobinWeights.WithDefault(ConvertWeightsToDynamicConfigValue(DefaultActiveTaskPriorityWeight)).Get(dc),
585 > TransferProcessorSchedulerStandbyRoundRobinWeights: dynamicconfig.TransferProcessorSchedulerStandbyRoundRobinWeights.WithDefault(ConvertWeightsToDynamicConfigValue(DefaultStandbyTaskPriorityWeight)).Get(dc),
586 > TransferProcessorMaxPollRPS: dynamicconfig.TransferProcessorMaxPollRPS.Get(dc),
587 > TransferProcessorMaxPollHostRPS: dynamicconfig.TransferProcessorMaxPollHostRPS.Get(dc),
588 > TransferProcessorMaxPollInterval: dynamicconfig.TransferProcessorMaxPollInterval.Get(dc),
589 > TransferProcessorMaxPollIntervalJitterCoefficient: dynamicconfig.TransferProcessorMaxPollIntervalJitterCoefficient.Get(dc),
590 > TransferProcessorUpdateAckInterval: dynamicconfig.TransferProcessorUpdateAckInterval.Get(dc),
591 > TransferProcessorUpdateAckIntervalJitterCoefficient: dynamicconfig.TransferProcessorUpdateAckIntervalJitterCoefficient.Get(dc),
592 > TransferProcessorPollBackoffInterval: dynamicconfig.TransferProcessorPollBackoffInterval.Get(dc),
593 > TransferProcessorEnsureCloseBeforeDelete: dynamicconfig.TransferProcessorEnsureCloseBeforeDelete.Get(dc),
594 > TimerQueueMaxReaderCount: dynamicconfig.TimerQueueMaxReaderCount.Get(dc),
595 >
596 > OutboundTaskBatchSize: dynamicconfig.OutboundTaskBatchSize.Get(dc),
597 > OutboundProcessorMaxPollRPS: dynamicconfig.OutboundProcessorMaxPollRPS.Get(dc),
598 > OutboundProcessorMaxPollHostRPS: dynamicconfig.OutboundProcessorMaxPollHostRPS.Get(dc),
599 > OutboundProcessorMaxPollInterval: dynamicconfig.OutboundProcessorMaxPollInterval.Get(dc),
600 > OutboundProcessorMaxPollIntervalJitterCoefficient: dynamicconfig.OutboundProcessorMaxPollIntervalJitterCoefficient.Get(dc),
601 > OutboundProcessorUpdateAckInterval: dynamicconfig.OutboundProcessorUpdateAckInterval.Get(dc),
602 > OutboundProcessorUpdateAckIntervalJitterCoefficient: dynamicconfig.OutboundProcessorUpdateAckIntervalJitterCoefficient.Get(dc),
603 > OutboundProcessorPollBackoffInterval: dynamicconfig.OutboundProcessorPollBackoffInterval.Get(dc),
604 > OutboundQueuePendingTaskCriticalCount: dynamicconfig.OutboundQueuePendingTaskCriticalCount.Get(dc),
605 > OutboundQueuePendingTaskMaxCount: dynamicconfig.OutboundQueuePendingTaskMaxCount.Get(dc),
606 > OutboundQueueMaxPredicateSize: dynamicconfig.OutboundQueueMaxPredicateSize.Get(dc),
607 > OutboundQueueMaxReaderCount: dynamicconfig.OutboundQueueMaxReaderCount.Get(dc),
608 > OutboundQueueGroupLimiterBufferSize: dynamicconfig.OutboundQueueGroupLimiterBufferSize.Get(dc),
609 > OutboundQueueGroupLimiterConcurrency: dynamicconfig.OutboundQueueGroupLimiterConcurrency.Get(dc),
610 > OutboundQueueHostSchedulerMaxTaskRPS: dynamicconfig.OutboundQueueHostSchedulerMaxTaskRPS.Get(dc),
611 > OutboundQueueCircuitBreakerSettings: dynamicconfig.OutboundQueueCircuitBreakerSettings.Subscribe(dc),
612 > OutboundStandbyTaskMissingEventsDestinationDownErr: dynamicconfig.OutboundStandbyTaskMissingEventsDestinationDownErr.Get(dc),
613 > OutboundStandbyTaskMissingEventsDiscardDelay: dynamicconfig.OutboundStandbyTaskMissingEventsDiscardDelay.Get(dc),
614 >
615 > ReplicatorProcessorMaxPollInterval: dynamicconfig.ReplicatorProcessorMaxPollInterval.Get(dc),
616 > ReplicatorProcessorMaxPollIntervalJitterCoefficient: dynamicconfig.ReplicatorProcessorMaxPollIntervalJitterCoefficient.Get(dc),
617 > ReplicatorProcessorFetchTasksBatchSize: dynamicconfig.ReplicatorTaskBatchSize.Get(dc),
618 > ReplicatorProcessorMaxSkipTaskCount: dynamicconfig.ReplicatorMaxSkipTaskCount.Get(dc),
619 > ReplicationTaskProcessorHostQPS: dynamicconfig.ReplicationTaskProcessorHostQPS.Get(dc),
620 > ReplicationTaskProcessorShardQPS: dynamicconfig.ReplicationTaskProcessorShardQPS.Get(dc),
621 > ReplicationEnableDLQMetrics: dynamicconfig.ReplicationEnableDLQMetrics.Get(dc),
622 > ReplicationEnableUpdateWithNewTaskMerge: dynamicconfig.ReplicationEnableUpdateWithNewTaskMerge.Get(dc),
623 > ReplicationStreamSyncStatusDuration: dynamicconfig.ReplicationStreamSyncStatusDuration.Get(dc),
624 > ReplicationProcessorSchedulerQueueSize: dynamicconfig.ReplicationProcessorSchedulerQueueSize.Get(dc),
625 > ReplicationProcessorSchedulerWorkerCount: dynamicconfig.ReplicationProcessorSchedulerWorkerCount.Subscribe(dc),
626 > ReplicationLowPriorityProcessorSchedulerWorkerCount: dynamicconfig.ReplicationLowPriorityProcessorSchedulerWorkerCount.Subscribe(dc),
627 > ReplicationLowPriorityTaskParallelism: dynamicconfig.ReplicationLowPriorityTaskParallelism.Get(dc),
628 > EnableReplicationTaskBatching: dynamicconfig.EnableReplicationTaskBatching.Get(dc),
629 > EnableReplicationTaskTieredProcessing: dynamicconfig.EnableReplicationTaskTieredProcessing.Get(dc),
630 > ReplicationStreamSenderHighPriorityQPS: dynamicconfig.ReplicationStreamSenderHighPriorityQPS.Get(dc),
631 > ReplicationStreamSenderLowPriorityQPS: dynamicconfig.ReplicationStreamSenderLowPriorityQPS.Get(dc),
632 > ReplicationStreamEventLoopRetryMaxAttempts: dynamicconfig.ReplicationStreamEventLoopRetryMaxAttempts.Get(dc),
633 > ReplicationReceiverMaxOutstandingTaskCount: dynamicconfig.ReplicationReceiverMaxOutstandingTaskCount.Get(dc),
634 > ReplicationReceiverSlowSubmissionLatencyThreshold: dynamicconfig.ReplicationReceiverSlowSubmissionLatencyThreshold.Get(dc),
635 > ReplicationReceiverSlowSubmissionWindow: dynamicconfig.ReplicationReceiverSlowSubmissionWindow.Get(dc),
636 > EnableReplicationReceiverSlowSubmissionFlowControl: dynamicconfig.EnableReplicationReceiverSlowSubmissionFlowControl.Get(dc),
637 > ReplicationResendMaxBatchCount: dynamicconfig.ReplicationResendMaxBatchCount.Get(dc),
638 > ReplicationProgressCacheMaxSize: dynamicconfig.ReplicationProgressCacheMaxSize.Get(dc),
639 > ReplicationProgressCacheTTL: dynamicconfig.ReplicationProgressCacheTTL.Get(dc),
640 > ReplicationEnableRateLimit: dynamicconfig.ReplicationEnableRateLimit.Get(dc),
641 > ReplicationEnableRateLimitShadowMode: dynamicconfig.ReplicationEnableRateLimitShadowMode.Get(dc),
642 > ReplicationStreamSendEmptyTaskDuration: dynamicconfig.ReplicationStreamSendEmptyTaskDuration.Get(dc),
643 > ReplicationStreamReceiverLivenessMultiplier: dynamicconfig.ReplicationStreamReceiverLivenessMultiplier.Get(dc),
644 > ReplicationStreamSenderLivenessMultiplier: dynamicconfig.ReplicationStreamSenderLivenessMultiplier.Get(dc),
645 > EnableHistoryReplicationRateLimiter: dynamicconfig.EnableHistoryReplicationRateLimiter.Get(dc),
646 >
647 > MaximumBufferedEventsBatch: dynamicconfig.MaximumBufferedEventsBatch.Get(dc),
648 > MaximumBufferedEventsSizeInBytes: dynamicconfig.MaximumBufferedEventsSizeInBytes.Get(dc),
649 > MaximumSignalsPerExecution: dynamicconfig.MaximumSignalsPerExecution.Get(dc),
650 > MaximumEventBatchSizeInBytes: dynamicconfig.MaximumEventBatchSizeInBytes.Get(dc),
651 > ShardUpdateMinInterval: dynamicconfig.ShardUpdateMinInterval.Get(dc),
652 > ShardFirstUpdateInterval: dynamicconfig.ShardFirstUpdateInterval.Get(dc),
653 > ShardUpdateMinTasksCompleted: dynamicconfig.ShardUpdateMinTasksCompleted.Get(dc),
654 > ShardSyncMinInterval: dynamicconfig.ShardSyncMinInterval.Get(dc),
655 > ShardSyncTimerJitterCoefficient: dynamicconfig.TransferProcessorMaxPollIntervalJitterCoefficient.Get(dc),
656 >
657 > // history client: client/history/client.go set the client timeout 30s
658 > // TODO: Return this value to the client: go.temporal.io/server/issues/294
659 > LongPollExpirationInterval: dynamicconfig.HistoryLongPollExpirationInterval.Get(dc),
660 > EnableParentClosePolicy: dynamicconfig.EnableParentClosePolicy.Get(dc),
661 > NumParentClosePolicySystemWorkflows: dynamicconfig.NumParentClosePolicySystemWorkflows.Get(dc),
662 > EnableParentClosePolicyWorker: dynamicconfig.EnableParentClosePolicyWorker.Get(dc),
663 > ParentClosePolicyThreshold: dynamicconfig.ParentClosePolicyThreshold.Get(dc),
664 >
665 > BlobSizeLimitError: dynamicconfig.BlobSizeLimitError.Get(dc),
666 > BlobSizeLimitWarn: dynamicconfig.BlobSizeLimitWarn.Get(dc),
667 > MemoSizeLimitError: dynamicconfig.MemoSizeLimitError.Get(dc),
668 > MemoSizeLimitWarn: dynamicconfig.MemoSizeLimitWarn.Get(dc),
669 > NumPendingChildExecutionsLimit: dynamicconfig.NumPendingChildExecutionsLimitError.Get(dc),
670 > NumPendingActivitiesLimit: dynamicconfig.NumPendingActivitiesLimitError.Get(dc),
671 > NumPendingSignalsLimit: dynamicconfig.NumPendingSignalsLimitError.Get(dc),
672 > NumPendingCancelsRequestLimit: dynamicconfig.NumPendingCancelRequestsLimitError.Get(dc),
673 > HistorySizeLimitError: dynamicconfig.HistorySizeLimitError.Get(dc),
674 > HistorySizeLimitWarn: dynamicconfig.HistorySizeLimitWarn.Get(dc),
675 > HistorySizeSuggestContinueAsNew: dynamicconfig.HistorySizeSuggestContinueAsNew.Get(dc),
676 > HistoryCountLimitError: dynamicconfig.HistoryCountLimitError.Get(dc),
677 > HistoryCountLimitWarn: dynamicconfig.HistoryCountLimitWarn.Get(dc),
678 > HistoryCountSuggestContinueAsNew: dynamicconfig.HistoryCountSuggestContinueAsNew.Get(dc),
679 > HistoryMaxPageSize: dynamicconfig.HistoryMaxPageSize.Get(dc),
680 > MutableStateActivityFailureSizeLimitError: dynamicconfig.MutableStateActivityFailureSizeLimitError.Get(dc),
681 > MutableStateActivityFailureSizeLimitWarn: dynamicconfig.MutableStateActivityFailureSizeLimitWarn.Get(dc),
682 > MutableStateSizeLimitError: dynamicconfig.MutableStateSizeLimitError.Get(dc),
683 > MutableStateSizeLimitWarn: dynamicconfig.MutableStateSizeLimitWarn.Get(dc),
684 > MutableStateTombstoneCountLimit: dynamicconfig.MutableStateTombstoneCountLimit.Get(dc),
685 >
686 > ThrottledLogRPS: dynamicconfig.HistoryThrottledLogRPS.Get(dc),
687 > EnableStickyQuery: dynamicconfig.EnableStickyQuery.Get(dc),
688 >
689 > DefaultActivityRetryPolicy: dynamicconfig.DefaultActivityRetryPolicy.Get(dc),
690 > DefaultWorkflowRetryPolicy: dynamicconfig.DefaultWorkflowRetryPolicy.Get(dc),
691 > WorkflowTaskHeartbeatTimeout: dynamicconfig.WorkflowTaskHeartbeatTimeout.Get(dc),
692 > WorkflowTaskCriticalAttempts: dynamicconfig.WorkflowTaskCriticalAttempts.Get(dc),
693 > WorkflowTaskRetryMaxInterval: dynamicconfig.WorkflowTaskRetryMaxInterval.Get(dc),
694 > EnableWorkflowTaskStampIncrementOnFailure: dynamicconfig.EnableWorkflowTaskStampIncrementOnFailure.Get(dc),
695 > DiscardSpeculativeWorkflowTaskMaximumEventsCount: dynamicconfig.DiscardSpeculativeWorkflowTaskMaximumEventsCount.Get(dc),
696 > EnableDropRepeatedWorkflowTaskFailures: dynamicconfig.EnableDropRepeatedWorkflowTaskFailures.Get(dc),
697 > SendTransientOrSpeculativeWorkflowTaskEvents: dynamicconfig.SendTransientOrSpeculativeWorkflowTaskEvents.Get(dc),
698 >
699 > ReplicationTaskApplyTimeout: dynamicconfig.ReplicationTaskApplyTimeout.Get(dc),
700 > ReplicationTaskFetcherParallelism: dynamicconfig.ReplicationTaskFetcherParallelism.Get(dc),
701 > ReplicationTaskFetcherAggregationInterval: dynamicconfig.ReplicationTaskFetcherAggregationInterval.Get(dc),
702 > ReplicationTaskFetcherTimerJitterCoefficient: dynamicconfig.ReplicationTaskFetcherTimerJitterCoefficient.Get(dc),
703 > ReplicationTaskFetcherErrorRetryWait: dynamicconfig.ReplicationTaskFetcherErrorRetryWait.Get(dc),
704 >
705 > ReplicationTaskProcessorErrorRetryWait: dynamicconfig.ReplicationTaskProcessorErrorRetryWait.Get(dc),
706 > ReplicationTaskProcessorErrorRetryBackoffCoefficient: dynamicconfig.ReplicationTaskProcessorErrorRetryBackoffCoefficient.Get(dc),
707 > ReplicationTaskProcessorErrorRetryMaxInterval: dynamicconfig.ReplicationTaskProcessorErrorRetryMaxInterval.Get(dc),
708 > ReplicationTaskProcessorErrorRetryMaxAttempts: dynamicconfig.ReplicationTaskProcessorErrorRetryMaxAttempts.Get(dc),
709 > ReplicationTaskProcessorErrorRetryExpiration: dynamicconfig.ReplicationTaskProcessorErrorRetryExpiration.Get(dc),
710 > ReplicationTaskProcessorNoTaskRetryWait: dynamicconfig.ReplicationTaskProcessorNoTaskInitialWait.Get(dc),
711 > ReplicationTaskProcessorCleanupInterval: dynamicconfig.ReplicationTaskProcessorCleanupInterval.Get(dc),
712 > ReplicationTaskProcessorCleanupJitterCoefficient: dynamicconfig.ReplicationTaskProcessorCleanupJitterCoefficient.Get(dc),
713 > ReplicationMultipleBatches: dynamicconfig.ReplicationMultipleBatches.Get(dc),
714 >
715 > ReplicationStreamSenderErrorRetryWait: dynamicconfig.ReplicationStreamSenderErrorRetryWait.Get(dc),
716 > ReplicationStreamSenderErrorRetryBackoffCoefficient: dynamicconfig.ReplicationStreamSenderErrorRetryBackoffCoefficient.Get(dc),
717 > ReplicationStreamSenderErrorRetryMaxInterval: dynamicconfig.ReplicationStreamSenderErrorRetryMaxInterval.Get(dc),
718 > ReplicationStreamSenderErrorRetryMaxAttempts: dynamicconfig.ReplicationStreamSenderErrorRetryMaxAttempts.Get(dc),
719 > ReplicationStreamSenderErrorRetryExpiration: dynamicconfig.ReplicationStreamSenderErrorRetryExpiration.Get(dc),
720 >
721 > ReplicationExecutableTaskErrorRetryWait: dynamicconfig.ReplicationExecutableTaskErrorRetryWait.Get(dc),
722 > ReplicationExecutableTaskErrorRetryBackoffCoefficient: dynamicconfig.ReplicationExecutableTaskErrorRetryBackoffCoefficient.Get(dc),
723 > ReplicationExecutableTaskErrorRetryMaxInterval: dynamicconfig.ReplicationExecutableTaskErrorRetryMaxInterval.Get(dc),
724 > ReplicationExecutableTaskErrorRetryMaxAttempts: dynamicconfig.ReplicationExecutableTaskErrorRetryMaxAttempts.Get(dc),
725 > ReplicationExecutableTaskErrorRetryExpiration: dynamicconfig.ReplicationExecutableTaskErrorRetryExpiration.Get(dc),
726 >
727 > MaxBufferedQueryCount: dynamicconfig.MaxBufferedQueryCount.Get(dc),
728 > MutableStateChecksumGenProbability: dynamicconfig.MutableStateChecksumGenProbability.Get(dc),
729 > MutableStateChecksumVerifyProbability: dynamicconfig.MutableStateChecksumVerifyProbability.Get(dc),
730 > MutableStateChecksumInvalidateBefore: dynamicconfig.MutableStateChecksumInvalidateBefore.Get(dc),
731 >
732 > StandbyTaskReReplicationContextTimeout: dynamicconfig.StandbyTaskReReplicationContextTimeout.Get(dc),
733 >
734 > SkipReapplicationByNamespaceID: dynamicconfig.SkipReapplicationByNamespaceID.Get(dc),
735 >
736 > // ===== Visibility related =====
737 > VisibilityTaskBatchSize: dynamicconfig.VisibilityTaskBatchSize.Get(dc),
738 > VisibilityProcessorMaxPollRPS: dynamicconfig.VisibilityProcessorMaxPollRPS.Get(dc),
739 > VisibilityProcessorMaxPollHostRPS: dynamicconfig.VisibilityProcessorMaxPollHostRPS.Get(dc),
740 > VisibilityProcessorSchedulerWorkerCount: dynamicconfig.VisibilityProcessorSchedulerWorkerCount.Subscribe(dc),
741 > VisibilityProcessorSchedulerActiveRoundRobinWeights: dynamicconfig.VisibilityProcessorSchedulerActiveRoundRobinWeights.WithDefault(ConvertWeightsToDynamicConfigValue(DefaultActiveTaskPriorityWeight)).Get(dc),
742 > VisibilityProcessorSchedulerStandbyRoundRobinWeights: dynamicconfig.VisibilityProcessorSchedulerStandbyRoundRobinWeights.WithDefault(ConvertWeightsToDynamicConfigValue(DefaultStandbyTaskPriorityWeight)).Get(dc),
743 > VisibilityProcessorMaxPollInterval: dynamicconfig.VisibilityProcessorMaxPollInterval.Get(dc),
744 > VisibilityProcessorMaxPollIntervalJitterCoefficient: dynamicconfig.VisibilityProcessorMaxPollIntervalJitterCoefficient.Get(dc),
745 > VisibilityProcessorUpdateAckInterval: dynamicconfig.VisibilityProcessorUpdateAckInterval.Get(dc),
746 > VisibilityProcessorUpdateAckIntervalJitterCoefficient: dynamicconfig.VisibilityProcessorUpdateAckIntervalJitterCoefficient.Get(dc),
747 > VisibilityProcessorPollBackoffInterval: dynamicconfig.VisibilityProcessorPollBackoffInterval.Get(dc),
748 > VisibilityProcessorEnsureCloseBeforeDelete: dynamicconfig.VisibilityProcessorEnsureCloseBeforeDelete.Get(dc),
749 > VisibilityProcessorEnableCloseWorkflowCleanup: dynamicconfig.VisibilityProcessorEnableCloseWorkflowCleanup.Get(dc),
750 > VisibilityProcessorRelocateAttributesMinBlobSize: dynamicconfig.VisibilityProcessorRelocateAttributesMinBlobSize.Get(dc),
751 > VisibilityQueueMaxReaderCount: dynamicconfig.VisibilityQueueMaxReaderCount.Get(dc),
752 >
753 > DisableFetchRelocatableAttributesFromVisibility: dynamicconfig.DisableFetchRelocatableAttributesFromVisibility.Get(dc),
754 >
755 > SearchAttributesNumberOfKeysLimit: dynamicconfig.SearchAttributesNumberOfKeysLimit.Get(dc),
756 > SearchAttributesSizeOfValueLimit: dynamicconfig.SearchAttributesSizeOfValueLimit.Get(dc),
757 > SearchAttributesTotalSizeLimit: dynamicconfig.SearchAttributesTotalSizeLimit.Get(dc),
758 > IndexerConcurrency: dynamicconfig.WorkerIndexerConcurrency.Get(dc),
759 > ESProcessorNumOfWorkers: dynamicconfig.WorkerESProcessorNumOfWorkers.Get(dc),
760 > // Should not be greater than number of visibility task queue workers VisibilityProcessorSchedulerWorkerCount (default 512)
761 > // Otherwise, visibility queue processors won't be able to fill up bulk with documents (even under heavy load) and bulk will flush due to interval, not number of actions.
762 > ESProcessorBulkActions: dynamicconfig.WorkerESProcessorBulkActions.Get(dc),
763 > // 16MB - just a sanity check. With ES document size ~1Kb it should never be reached.
764 > ESProcessorBulkSize: dynamicconfig.WorkerESProcessorBulkSize.Get(dc),
765 > // Bulk processor will flush every this interval regardless of last flush due to bulk actions.
766 > ESProcessorFlushInterval: dynamicconfig.WorkerESProcessorFlushInterval.Get(dc),
767 > ESProcessorAckTimeout: dynamicconfig.WorkerESProcessorAckTimeout.Get(dc),
768 >
769 > EnableCrossNamespaceCommands: dynamicconfig.EnableCrossNamespaceCommands.Get(dc),
770 > EnableActivityEagerExecution: dynamicconfig.EnableActivityEagerExecution.Get(dc),
771 > EnableActivityRetryStampIncrement: dynamicconfig.EnableActivityRetryStampIncrement.Get(dc),
772 > EnableCancelActivityWorkerCommand: dynamicconfig.EnableCancelActivityWorkerCommand.Get(dc),
773 > EnableEagerWorkflowStart: dynamicconfig.EnableEagerWorkflowStart.Get(dc),
774 > NamespaceCacheRefreshInterval: dynamicconfig.NamespaceCacheRefreshInterval.Get(dc),
775 >
776 > // Archival related
777 > ArchivalTaskBatchSize: dynamicconfig.ArchivalTaskBatchSize.Get(dc),
778 > ArchivalProcessorMaxPollRPS: dynamicconfig.ArchivalProcessorMaxPollRPS.Get(dc),
779 > ArchivalProcessorMaxPollHostRPS: dynamicconfig.ArchivalProcessorMaxPollHostRPS.Get(dc),
780 > ArchivalProcessorSchedulerWorkerCount: dynamicconfig.ArchivalProcessorSchedulerWorkerCount.Subscribe(dc),
781 > ArchivalProcessorMaxPollInterval: dynamicconfig.ArchivalProcessorMaxPollInterval.Get(dc),
782 > ArchivalProcessorMaxPollIntervalJitterCoefficient: dynamicconfig.ArchivalProcessorMaxPollIntervalJitterCoefficient.Get(dc),
783 > ArchivalProcessorUpdateAckInterval: dynamicconfig.ArchivalProcessorUpdateAckInterval.Get(dc),
784 > ArchivalProcessorUpdateAckIntervalJitterCoefficient: dynamicconfig.ArchivalProcessorUpdateAckIntervalJitterCoefficient.Get(dc),
785 > ArchivalProcessorPollBackoffInterval: dynamicconfig.ArchivalProcessorPollBackoffInterval.Get(dc),
786 > ArchivalProcessorArchiveDelay: dynamicconfig.ArchivalProcessorArchiveDelay.Get(dc),
787 > ArchivalBackendMaxRPS: dynamicconfig.ArchivalBackendMaxRPS.Get(dc),
788 > ArchivalQueueMaxReaderCount: dynamicconfig.ArchivalQueueMaxReaderCount.Get(dc),
789 >
790 > // workflow update related
791 > WorkflowExecutionMaxInFlightUpdates: dynamicconfig.WorkflowExecutionMaxInFlightUpdates.Get(dc),
792 > WorkflowExecutionMaxInFlightUpdatePayloads: dynamicconfig.WorkflowExecutionMaxInFlightUpdatePayloads.Get(dc),
793 > WorkflowExecutionMaxTotalUpdates: dynamicconfig.WorkflowExecutionMaxTotalUpdates.Get(dc),
794 > WorkflowExecutionMaxTotalUpdatesSuggestContinueAsNewThreshold: dynamicconfig.WorkflowExecutionMaxTotalUpdatesSuggestContinueAsNewThreshold.Get(dc),
795 > EnableUpdateWithStartRetryOnClosedWorkflowAbort: dynamicconfig.EnableUpdateWithStartRetryOnClosedWorkflowAbort.Get(dc),
796 > EnableUpdateWithStartRetryableErrorOnClosedWorkflowAbort: dynamicconfig.EnableUpdateWithStartRetryableErrorOnClosedWorkflowAbort.Get(dc),
797 >
798 > SendRawHistoryBetweenInternalServices: dynamicconfig.SendRawHistoryBetweenInternalServices.Get(dc),
799 > SendRawHistoryBytesToMatchingService: dynamicconfig.SendRawHistoryBytesToMatchingService.Get(dc),
800 > SendRawWorkflowHistory: dynamicconfig.SendRawWorkflowHistory.Get(dc),
801 > WorkflowIdReuseMinimalInterval: dynamicconfig.WorkflowIdReuseMinimalInterval.Get(dc),
802 > EnableWorkflowIdReuseStartTimeValidation: dynamicconfig.EnableWorkflowIdReuseStartTimeValidation.Get(dc),
803 > BusinessIDReuseRate: dynamicconfig.BusinessIDReuseRate.Get(dc),
804 > BusinessIDReuseBurstRatio: dynamicconfig.BusinessIDReuseBurstRatio.Get(dc),
805 > BusinessIDReuseLimiterCacheSize: dynamicconfig.BusinessIDReuseLimiterCacheSize.Get(dc),
806 > BusinessIDReuseLimiterCacheTTL: dynamicconfig.BusinessIDReuseLimiterCacheTTL.Get(dc),
807 >
808 > HealthPersistenceLatencyFailure: dynamicconfig.HealthPersistenceLatencyFailure.Get(dc),
809 > HealthPersistenceLatencyPercentiles: dynamicconfig.PersistenceHealthSignalPercentileLatencySettings.Get(dc),
810 > HealthPersistenceErrorRatio: dynamicconfig.HealthPersistenceErrorRatio.Get(dc),
811 > HealthRPCLatencyFailure: dynamicconfig.HealthRPCLatencyFailure.Get(dc),
812 > HealthRPCLatencyPercentiles: dynamicconfig.HistoryHealthSignalPercentileLatencySettings.Get(dc),
813 > HealthRPCErrorRatio: dynamicconfig.HealthRPCErrorRatio.Get(dc),
814 > HealthHistoryInitializationTime: dynamicconfig.HealthHistoryInitializationTime.Get(dc),
815 >
816 > BreakdownMetricsByTaskQueue: dynamicconfig.MetricsBreakdownByTaskQueue.Get(dc),
817 >
818 > LogAllReqErrors: dynamicconfig.LogAllReqErrors.Get(dc),
819 >
820 > NumConsecutiveWorkflowTaskProblemsToTriggerSearchAttribute: dynamicconfig.NumConsecutiveWorkflowTaskProblemsToTriggerSearchAttribute.Get(dc),
821 >
822 > // Worker-Versioning related
823 > UseRevisionNumberForWorkerVersioning: dynamicconfig.UseRevisionNumberForWorkerVersioning.Get(dc),
824 > EnableSuggestCaNOnNewTargetVersion: dynamicconfig.EnableSuggestCaNOnNewTargetVersion.Get(dc),
825 > EnableSendTargetVersionChanged: dynamicconfig.EnableSendTargetVersionChanged.Get(dc),
826 > VersionMembershipCacheTTL: dynamicconfig.VersionMembershipCacheTTL.Get(dc),
827 > VersionMembershipCacheMaxSize: dynamicconfig.VersionMembershipCacheMaxSize.Get(dc),
828 > EnableVersionReactivationSignals: dynamicconfig.EnableVersionReactivationSignals.Get(dc),
829 > RoutingInfoCacheTTL: dynamicconfig.RoutingInfoCacheTTL.Get(dc),
830 > RoutingInfoCacheMaxSize: dynamicconfig.RoutingInfoCacheMaxSize.Get(dc),
831 >
832 > // Workflow task completion pagination
833 > EnableWorkflowTaskCompletionPagination: dynamicconfig.EnableWorkflowTaskCompletionPagination.Get(dc),
834 > WorkflowTaskCompletionBufferSizeLimit: dynamicconfig.WorkflowTaskCompletionBufferSizeLimit.Get(dc),
835 > }
836 >
837 > return cfg
838 > }
839
840 // GetShardID return the corresponding shard ID for a given namespaceID and workflowID pair
go.temporal.io/server/common/dynamicconfig/setting_gen.go 292 covered LOC · 68 ranges

Open complete file

26 type GlobalBoolConstrainedDefaultSetting = GlobalTypedConstrainedDefaultSetting[bool]
27
28 > func NewGlobalBoolSetting(key string, def bool, description string) GlobalBoolSetting { setting_gen.go
29 > return NewGlobalTypedSettingWithConverter[bool](key, convertBool, def, description)
30 > }
31
32 func NewGlobalBoolSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[bool], description string) GlobalBoolConstrainedDefaultSetting {
36 type BoolPropertyFn = TypedPropertyFn[bool]
37
38 > func GetBoolPropertyFn(value bool) BoolPropertyFn { setting_gen.go
39 > return GetTypedPropertyFn(value)
40 > }
41
42 type NamespaceBoolSetting = NamespaceTypedSetting[bool]
43 type NamespaceBoolConstrainedDefaultSetting = NamespaceTypedConstrainedDefaultSetting[bool]
44
45 > func NewNamespaceBoolSetting(key string, def bool, description string) NamespaceBoolSetting { setting_gen.go
46 > return NewNamespaceTypedSettingWithConverter[bool](key, convertBool, def, description)
47 > }
48
49 func NewNamespaceBoolSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[bool], description string) NamespaceBoolConstrainedDefaultSetting {
53 type BoolPropertyFnWithNamespaceFilter = TypedPropertyFnWithNamespaceFilter[bool]
54
55 > func GetBoolPropertyFnFilteredByNamespace(value bool) BoolPropertyFnWithNamespaceFilter { setting_gen.go
56 > return GetTypedPropertyFnFilteredByNamespace(value)
57 > }
58
59 type NamespaceIDBoolSetting = NamespaceIDTypedSetting[bool]
60 type NamespaceIDBoolConstrainedDefaultSetting = NamespaceIDTypedConstrainedDefaultSetting[bool]
61
62 > func NewNamespaceIDBoolSetting(key string, def bool, description string) NamespaceIDBoolSetting { setting_gen.go
63 > return NewNamespaceIDTypedSettingWithConverter[bool](key, convertBool, def, description)
64 > }
65
66 func NewNamespaceIDBoolSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[bool], description string) NamespaceIDBoolConstrainedDefaultSetting {
77 type TaskQueueBoolConstrainedDefaultSetting = TaskQueueTypedConstrainedDefaultSetting[bool]
78
79 > func NewTaskQueueBoolSetting(key string, def bool, description string) TaskQueueBoolSetting { setting_gen.go
80 > return NewTaskQueueTypedSettingWithConverter[bool](key, convertBool, def, description)
81 > }
82
83 func NewTaskQueueBoolSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[bool], description string) TaskQueueBoolConstrainedDefaultSetting {
128 type DestinationBoolConstrainedDefaultSetting = DestinationTypedConstrainedDefaultSetting[bool]
129
130 > func NewDestinationBoolSetting(key string, def bool, description string) DestinationBoolSetting { setting_gen.go
131 > return NewDestinationTypedSettingWithConverter[bool](key, convertBool, def, description)
132 > }
133
134 func NewDestinationBoolSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[bool], description string) DestinationBoolConstrainedDefaultSetting {
162 type GlobalIntConstrainedDefaultSetting = GlobalTypedConstrainedDefaultSetting[int]
163
164 > func NewGlobalIntSetting(key string, def int, description string) GlobalIntSetting { setting_gen.go
165 > return NewGlobalTypedSettingWithConverter[int](key, convertInt, def, description)
166 > }
167
168 func NewGlobalIntSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[int], description string) GlobalIntConstrainedDefaultSetting {
179 type NamespaceIntConstrainedDefaultSetting = NamespaceTypedConstrainedDefaultSetting[int]
180
181 > func NewNamespaceIntSetting(key string, def int, description string) NamespaceIntSetting { setting_gen.go
182 > return NewNamespaceTypedSettingWithConverter[int](key, convertInt, def, description)
183 > }
184
185 func NewNamespaceIntSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[int], description string) NamespaceIntConstrainedDefaultSetting {
189 type IntPropertyFnWithNamespaceFilter = TypedPropertyFnWithNamespaceFilter[int]
190
191 > func GetIntPropertyFnFilteredByNamespace(value int) IntPropertyFnWithNamespaceFilter { setting_gen.go
192 > return GetTypedPropertyFnFilteredByNamespace(value)
193 > }
194
195 type NamespaceIDIntSetting = NamespaceIDTypedSetting[int]
213 type TaskQueueIntConstrainedDefaultSetting = TaskQueueTypedConstrainedDefaultSetting[int]
214
215 > func NewTaskQueueIntSetting(key string, def int, description string) TaskQueueIntSetting { setting_gen.go
216 > return NewTaskQueueTypedSettingWithConverter[int](key, convertInt, def, description)
217 > }
218
219 > func NewTaskQueueIntSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[int], description string) TaskQueueIntConstrainedDefaultSetting { setting_gen.go
220 > return NewTaskQueueTypedSettingWithConstrainedDefault[int](key, convertInt, cdef, description)
221 > }
222
223 type IntPropertyFnWithTaskQueueFilter = TypedPropertyFnWithTaskQueueFilter[int]
230 type ShardIDIntConstrainedDefaultSetting = ShardIDTypedConstrainedDefaultSetting[int]
231
232 > func NewShardIDIntSetting(key string, def int, description string) ShardIDIntSetting { setting_gen.go
233 > return NewShardIDTypedSettingWithConverter[int](key, convertInt, def, description)
234 > }
235
236 func NewShardIDIntSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[int], description string) ShardIDIntConstrainedDefaultSetting {
264 type DestinationIntConstrainedDefaultSetting = DestinationTypedConstrainedDefaultSetting[int]
265
266 > func NewDestinationIntSetting(key string, def int, description string) DestinationIntSetting { setting_gen.go
267 > return NewDestinationTypedSettingWithConverter[int](key, convertInt, def, description)
268 > }
269
270 func NewDestinationIntSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[int], description string) DestinationIntConstrainedDefaultSetting {
298 type GlobalFloatConstrainedDefaultSetting = GlobalTypedConstrainedDefaultSetting[float64]
299
300 > func NewGlobalFloatSetting(key string, def float64, description string) GlobalFloatSetting { setting_gen.go
301 > return NewGlobalTypedSettingWithConverter[float64](key, convertFloat, def, description)
302 > }
303
304 func NewGlobalFloatSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[float64], description string) GlobalFloatConstrainedDefaultSetting {
315 type NamespaceFloatConstrainedDefaultSetting = NamespaceTypedConstrainedDefaultSetting[float64]
316
317 > func NewNamespaceFloatSetting(key string, def float64, description string) NamespaceFloatSetting { setting_gen.go
318 > return NewNamespaceTypedSettingWithConverter[float64](key, convertFloat, def, description)
319 > }
320
321 func NewNamespaceFloatSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[float64], description string) NamespaceFloatConstrainedDefaultSetting {
349 type TaskQueueFloatConstrainedDefaultSetting = TaskQueueTypedConstrainedDefaultSetting[float64]
350
351 > func NewTaskQueueFloatSetting(key string, def float64, description string) TaskQueueFloatSetting { setting_gen.go
352 > return NewTaskQueueTypedSettingWithConverter[float64](key, convertFloat, def, description)
353 > }
354
355 func NewTaskQueueFloatSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[float64], description string) TaskQueueFloatConstrainedDefaultSetting {
366 type ShardIDFloatConstrainedDefaultSetting = ShardIDTypedConstrainedDefaultSetting[float64]
367
368 > func NewShardIDFloatSetting(key string, def float64, description string) ShardIDFloatSetting { setting_gen.go
369 > return NewShardIDTypedSettingWithConverter[float64](key, convertFloat, def, description)
370 > }
371
372 func NewShardIDFloatSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[float64], description string) ShardIDFloatConstrainedDefaultSetting {
400 type DestinationFloatConstrainedDefaultSetting = DestinationTypedConstrainedDefaultSetting[float64]
401
402 > func NewDestinationFloatSetting(key string, def float64, description string) DestinationFloatSetting { setting_gen.go
403 > return NewDestinationTypedSettingWithConverter[float64](key, convertFloat, def, description)
404 > }
405
406 func NewDestinationFloatSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[float64], description string) DestinationFloatConstrainedDefaultSetting {
434 type GlobalStringConstrainedDefaultSetting = GlobalTypedConstrainedDefaultSetting[string]
435
436 > func NewGlobalStringSetting(key string, def string, description string) GlobalStringSetting { setting_gen.go
437 > return NewGlobalTypedSettingWithConverter[string](key, convertString, def, description)
438 > }
439
440 func NewGlobalStringSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[string], description string) GlobalStringConstrainedDefaultSetting {
570 type GlobalDurationConstrainedDefaultSetting = GlobalTypedConstrainedDefaultSetting[time.Duration]
571
572 > func NewGlobalDurationSetting(key string, def time.Duration, description string) GlobalDurationSetting { setting_gen.go
573 > return NewGlobalTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
574 > }
575
576 func NewGlobalDurationSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[time.Duration], description string) GlobalDurationConstrainedDefaultSetting {
580 type DurationPropertyFn = TypedPropertyFn[time.Duration]
581
582 > func GetDurationPropertyFn(value time.Duration) DurationPropertyFn { setting_gen.go
583 > return GetTypedPropertyFn(value)
584 > }
585
586 type NamespaceDurationSetting = NamespaceTypedSetting[time.Duration]
587 type NamespaceDurationConstrainedDefaultSetting = NamespaceTypedConstrainedDefaultSetting[time.Duration]
588
589 > func NewNamespaceDurationSetting(key string, def time.Duration, description string) NamespaceDurationSetting { setting_gen.go
590 > return NewNamespaceTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
591 > }
592
593 func NewNamespaceDurationSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[time.Duration], description string) NamespaceDurationConstrainedDefaultSetting {
604 type NamespaceIDDurationConstrainedDefaultSetting = NamespaceIDTypedConstrainedDefaultSetting[time.Duration]
605
606 > func NewNamespaceIDDurationSetting(key string, def time.Duration, description string) NamespaceIDDurationSetting { setting_gen.go
607 > return NewNamespaceIDTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
608 > }
609
610 func NewNamespaceIDDurationSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[time.Duration], description string) NamespaceIDDurationConstrainedDefaultSetting {
621 type TaskQueueDurationConstrainedDefaultSetting = TaskQueueTypedConstrainedDefaultSetting[time.Duration]
622
623 > func NewTaskQueueDurationSetting(key string, def time.Duration, description string) TaskQueueDurationSetting { setting_gen.go
624 > return NewTaskQueueTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
625 > }
626
627 > func NewTaskQueueDurationSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[time.Duration], description string) TaskQueueDurationConstrainedDefaultSetting { setting_gen.go
628 > return NewTaskQueueTypedSettingWithConstrainedDefault[time.Duration](key, convertDuration, cdef, description)
629 > }
630
631 type DurationPropertyFnWithTaskQueueFilter = TypedPropertyFnWithTaskQueueFilter[time.Duration]
638 type ShardIDDurationConstrainedDefaultSetting = ShardIDTypedConstrainedDefaultSetting[time.Duration]
639
640 > func NewShardIDDurationSetting(key string, def time.Duration, description string) ShardIDDurationSetting { setting_gen.go
641 > return NewShardIDTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
642 > }
643
644 func NewShardIDDurationSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[time.Duration], description string) ShardIDDurationConstrainedDefaultSetting {
655 type TaskTypeDurationConstrainedDefaultSetting = TaskTypeTypedConstrainedDefaultSetting[time.Duration]
656
657 > func NewTaskTypeDurationSetting(key string, def time.Duration, description string) TaskTypeDurationSetting { setting_gen.go
658 > return NewTaskTypeTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
659 > }
660
661 func NewTaskTypeDurationSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[time.Duration], description string) TaskTypeDurationConstrainedDefaultSetting {
672 type DestinationDurationConstrainedDefaultSetting = DestinationTypedConstrainedDefaultSetting[time.Duration]
673
674 > func NewDestinationDurationSetting(key string, def time.Duration, description string) DestinationDurationSetting { setting_gen.go
675 > return NewDestinationTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
676 > }
677
678 func NewDestinationDurationSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[time.Duration], description string) DestinationDurationConstrainedDefaultSetting {
689 type ChasmTaskTypeDurationConstrainedDefaultSetting = ChasmTaskTypeTypedConstrainedDefaultSetting[time.Duration]
690
691 > func NewChasmTaskTypeDurationSetting(key string, def time.Duration, description string) ChasmTaskTypeDurationSetting { setting_gen.go
692 > return NewChasmTaskTypeTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
693 > }
694
695 func NewChasmTaskTypeDurationSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[time.Duration], description string) ChasmTaskTypeDurationConstrainedDefaultSetting {
723 type NamespaceMapConstrainedDefaultSetting = NamespaceTypedConstrainedDefaultSetting[map[string]any]
724
725 > func NewNamespaceMapSetting(key string, def map[string]any, description string) NamespaceMapSetting { setting_gen.go
726 > return NewNamespaceTypedSettingWithConverter[map[string]any](key, convertMap, def, description)
727 > }
728
729 func NewNamespaceMapSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[map[string]any], description string) NamespaceMapConstrainedDefaultSetting {
845 // values. The value from dynamic config will be _merged_ over a deep copy of 'def'. Be very careful
846 // when using non-empty maps or slices as defaults, the result may not be what you want.
847 > func NewGlobalTypedSetting[T any](key string, def T, description string) GlobalTypedSetting[T] { setting_gen.go
848 > // Warn on any shared structure used with ConvertStructure, even though we handle it by deep copying.
849 > warnDefaultSharedStructure(key, def)
850 > // If even deep copy won't even work, we should panic early. Do that by calling deep copy once here.
851 > _ = deepCopyForMapstructure(def)
852 >
853 > s := GlobalTypedSetting[T]{
854 > key: MakeKey(key),
855 > def: def,
856 > convert: ConvertStructure[T](def),
857 > description: description,
858 > }
859 > register(s)
860 > return s
861 > }
862
863 // NewGlobalTypedSettingWithConverter creates a setting with a custom converter function.
864 > func NewGlobalTypedSettingWithConverter[T any](key string, convert func(any) (T, error), def T, description string) GlobalTypedSetting[T] { setting_gen.go
865 > s := GlobalTypedSetting[T]{
866 > key: MakeKey(key),
867 > def: def,
868 > convert: convert,
869 > description: description,
870 > }
871 > register(s)
872 > return s
873 > }
874
875 // NewGlobalTypedSettingWithConstrainedDefault creates a setting with a compound default value.
885 }
886
887 > func (s GlobalTypedSetting[T]) Key() Key { return s.key } setting_gen.go
888 func (s GlobalTypedSetting[T]) Precedence() Precedence { return PrecedenceGlobal }
889 func (s GlobalTypedSetting[T]) Validate(v any) error {
907 type TypedPropertyFn[T any] func() T
908
909 > func (s GlobalTypedSetting[T]) Get(c *Collection) TypedPropertyFn[T] { setting_gen.go
910 > return func() T {
911 > prec := []Constraints{{}} setting_gen.go
912 > return matchAndConvert(
913 > c,
914 > s.key,
915 > s.def,
916 > s.convert,
917 > prec,
918 > )
919 > }
920 }
921
935 type TypedSubscribable[T any] func(callback func(T)) (v T, cancel func())
936
937 > func (s GlobalTypedSetting[T]) Subscribe(c *Collection) TypedSubscribable[T] { setting_gen.go
938 > return func(callback func(T)) (T, func()) {
939 prec := []Constraints{{}}
940 return subscribe(c, s.key, s.def, s.convert, prec, callback)
969 }
970
971 > func GetTypedPropertyFn[T any](value T) TypedPropertyFn[T] { setting_gen.go
972 > return func() T {
973 > return value setting_gen.go
974 > }
975 }
976
981 // values. The value from dynamic config will be _merged_ over a deep copy of 'def'. Be very careful
982 // when using non-empty maps or slices as defaults, the result may not be what you want.
983 > func NewNamespaceTypedSetting[T any](key string, def T, description string) NamespaceTypedSetting[T] { setting_gen.go
984 > // Warn on any shared structure used with ConvertStructure, even though we handle it by deep copying.
985 > warnDefaultSharedStructure(key, def)
986 > // If even deep copy won't even work, we should panic early. Do that by calling deep copy once here.
987 > _ = deepCopyForMapstructure(def)
988 >
989 > s := NamespaceTypedSetting[T]{
990 > key: MakeKey(key),
991 > def: def,
992 > convert: ConvertStructure[T](def),
993 > description: description,
994 > }
995 > register(s)
996 > return s
997 > }
998
999 // NewNamespaceTypedSettingWithConverter creates a setting with a custom converter function.
1000 > func NewNamespaceTypedSettingWithConverter[T any](key string, convert func(any) (T, error), def T, description string) NamespaceTypedSetting[T] { setting_gen.go
1001 > s := NamespaceTypedSetting[T]{
1002 > key: MakeKey(key),
1003 > def: def,
1004 > convert: convert,
1005 > description: description,
1006 > }
1007 > register(s)
1008 > return s
1009 > }
1010
1011 // NewNamespaceTypedSettingWithConstrainedDefault creates a setting with a compound default value.
1021 }
1022
1023 > func (s NamespaceTypedSetting[T]) Key() Key { return s.key } setting_gen.go
1024 func (s NamespaceTypedSetting[T]) Precedence() Precedence { return PrecedenceNamespace }
1025 func (s NamespaceTypedSetting[T]) Validate(v any) error {
1035 }
1036
1037 > func (s NamespaceTypedSetting[T]) WithDefault(v T) NamespaceTypedSetting[T] { setting_gen.go
1038 > newS := s
1039 > newS.def = v
1040 > return newS
1041 > }
1042
1043 type TypedPropertyFnWithNamespaceFilter[T any] func(namespace string) T
1044
1045 > func (s NamespaceTypedSetting[T]) Get(c *Collection) TypedPropertyFnWithNamespaceFilter[T] { setting_gen.go
1046 > return func(namespace string) T {
1047 prec := []Constraints{{Namespace: namespace}, {}}
1048 return matchAndConvert(
1105 }
1106
1107 > func GetTypedPropertyFnFilteredByNamespace[T any](value T) TypedPropertyFnWithNamespaceFilter[T] { setting_gen.go
1108 > return func(namespace string) T {
1109 return value
1110 }
1134
1135 // NewNamespaceIDTypedSettingWithConverter creates a setting with a custom converter function.
1136 > func NewNamespaceIDTypedSettingWithConverter[T any](key string, convert func(any) (T, error), def T, description string) NamespaceIDTypedSetting[T] { setting_gen.go
1137 > s := NamespaceIDTypedSetting[T]{
1138 > key: MakeKey(key),
1139 > def: def,
1140 > convert: convert,
1141 > description: description,
1142 > }
1143 > register(s)
1144 > return s
1145 > }
1146
1147 // NewNamespaceIDTypedSettingWithConstrainedDefault creates a setting with a compound default value.
1157 }
1158
1159 > func (s NamespaceIDTypedSetting[T]) Key() Key { return s.key } setting_gen.go
1160 func (s NamespaceIDTypedSetting[T]) Precedence() Precedence { return PrecedenceNamespaceID }
1161 func (s NamespaceIDTypedSetting[T]) Validate(v any) error {
1179 type TypedPropertyFnWithNamespaceIDFilter[T any] func(namespaceID namespace.ID) T
1180
1181 > func (s NamespaceIDTypedSetting[T]) Get(c *Collection) TypedPropertyFnWithNamespaceIDFilter[T] { setting_gen.go
1182 > return func(namespaceID namespace.ID) T {
1183 prec := []Constraints{{NamespaceID: namespaceID.String()}, {}}
1184 return matchAndConvert(
1253 // values. The value from dynamic config will be _merged_ over a deep copy of 'def'. Be very careful
1254 // when using non-empty maps or slices as defaults, the result may not be what you want.
1255 > func NewTaskQueueTypedSetting[T any](key string, def T, description string) TaskQueueTypedSetting[T] { setting_gen.go
1256 > // Warn on any shared structure used with ConvertStructure, even though we handle it by deep copying.
1257 > warnDefaultSharedStructure(key, def)
1258 > // If even deep copy won't even work, we should panic early. Do that by calling deep copy once here.
1259 > _ = deepCopyForMapstructure(def)
1260 >
1261 > s := TaskQueueTypedSetting[T]{
1262 > key: MakeKey(key),
1263 > def: def,
1264 > convert: ConvertStructure[T](def),
1265 > description: description,
1266 > }
1267 > register(s)
1268 > return s
1269 > }
1270
1271 // NewTaskQueueTypedSettingWithConverter creates a setting with a custom converter function.
1272 > func NewTaskQueueTypedSettingWithConverter[T any](key string, convert func(any) (T, error), def T, description string) TaskQueueTypedSetting[T] { setting_gen.go
1273 > s := TaskQueueTypedSetting[T]{
1274 > key: MakeKey(key),
1275 > def: def,
1276 > convert: convert,
1277 > description: description,
1278 > }
1279 > register(s)
1280 > return s
1281 > }
1282
1283 // NewTaskQueueTypedSettingWithConstrainedDefault creates a setting with a compound default value.
1284 > func NewTaskQueueTypedSettingWithConstrainedDefault[T any](key string, convert func(any) (T, error), cdef []TypedConstrainedValue[T], description string) TaskQueueTypedConstrainedDefaultSetting[T] { setting_gen.go
1285 > s := TaskQueueTypedConstrainedDefaultSetting[T]{
1286 > key: MakeKey(key),
1287 > cdef: cdef,
1288 > convert: convert,
1289 > description: description,
1290 > }
1291 > register(s)
1292 > return s
1293 > }
1294
1295 > func (s TaskQueueTypedSetting[T]) Key() Key { return s.key } setting_gen.go
1296 func (s TaskQueueTypedSetting[T]) Precedence() Precedence { return PrecedenceTaskQueue }
1297 func (s TaskQueueTypedSetting[T]) Validate(v any) error {
1300 }
1301
1302 > func (s TaskQueueTypedConstrainedDefaultSetting[T]) Key() Key { return s.key } setting_gen.go
1303 func (s TaskQueueTypedConstrainedDefaultSetting[T]) Precedence() Precedence { return PrecedenceTaskQueue }
1304 func (s TaskQueueTypedConstrainedDefaultSetting[T]) Validate(v any) error {
1315 type TypedPropertyFnWithTaskQueueFilter[T any] func(namespace string, taskQueue string, taskQueueType enumspb.TaskQueueType) T
1316
1317 > func (s TaskQueueTypedSetting[T]) Get(c *Collection) TypedPropertyFnWithTaskQueueFilter[T] { setting_gen.go
1318 > return func(namespace string, taskQueue string, taskQueueType enumspb.TaskQueueType) T {
1319 prec := []Constraints{
1320 {Namespace: namespace, TaskQueueName: taskQueue, TaskQueueType: taskQueueType},
1430
1431 // NewShardIDTypedSettingWithConverter creates a setting with a custom converter function.
1432 > func NewShardIDTypedSettingWithConverter[T any](key string, convert func(any) (T, error), def T, description string) ShardIDTypedSetting[T] { setting_gen.go
1433 > s := ShardIDTypedSetting[T]{
1434 > key: MakeKey(key),
1435 > def: def,
1436 > convert: convert,
1437 > description: description,
1438 > }
1439 > register(s)
1440 > return s
1441 > }
1442
1443 // NewShardIDTypedSettingWithConstrainedDefault creates a setting with a compound default value.
1453 }
1454
1455 > func (s ShardIDTypedSetting[T]) Key() Key { return s.key } setting_gen.go
1456 func (s ShardIDTypedSetting[T]) Precedence() Precedence { return PrecedenceShardID }
1457 func (s ShardIDTypedSetting[T]) Validate(v any) error {
1475 type TypedPropertyFnWithShardIDFilter[T any] func(shardID int32) T
1476
1477 > func (s ShardIDTypedSetting[T]) Get(c *Collection) TypedPropertyFnWithShardIDFilter[T] { setting_gen.go
1478 > return func(shardID int32) T {
1479 prec := []Constraints{{ShardID: shardID}, {}}
1480 return matchAndConvert(
1566
1567 // NewTaskTypeTypedSettingWithConverter creates a setting with a custom converter function.
1568 > func NewTaskTypeTypedSettingWithConverter[T any](key string, convert func(any) (T, error), def T, description string) TaskTypeTypedSetting[T] { setting_gen.go
1569 > s := TaskTypeTypedSetting[T]{
1570 > key: MakeKey(key),
1571 > def: def,
1572 > convert: convert,
1573 > description: description,
1574 > }
1575 > register(s)
1576 > return s
1577 > }
1578
1579 // NewTaskTypeTypedSettingWithConstrainedDefault creates a setting with a compound default value.
1589 }
1590
1591 > func (s TaskTypeTypedSetting[T]) Key() Key { return s.key } setting_gen.go
1592 func (s TaskTypeTypedSetting[T]) Precedence() Precedence { return PrecedenceTaskType }
1593 func (s TaskTypeTypedSetting[T]) Validate(v any) error {
1611 type TypedPropertyFnWithTaskTypeFilter[T any] func(taskType enumsspb.TaskType) T
1612
1613 > func (s TaskTypeTypedSetting[T]) Get(c *Collection) TypedPropertyFnWithTaskTypeFilter[T] { setting_gen.go
1614 > return func(taskType enumsspb.TaskType) T {
1615 prec := []Constraints{{TaskType: taskType}, {}}
1616 return matchAndConvert(
1685 // values. The value from dynamic config will be _merged_ over a deep copy of 'def'. Be very careful
1686 // when using non-empty maps or slices as defaults, the result may not be what you want.
1687 > func NewDestinationTypedSetting[T any](key string, def T, description string) DestinationTypedSetting[T] { setting_gen.go
1688 > // Warn on any shared structure used with ConvertStructure, even though we handle it by deep copying.
1689 > warnDefaultSharedStructure(key, def)
1690 > // If even deep copy won't even work, we should panic early. Do that by calling deep copy once here.
1691 > _ = deepCopyForMapstructure(def)
1692 >
1693 > s := DestinationTypedSetting[T]{
1694 > key: MakeKey(key),
1695 > def: def,
1696 > convert: ConvertStructure[T](def),
1697 > description: description,
1698 > }
1699 > register(s)
1700 > return s
1701 > }
1702
1703 // NewDestinationTypedSettingWithConverter creates a setting with a custom converter function.
1704 > func NewDestinationTypedSettingWithConverter[T any](key string, convert func(any) (T, error), def T, description string) DestinationTypedSetting[T] { setting_gen.go
1705 > s := DestinationTypedSetting[T]{
1706 > key: MakeKey(key),
1707 > def: def,
1708 > convert: convert,
1709 > description: description,
1710 > }
1711 > register(s)
1712 > return s
1713 > }
1714
1715 // NewDestinationTypedSettingWithConstrainedDefault creates a setting with a compound default value.
1725 }
1726
1727 > func (s DestinationTypedSetting[T]) Key() Key { return s.key } setting_gen.go
1728 func (s DestinationTypedSetting[T]) Precedence() Precedence { return PrecedenceDestination }
1729 func (s DestinationTypedSetting[T]) Validate(v any) error {
1747 type TypedPropertyFnWithDestinationFilter[T any] func(namespace string, destination string) T
1748
1749 > func (s DestinationTypedSetting[T]) Get(c *Collection) TypedPropertyFnWithDestinationFilter[T] { setting_gen.go
1750 > return func(namespace string, destination string) T {
1751 prec := []Constraints{
1752 {Namespace: namespace, Destination: destination},
1785 type TypedSubscribableWithDestinationFilter[T any] func(namespace string, destination string, callback func(T)) (v T, cancel func())
1786
1787 > func (s DestinationTypedSetting[T]) Subscribe(c *Collection) TypedSubscribableWithDestinationFilter[T] { setting_gen.go
1788 > return func(namespace string, destination string, callback func(T)) (T, func()) {
1789 prec := []Constraints{
1790 {Namespace: namespace, Destination: destination},
1858
1859 // NewChasmTaskTypeTypedSettingWithConverter creates a setting with a custom converter function.
1860 > func NewChasmTaskTypeTypedSettingWithConverter[T any](key string, convert func(any) (T, error), def T, description string) ChasmTaskTypeTypedSetting[T] { setting_gen.go
1861 > s := ChasmTaskTypeTypedSetting[T]{
1862 > key: MakeKey(key),
1863 > def: def,
1864 > convert: convert,
1865 > description: description,
1866 > }
1867 > register(s)
1868 > return s
1869 > }
1870
1871 // NewChasmTaskTypeTypedSettingWithConstrainedDefault creates a setting with a compound default value.
1881 }
1882
1883 > func (s ChasmTaskTypeTypedSetting[T]) Key() Key { return s.key } setting_gen.go
1884 func (s ChasmTaskTypeTypedSetting[T]) Precedence() Precedence { return PrecedenceChasmTaskType }
1885 func (s ChasmTaskTypeTypedSetting[T]) Validate(v any) error {
1903 type TypedPropertyFnWithChasmTaskTypeFilter[T any] func(chasmTaskType string) T
1904
1905 > func (s ChasmTaskTypeTypedSetting[T]) Get(c *Collection) TypedPropertyFnWithChasmTaskTypeFilter[T] { setting_gen.go
1906 > return func(chasmTaskType string) T {
1907 prec := []Constraints{{ChasmTaskType: chasmTaskType}, {}}
1908 return matchAndConvert(
go.temporal.io/server/service/history/shard/controller_impl.go 240 covered LOC · 63 ranges

Open complete file

75 hostInfoProvider membership.HostInfoProvider,
76 contextFactory ContextFactory,
77 > ) *ControllerImpl { controller_impl.go
78 > hostIdentity := hostInfoProvider.HostInfo().Identity()
79 > contextTaggedLogger := log.With(logger, tag.ComponentShardController, tag.Address(hostIdentity))
80 > taggedMetricsHandler := metricsHandler.WithTags(metrics.OperationTag(metrics.HistoryShardControllerScope))
81 >
82 > ownership := newOwnership(
83 > config,
84 > historyServiceResolver,
85 > hostInfoProvider,
86 > contextTaggedLogger,
87 > taggedMetricsHandler,
88 > )
89 >
90 > c := &ControllerImpl{
91 > config: config,
92 > contextFactory: contextFactory,
93 > contextTaggedLogger: contextTaggedLogger,
94 > historyShards: make(map[int32]historyi.ControllableContext),
95 > hostInfoProvider: hostInfoProvider,
96 > ownership: ownership,
97 > taggedMetricsHandler: taggedMetricsHandler,
98 > shardCountSubscriptions: map[*shardCountSubscription]struct{}{},
99 > initialShardsAcquired: future.NewFuture[struct{}](),
100 > }
101 > c.lingerState.shards = make(map[historyi.ControllableContext]struct{})
102 > return c
103 > }
104
105 func (c *ControllerImpl) Start() {
178 func (c *ControllerImpl) GetShardByID(
179 shardID int32,
180 > ) (historyi.ShardContext, error) { controller_impl.go
181 > startTime := time.Now().UTC()
182 > defer func() {
183 > metrics.GetEngineForShardLatency.With(c.taggedMetricsHandler).Record(time.Since(startTime))
184 > }()
185
186 > return c.getOrCreateShardContext(shardID) controller_impl.go
187 }
188
201 }
202
203 > func (c *ControllerImpl) ShardIDs() []int32 { controller_impl.go
204 > c.RLock()
205 > defer c.RUnlock()
206 >
207 > ids := make([]int32, 0, len(c.historyShards))
208 > for id := range c.historyShards {
209 > ids = append(ids, id) controller_impl.go
210 > }
211 > return ids controller_impl.go
212 }
213
214 > func (c *ControllerImpl) shardRemoveAndStop(shard historyi.ControllableContext) { controller_impl.go
215 > startTime := time.Now().UTC()
216 > defer func() {
217 > metrics.RemoveEngineForShardLatency.With(c.taggedMetricsHandler).Record(time.Since(startTime))
218 > }()
219
220 > metrics.ShardContextClosedCounter.With(c.taggedMetricsHandler).Record(1) controller_impl.go
221 > _ = c.removeShard(shard.GetShardID(), shard)
222 >
223 > // Whether shard was in the shards map or not, in both cases we should stop it.
224 > shard.FinishStop()
225 }
226
228 // if necessary. If a shard context is created, it will initialize in the background.
229 // This function won't block on rangeid lease acquisition.
230 > func (c *ControllerImpl) getOrCreateShardContext(shardID int32) (historyi.ControllableContext, error) { controller_impl.go
231 > if err := c.validateShardId(shardID); err != nil {
232 return nil, err
233 }
234 > c.RLock() controller_impl.go
235 > if shard, ok := c.historyShards[shardID]; ok {
236 > if shard.IsValid() { controller_impl.go
237 > c.RUnlock()
238 > return shard, nil
239 > }
240 // if shard not valid then proceed to create a new one
241 }
242 > c.RUnlock() controller_impl.go
243 >
244 > c.Lock()
245 > defer c.Unlock()
246 >
247 > // Check again with exclusive lock
248 > if shard, ok := c.historyShards[shardID]; ok {
249 if shard.IsValid() {
250 return shard, nil
256 }
257
258 > if err := c.ownership.verifyOwnership(shardID); err != nil { controller_impl.go
259 return nil, err
260 }
261
262 > if atomic.LoadInt32(&c.status) == common.DaemonStatusStopped { controller_impl.go
263 hostInfo := c.hostInfoProvider.HostInfo()
264 return nil, fmt.Errorf("ControllerImpl for host '%v' shutting down", hostInfo.Identity())
265 }
266
267 > shard, err := c.contextFactory.CreateContext(shardID, c.shardRemoveAndStop) controller_impl.go
268 > if err != nil {
269 return nil, err
270 }
271 > c.historyShards[shardID] = shard controller_impl.go
272 > metrics.ShardContextCreatedCounter.With(c.taggedMetricsHandler).Record(1)
273 > c.contextTaggedLogger.Info("", numShardsTag(len(c.historyShards)))
274 >
275 > return shard, nil
276 }
277
278 > func (c *ControllerImpl) removeShard(shardID int32, expected historyi.ControllableContext) historyi.ControllableContext { controller_impl.go
279 > c.Lock()
280 > defer c.Unlock()
281 > return c.removeShardLocked(shardID, expected)
282 > }
283
284 > func (c *ControllerImpl) removeShardLocked(shardID int32, expected historyi.ControllableContext) historyi.ControllableContext { controller_impl.go
285 > current, ok := c.historyShards[shardID]
286 > if !ok {
287 return nil
288 }
289 > if expected != nil && current != expected { controller_impl.go
290 // the shard comparison is a defensive check to make sure we are deleting
291 // what we intend to delete.
293 }
294
295 > delete(c.historyShards, shardID) controller_impl.go
296 > c.contextTaggedLogger.Info("", numShardsTag(len(c.historyShards)))
297 > metrics.ShardContextRemovedCounter.With(c.taggedMetricsHandler).Record(1)
298 >
299 > return current
300 }
301
306 // history instance can continue to process requests for the shard until the
307 // new owner actually acquires the shard.
308 > func (c *ControllerImpl) shardLingerThenClose(ctx context.Context, shardID int32) { controller_impl.go
309 > c.RLock()
310 > shard, ok := c.historyShards[shardID]
311 > c.RUnlock()
312 > if !ok {
313 return
314 }
319 // could be lingering on a shard that this instance should own, but this
320 // instance's acquireShards concurrency slots are filled with lingering shards.
321 > if !c.beginLinger(shard) { controller_impl.go
322 return
323 }
324
325 > go func() { controller_impl.go
326 > defer c.endLinger(shard)
327 > c.doLinger(ctx, shard)
328 > }()
329 }
330
331 > func (c *ControllerImpl) beginLinger(shard historyi.ControllableContext) bool { controller_impl.go
332 > c.lingerState.Lock()
333 > defer c.lingerState.Unlock()
334 > if _, ok := c.lingerState.shards[shard]; ok {
335 return false
336 }
337 > c.lingerState.shards[shard] = struct{}{} controller_impl.go
338 > return true
339 }
340
341 > func (c *ControllerImpl) endLinger(shard historyi.ControllableContext) { controller_impl.go
342 > c.lingerState.Lock()
343 > defer c.lingerState.Unlock()
344 > delete(c.lingerState.shards, shard)
345 > }
346
347 > func (c *ControllerImpl) doLinger(ctx context.Context, shard historyi.ControllableContext) { controller_impl.go
348 > startTime := time.Now()
349 > // Enforce a max limit to ensure we close the shard in a reasonable time,
350 > // and to indirectly limit the number of lingering shards.
351 > timeLimit := min(c.config.ShardLingerTimeLimit(), shardLingerMaxTimeLimit)
352 > ctx, cancel := context.WithTimeout(ctx, timeLimit)
353 > defer cancel()
354 >
355 > qps := c.config.ShardLingerOwnershipCheckQPS()
356 > // The limiter must be configured with burst>=1. With burst=1,
357 > // the first call to Wait() won't be delayed.
358 > limiter := rate.NewLimiter(rate.Limit(qps), 1)
359 >
360 > for {
361 > if !shard.IsValid() {
362 metrics.ShardLingerSuccess.With(c.taggedMetricsHandler).Record(time.Since(startTime))
363 break
364 }
365
366 > if err := limiter.Wait(ctx); err != nil { controller_impl.go
367 > c.contextTaggedLogger.Info("shardLinger: wait timed out", controller_impl.go
368 > tag.ShardID(shard.GetShardID()),
369 > tag.Duration("duration", time.Since(startTime)),
370 > )
371 > metrics.ShardLingerTimeouts.With(c.taggedMetricsHandler).Record(1)
372 > break
373 }
374
375 // If this AssertOwnership or any other request on the shard receives
376 // a shard ownership lost error, the shard will be marked as invalid.
377 > _ = shard.AssertOwnership(ctx) controller_impl.go
378 }
379
380 > c.shardRemoveAndStop(shard) controller_impl.go
381 }
382
383 > func (c *ControllerImpl) acquireShards(ctx context.Context) { controller_impl.go
384 > metrics.AcquireShardsCounter.With(c.taggedMetricsHandler).Record(1)
385 > startTime := time.Now().UTC()
386 > defer func() {
387 > metrics.AcquireShardsLatency.With(c.taggedMetricsHandler).Record(time.Since(startTime))
388 > }()
389
390 > ctx = headers.SetCallerInfo(ctx, headers.SystemBackgroundHighCallerInfo) controller_impl.go
391 >
392 > // Readiness check: if we haven't marked readiness yet, then we need to set up a context to
393 > // run the readiness check on owned shards.
394 > var readinessCtx context.Context
395 > var readinessCancel context.CancelFunc
396 > if !c.initialShardsAcquired.Ready() {
397 > readinessCtx, readinessCancel = context.WithCancel(ctx)
398 > } else {
399 readinessCancel = func() {} // we need a non-nil func for Swap
400 }
401 // Cancel previous readiness check to ensure that the readiness check is always running on
402 // the most recent set of owned shards (e.g. after a membership change).
403 > if prevCancel := c.shardReadinessCancel.Swap(readinessCancel); prevCancel != nil { controller_impl.go
404 > prevCancel.(context.CancelFunc)() controller_impl.go
405 > }
406
407 > var ownedShardsLock sync.Mutex controller_impl.go
408 > var ownedShards []int32 // only populated if we are doing a readiness check
409 >
410 > tryAcquire := func(shardID int32) {
411 > if err := c.ownership.verifyOwnership(shardID); err != nil {
412 > if IsShardOwnershipLostError(err) { controller_impl.go
413 > // current host is not owner of shard, unload it if it is already loaded. controller_impl.go
414 > if c.config.ShardLingerTimeLimit() > 0 {
415 > c.shardLingerThenClose(ctx, shardID) controller_impl.go
416 > } else { controller_impl.go
417 c.CloseShardByID(shardID)
418 }
419 }
420 > return controller_impl.go
421 }
422
423 > if readinessCtx != nil { controller_impl.go
424 > ownedShardsLock.Lock()
425 > ownedShards = append(ownedShards, shardID)
426 > ownedShardsLock.Unlock()
427 > }
428
429 > shard, err := c.GetShardByID(shardID) controller_impl.go
430 > if err != nil {
431 metrics.GetEngineForShardErrorCounter.With(c.taggedMetricsHandler).Record(1)
432 c.contextTaggedLogger.Error("Unable to create history shard context", tag.Error(err), tag.OperationFailed, tag.ShardID(shardID))
436 // Wait up to 1s for the shard to acquire the rangeid lock.
437 // After 1s we will move on but the shard will continue trying in the background.
438 > engineCtx, engineCancel := context.WithTimeout(ctx, 1*time.Second) controller_impl.go
439 > defer engineCancel()
440 > _, _ = shard.GetEngine(engineCtx)
441 }
442
443 > concurrency := int64(max(c.config.AcquireShardConcurrency(), 1)) controller_impl.go
444 > sem := semaphore.NewWeighted(concurrency)
445 > numShards := c.config.NumberOfShards
446 > randomStartOffset := rand.Int31n(numShards)
447 > for index := range numShards {
448 > shardID := (index+randomStartOffset)%numShards + 1
449 > if err := sem.Acquire(ctx, 1); err != nil {
450 break
451 }
452 > go func() { controller_impl.go
453 > defer sem.Release(1)
454 > tryAcquire(shardID)
455 > }()
456 }
457 > _ = sem.Acquire(ctx, concurrency) controller_impl.go
458 >
459 > c.RLock()
460 > // note that this count includes lingering shards
461 > numOfOwnedShards := len(c.historyShards)
462 > c.RUnlock()
463 > metrics.NumShardsGauge.With(c.taggedMetricsHandler).Record(float64(numOfOwnedShards))
464 > c.publishShardCountUpdate(numOfOwnedShards)
465 >
466 > // Readiness check: We should set initialShardsAcquired when:
467 > // 1. It's not already set.
468 > // 2. We should own at least one shard (i.e. not before we join membership).
469 > // 3. We have ownership of all the shards we're supposed to own.
470 > if readinessCtx != nil {
471 > if len(ownedShards) > 0 {
472 > go func() { controller_impl.go
473 > defer readinessCancel()
474 > if c.checkShardReadiness(readinessCtx, ownedShards) {
475 c.initialShardsAcquired.SetIfNotReady(struct{}{}, nil)
476 }
477 }()
478 > } else { controller_impl.go
479 > readinessCancel()
480 > }
481 }
482 }
485 ctx context.Context,
486 shards []int32,
487 > ) bool { controller_impl.go
488 > concurrency := int64(max(c.config.AcquireShardConcurrency(), 1))
489 > sem := semaphore.NewWeighted(concurrency)
490 > var ready atomic.Int32
491 > for _, shardID := range shards {
492 > if sem.Acquire(ctx, 1) != nil {
493 return false
494 }
495 > go func() { controller_impl.go
496 > defer sem.Release(1)
497 > // Note that AssertOwnership uses a detached context for the actual persistence
498 > // op so we can't cancel it. If context is canceled, the final Acquire will
499 > // fail and we won't do anything.
500 > if shard, err := c.GetShardByID(shardID); err != nil {
501 return
502 > } else if _, err := shard.GetEngine(ctx); err != nil { controller_impl.go
503 return
504 > } else if shard.AssertOwnership(ctx) != nil { controller_impl.go
505 > return controller_impl.go
506 > }
507 ready.Add(1)
508 }()
509 }
510 > if sem.Acquire(ctx, concurrency) != nil { controller_impl.go
511 > return false controller_impl.go
512 > }
513
514 if ready.Load() != int32(len(shards)) {
523 // publishShardCountUpdate publishes the current number of shards that this controller owns to all shard count
524 // subscribers in a non-blocking manner.
525 > func (c *ControllerImpl) publishShardCountUpdate(shardCount int) { controller_impl.go
526 > c.RLock()
527 > defer c.RUnlock()
528 > for sub := range c.shardCountSubscriptions {
529 select {
530 case sub.ch <- shardCount:
544 }
545
546 > func (c *ControllerImpl) validateShardId(shardID int32) error { controller_impl.go
547 > if shardID <= 0 {
548 return invalidShardIdLowerBound
549 }
550 > if shardID > c.config.NumberOfShards { controller_impl.go
551 return invalidShardIdUpperBound
552 }
553 > return nil controller_impl.go
554 }
555
583 }
584
585 > func IsShardOwnershipLostError(err error) bool { controller_impl.go
586 > switch err.(type) {
587 case *persistence.ShardOwnershipLostError:
588 return true
589 > case *serviceerrors.ShardOwnershipLost: controller_impl.go
590 > return true
591 }
592
594 }
595
596 > func numShardsTag(n int) tag.ZapTag { controller_impl.go
597 > return tag.Int("numShards", n)
598 > }
go.temporal.io/server/common/resourcetest/test_resource.go 144 covered LOC · 17 ranges

Open complete file

95
96 // NewTest returns a new test resource instance
97 > func NewTest(controller *gomock.Controller, serviceName primitives.ServiceName) *Test { test_resource.go
98 > logger := log.NewTestLogger()
99 >
100 > frontendClient := workflowservicemock.NewMockWorkflowServiceClient(controller)
101 > matchingClient := matchingservicemock.NewMockMatchingServiceClient(controller)
102 > historyClient := historyservicemock.NewMockHistoryServiceClient(controller)
103 > remoteFrontendClient := workflowservicemock.NewMockWorkflowServiceClient(controller)
104 > remoteAdminClient := adminservicemock.NewMockAdminServiceClient(controller)
105 > clusterMetadataManager := persistence.NewMockClusterMetadataManager(controller)
106 > clientBean := client.NewMockBean(controller)
107 > clientBean.EXPECT().GetFrontendClient().Return(frontendClient).AnyTimes()
108 > clientBean.EXPECT().GetMatchingClient(gomock.Any()).Return(matchingClient, nil).AnyTimes()
109 > clientBean.EXPECT().GetHistoryClient().Return(historyClient).AnyTimes()
110 > clientBean.EXPECT().GetRemoteAdminClient(gomock.Any()).Return(remoteAdminClient, nil).AnyTimes()
111 > clientBean.EXPECT().GetRemoteFrontendClient(gomock.Any()).Return(nil, remoteFrontendClient, nil).AnyTimes()
112 > clientFactory := client.NewMockFactory(controller)
113 >
114 > metadataMgr := persistence.NewMockMetadataManager(controller)
115 > taskMgr := persistence.NewMockTaskManager(controller)
116 > shardMgr := persistence.NewMockShardManager(controller)
117 > executionMgr := persistence.NewMockExecutionManager(controller)
118 > executionMgr.EXPECT().GetHistoryBranchUtil().Return(persistence.NewHistoryBranchUtil(serialization.NewSerializer())).AnyTimes()
119 > namespaceReplicationQueue := persistence.NewMockNamespaceReplicationQueue(controller)
120 > nexusEndpointMgr := persistence.NewMockNexusEndpointManager(controller)
121 >
122 > membershipMonitor := membership.NewMockMonitor(controller)
123 > hostInfoProvider := membership.NewMockHostInfoProvider(controller)
124 > frontendServiceResolver := membership.NewMockServiceResolver(controller)
125 > matchingServiceResolver := membership.NewMockServiceResolver(controller)
126 > historyServiceResolver := membership.NewMockServiceResolver(controller)
127 > workerServiceResolver := membership.NewMockServiceResolver(controller)
128 > membershipMonitor.EXPECT().GetResolver(primitives.FrontendService).Return(frontendServiceResolver, nil).AnyTimes()
129 > membershipMonitor.EXPECT().GetResolver(primitives.InternalFrontendService).Return(nil, membership.ErrUnknownService).AnyTimes()
130 > membershipMonitor.EXPECT().GetResolver(primitives.MatchingService).Return(matchingServiceResolver, nil).AnyTimes()
131 > membershipMonitor.EXPECT().GetResolver(primitives.HistoryService).Return(historyServiceResolver, nil).AnyTimes()
132 > membershipMonitor.EXPECT().GetResolver(primitives.WorkerService).Return(workerServiceResolver, nil).AnyTimes()
133 > membershipMonitor.EXPECT().WaitUntilInitialized(gomock.Any()).Return(nil).AnyTimes()
134 >
135 > scope := tally.NewTestScope("test", nil)
136 > metricsHandler := metrics.NewTallyMetricsHandler(metrics.ClientConfig{}, scope).WithTags(
137 > metrics.ServiceNameTag(serviceName),
138 > )
139 >
140 > return &Test{
141 > MetricsScope: scope,
142 > ClusterMetadata: cluster.NewMockMetadata(controller),
143 > SearchAttributesProvider: searchattribute.NewMockProvider(controller),
144 > SearchAttributesManager: searchattribute.NewMockManager(controller),
145 > SearchAttributesMapperProvider: searchattribute.NewMockMapperProvider(controller),
146 >
147 > // other common resources
148 >
149 > NamespaceCache: namespace.NewMockRegistry(controller),
150 > TimeSource: clock.NewRealTimeSource(),
151 > PayloadSerializer: serialization.NewSerializer(),
152 > MetricsHandler: metricsHandler,
153 > ArchivalMetadata: archiver.NewMetadataMock(controller),
154 > ArchiverProvider: provider.NewMockArchiverProvider(controller),
155 >
156 > // membership infos
157 >
158 > MembershipMonitor: membershipMonitor,
159 > HostInfoProvider: hostInfoProvider,
160 > FrontendServiceResolver: frontendServiceResolver,
161 > MatchingServiceResolver: matchingServiceResolver,
162 > HistoryServiceResolver: historyServiceResolver,
163 > WorkerServiceResolver: workerServiceResolver,
164 >
165 > // internal services clients
166 >
167 > SDKClientFactory: sdk.NewMockClientFactory(controller),
168 > FrontendClient: frontendClient,
169 > MatchingClient: matchingClient,
170 > HistoryClient: historyClient,
171 > RemoteAdminClient: remoteAdminClient,
172 > RemoteFrontendClient: remoteFrontendClient,
173 > ClientBean: clientBean,
174 > ClientFactory: clientFactory,
175 > ESClient: esclient.NewMockClient(controller),
176 > VisibilityManager: manager.NewMockVisibilityManager(controller),
177 >
178 > // persistence clients
179 >
180 > MetadataMgr: metadataMgr,
181 > ClusterMetadataMgr: clusterMetadataManager,
182 > TaskMgr: taskMgr,
183 > NamespaceReplicationQueue: namespaceReplicationQueue,
184 > ShardMgr: shardMgr,
185 > ExecutionMgr: executionMgr,
186 > NexusEndpointManager: nexusEndpointMgr,
187 >
188 > // logger
189 >
190 > Logger: logger,
191 > }
192 > }
193
194 // Start for testing
213
214 // GetHostInfo for testing
215 > func (t *Test) GetHostInfo() membership.HostInfo { test_resource.go
216 > return testHostInfo
217 > }
218
219 // GetClusterMetadata for testing
220 > func (t *Test) GetClusterMetadata() cluster.Metadata { test_resource.go
221 > return t.ClusterMetadata
222 > }
223
224 // GetClusterMetadata for testing
230
231 // GetNamespaceRegistry for testing
232 > func (t *Test) GetNamespaceRegistry() namespace.Registry { test_resource.go
233 > return t.NamespaceCache
234 > }
235
236 // GetTimeSource for testing
237 > func (t *Test) GetTimeSource() clock.TimeSource { test_resource.go
238 > return t.TimeSource
239 > }
240
241 // GetPayloadSerializer for testing
242 > func (t *Test) GetPayloadSerializer() serialization.Serializer { test_resource.go
243 > return t.PayloadSerializer
244 > }
245
246 // GetMetricsHandler for testing
250
251 // GetArchivalMetadata for testing
252 > func (t *Test) GetArchivalMetadata() archiver.ArchivalMetadata { test_resource.go
253 > return t.ArchivalMetadata
254 > }
255
256 // GetArchiverProvider for testing
267
268 // GetHostInfoProvider for testing
269 > func (t *Test) GetHostInfoProvider() membership.HostInfoProvider { test_resource.go
270 > return t.HostInfoProvider
271 > }
272
273 // GetFrontendServiceResolver for testing
282
283 // GetHistoryServiceResolver for testing
284 > func (t *Test) GetHistoryServiceResolver() membership.ServiceResolver { test_resource.go
285 > return t.HistoryServiceResolver
286 > }
287
288 // GetWorkerServiceResolver for testing
319
320 // GetHistoryClient for testing
321 > func (t *Test) GetHistoryClient() historyservice.HistoryServiceClient { test_resource.go
322 > return t.HistoryClient
323 > }
324
325 // GetRemoteAdminClient for testing
338
339 // GetClientBean for testing
340 > func (t *Test) GetClientBean() client.Bean { test_resource.go
341 > return t.ClientBean
342 > }
343
344 // GetClientFactory for testing
371
372 // GetShardManager for testing
373 > func (t *Test) GetShardManager() persistence.ShardManager { test_resource.go
374 > return t.ShardMgr
375 > }
376
377 // GetExecutionManager for testing
378 > func (t *Test) GetExecutionManager() persistence.ExecutionManager { test_resource.go
379 > return t.ExecutionMgr
380 > }
381
382 // loggers
383
384 // GetLogger for testing
385 > func (t *Test) GetLogger() log.Logger { test_resource.go
386 > return t.Logger
387 > }
388
389 // GetThrottledLogger for testing
390 > func (t *Test) GetThrottledLogger() log.Logger { test_resource.go
391 > return t.Logger
392 > }
393
394 // GetGRPCListener for testing
397 }
398
399 > func (t *Test) GetSearchAttributesProvider() searchattribute.Provider { test_resource.go
400 > return t.SearchAttributesProvider
401 > }
402
403 func (t *Test) GetSearchAttributesManager() searchattribute.Manager {
405 }
406
407 > func (t *Test) GetSearchAttributesMapperProvider() searchattribute.MapperProvider { test_resource.go
408 > return t.SearchAttributesMapperProvider
409 > }
go.temporal.io/server/common/log/zap_logger.go 109 covered LOC · 30 ranges

Open complete file

58 // NewTestLogger returns a logger for tests
59 // Deprecated: Use testlogger.TestLogger instead.
60 > func NewTestLogger() *zapLogger { zap_logger.go
61 > format := os.Getenv(TestLogFormatEnvVar)
62 > if format == "" {
63 > format = "console"
64 > }
65
66 > logger := BuildZapLogger(Config{ zap_logger.go
67 > Level: os.Getenv(TestLogLevelEnvVar),
68 > Format: format,
69 > Development: true,
70 > })
71 >
72 > // Don't include stack traces for warnings during tests. Only include them for logs with level error and above.
73 > logger = logger.WithOptions(zap.AddStacktrace(zap.ErrorLevel))
74 >
75 > return NewZapLogger(logger)
76 }
77
82
83 // NewZapLogger returns a new zap based logger from zap.Logger
84 > func NewZapLogger(zl *zap.Logger) *zapLogger { zap_logger.go
85 > return &zapLogger{
86 > zl: zl,
87 > skip: skipForZapLogger,
88 > baseZl: zl,
89 > }
90 > }
91
92 // BuildZapLogger builds and returns a new zap.Logger for this logging configuration
93 > func BuildZapLogger(cfg Config) *zap.Logger { zap_logger.go
94 > return buildZapLogger(cfg, true)
95 > }
96
97 > func caller(skip int) string { zap_logger.go
98 > _, path, line, ok := runtime.Caller(skip)
99 > if !ok {
100 return ""
101 }
102 > return path + ":" + strconv.Itoa(line) zap_logger.go
103 }
104
105 > func (l *zapLogger) buildFieldsWithCallAt(tags []tag.Tag) []zap.Field { zap_logger.go
106 > fields := make([]zap.Field, len(tags)+1)
107 > l.fillFields(tags, fields)
108 > fields[len(fields)-1] = zap.String(tag.LoggingCallAtKey, caller(l.skip))
109 > return fields
110 > }
111
112 // fillFields fill fields parameter with fields read from tags. Optimized for performance.
113 > func (l *zapLogger) fillFields(tags []tag.Tag, fields []zap.Field) { zap_logger.go
114 > for i, t := range tags {
115 > if zt, ok := t.(tag.ZapTag); ok { zap_logger.go
116 > fields[i] = zt.Field()
117 > } else {
118 fields[i] = zap.Any(t.Key(), t.Value())
119 }
121 }
122
123 > func setDefaultMsg(msg string) string { zap_logger.go
124 > if msg == "" {
125 > return defaultMsgForEmpty zap_logger.go
126 > }
127 > return msg zap_logger.go
128 }
129
130 > func (l *zapLogger) Debug(msg string, tags ...tag.Tag) { zap_logger.go
131 > if l.zl.Core().Enabled(zap.DebugLevel) {
132 msg = setDefaultMsg(msg)
133 fields := l.buildFieldsWithCallAt(tags)
136 }
137
138 > func (l *zapLogger) Info(msg string, tags ...tag.Tag) { zap_logger.go
139 > if l.zl.Core().Enabled(zap.InfoLevel) {
140 > msg = setDefaultMsg(msg)
141 > fields := l.buildFieldsWithCallAt(tags)
142 > l.zl.Info(msg, fields...)
143 > }
144 }
145
191 //
192 // by deduping "foo" against any existing "foo" tags *only in the former*
193 > func (l *zapLogger) With(tags ...tag.Tag) Logger { zap_logger.go
194 > cloneTags := mergeTags(l.tags, tags)
195 > if l.baseZl == nil {
196 l.baseZl = l.zl
197 }
198 > return l.cloneWithTags(cloneTags) zap_logger.go
199 }
200
201 > func (l *zapLogger) cloneWithTags(tags []tag.Tag) Logger { zap_logger.go
202 > fields := make([]zap.Field, len(tags))
203 > l.fillFields(tags, fields)
204 > zl := l.baseZl.With(fields...)
205 > return &zapLogger{
206 > zl: zl,
207 > skip: l.skip,
208 > baseZl: l.baseZl,
209 > tags: tags,
210 > }
211 > }
212
213 func (l *zapLogger) Skip(extraSkip int) Logger {
219 }
220
221 > func mergeTags(oldTags, newTags []tag.Tag) (outTags []tag.Tag) { zap_logger.go
222 > // Even if oldTags empty, we don't just return newTags because we need to de-dupe it.
223 > outTags = slices.Clone(oldTags)
224 > for _, t := range newTags {
225 > if i := slices.IndexFunc(outTags, func(ti tag.Tag) bool {
226 > return ti.Key() == t.Key() zap_logger.go
227 > }); i >= 0 {
228 > outTags[i] = t zap_logger.go
229 > } else { zap_logger.go
230 > outTags = append(outTags, t)
231 > }
232 }
233 > return outTags zap_logger.go
234 }
235
236 > func buildZapLogger(cfg Config, disableCaller bool) *zap.Logger { zap_logger.go
237 > encodeConfig := DefaultZapEncoderConfig
238 > if disableCaller {
239 > encodeConfig.CallerKey = zapcore.OmitKey
240 > encodeConfig.EncodeCaller = nil
241 > }
242
243 > outputPath := "stderr" zap_logger.go
244 > if len(cfg.OutputFile) > 0 {
245 outputPath = cfg.OutputFile
246 }
247 > if cfg.Stdout { zap_logger.go
248 outputPath = "stdout"
249 }
250 > encoding := "json" zap_logger.go
251 > if cfg.Format == "console" {
252 > encoding = "console" zap_logger.go
253 > }
254 > config := zap.Config{ zap_logger.go
255 > Level: zap.NewAtomicLevelAt(ParseZapLevel(cfg.Level)),
256 > Development: cfg.Development,
257 > Sampling: nil,
258 > Encoding: encoding,
259 > EncoderConfig: encodeConfig,
260 > OutputPaths: []string{outputPath},
261 > ErrorOutputPaths: []string{outputPath},
262 > DisableCaller: disableCaller,
263 > }
264 > logger, _ := config.Build()
265 > return logger
266 }
267
297 }
298
299 > func ParseZapLevel(level string) zapcore.Level { zap_logger.go
300 > switch strings.ToLower(level) {
301 case "debug":
302 return zap.DebugLevel
313 case "fatal":
314 return zap.FatalLevel
315 > default: zap_logger.go
316 > return zap.InfoLevel
317 }
318 }
go.temporal.io/server/common/metrics/metricstest/metricstest.go 101 covered LOC · 16 ranges

Open complete file

56 )
57
58 > func NewHandler(logger log.Logger, clientConfig metrics.ClientConfig) (*Handler, error) { metricstest.go
59 > registry := prometheus.NewRegistry()
60 > exporter, err := exporters.New(exporters.WithRegisterer(registry))
61 > if err != nil {
62 return nil, err
63 }
64
65 // Set any custom histogram bucket configuration.
66 > var views []sdkmetrics.View metricstest.go
67 > for _, u := range []string{metrics.Dimensionless, metrics.Bytes, metrics.Milliseconds} {
68 > views = append(views, sdkmetrics.NewView(
69 > sdkmetrics.Instrument{
70 > Kind: sdkmetrics.InstrumentKindHistogram,
71 > Unit: u,
72 > },
73 > sdkmetrics.Stream{
74 > Aggregation: sdkmetrics.AggregationExplicitBucketHistogram{
75 > Boundaries: clientConfig.PerUnitHistogramBoundaries[u],
76 > },
77 > },
78 > ))
79 > }
80 > provider := sdkmetrics.NewMeterProvider(
81 > sdkmetrics.WithReader(exporter),
82 > sdkmetrics.WithView(views...),
83 > )
84 > meter := provider.Meter("temporal")
85 >
86 > otelHandler, err := metrics.NewOtelMetricsHandler(logger, &otelProvider{meter: meter}, clientConfig, false)
87 > if err != nil {
88 return nil, err
89 }
90 > metricsHandler := &Handler{ metricstest.go
91 > Handler: otelHandler,
92 > reg: registry,
93 > }
94 >
95 > return metricsHandler, nil
96 }
97
98 func (*Handler) Stop(log.Logger) {}
99
100 > func (h *Handler) Snapshot() (Snapshot, error) { metricstest.go
101 > rec := httptest.NewRecorder()
102 > req := httptest.NewRequest("GET", "/metrics", nil)
103 > handler := http.NewServeMux()
104 > handler.HandleFunc("/metrics", promhttp.HandlerFor(h.reg, promhttp.HandlerOpts{Registry: h.reg}).ServeHTTP)
105 > handler.ServeHTTP(rec, req)
106 >
107 > var tp expfmt.TextParser
108 > families, err := tp.TextToMetricFamilies(rec.Body)
109 > if err != nil {
110 return Snapshot{}, err
111 }
112 > samples := map[string]sample{} metricstest.go
113 > histogramSamples := map[string]histogramSample{}
114 > for name, family := range families {
115 > for _, m := range family.GetMetric() {
116 > collectSamples(name, family, m, samples, histogramSamples)
117 > }
118 }
119 > return Snapshot{ metricstest.go
120 > samples: samples,
121 > histogramSamples: histogramSamples,
122 > }, nil
123 }
124
125 > func collectSamples(name string, family *dto.MetricFamily, m *dto.Metric, samples map[string]sample, histogramSamples map[string]histogramSample) { metricstest.go
126 > labelvalues := map[string]string{}
127 > for _, lp := range m.GetLabel() {
128 > labelvalues[lp.GetName()] = lp.GetValue()
129 > }
130 // This only records the last sample if there
131 // are multiple samples recorded.
132 > switch family.GetType() { metricstest.go
133 default:
134 // Not yet supporting summary, untyped.
135 > case dto.MetricType_HISTOGRAM: metricstest.go
136 > buckets := m.Histogram.GetBucket()
137 > hbs := []HistogramBucket{}
138 > for _, bucket := range buckets {
139 > hb := HistogramBucket{
140 > value: float64(bucket.GetCumulativeCount()),
141 > upperBound: bucket.GetUpperBound(),
142 > }
143 > hbs = append(hbs, hb)
144 > }
145 > histogramSamples[name] = histogramSample{
146 > metricType: family.GetType(),
147 > labelValues: labelvalues,
148 > buckets: hbs,
149 > }
150 > case dto.MetricType_COUNTER: metricstest.go
151 > samples[name] = sample{
152 > metricType: family.GetType(),
153 > labelValues: labelvalues,
154 > sampleValue: m.Counter.GetValue(),
155 > }
156 > case dto.MetricType_GAUGE:
157 > samples[name] = sample{
158 > metricType: family.GetType(),
159 > labelValues: labelvalues,
160 > sampleValue: m.Gauge.GetValue(),
161 > }
162 }
163 }
169 }
170
171 > func (m *otelProvider) GetMeter() metric.Meter { metricstest.go
172 > return m.meter
173 > }
174
175 func (m *otelProvider) Stop(log.Logger) {}
176
177 > func (s Snapshot) getValue(name string, metricType dto.MetricType, tags ...metrics.Tag) (float64, error) { metricstest.go
178 > labelValues := map[string]string{}
179 > for _, tag := range tags {
180 > labelValues[tag.Key] = tag.Value
181 > }
182 > sample, ok := s.samples[name]
183 > if !ok {
184 return 0, fmt.Errorf("%w: %q", ErrMetricNotFound, name)
185 }
186 > if sample.metricType != metricType { metricstest.go
187 return 0, fmt.Errorf("%w: %q is a %s, not a %s", ErrMetricTypeMismatch, name, sample.metricType, metricType)
188 }
189 > if !maps.Equal(sample.labelValues, labelValues) { metricstest.go
190 return 0, fmt.Errorf("%w: %q has %v, asked for %v", ErrMetricLabelMismatch, name, sample.labelValues, labelValues)
191 }
192 > return sample.sampleValue, nil metricstest.go
193 }
194
195 > func (s Snapshot) Counter(name string, tags ...metrics.Tag) (float64, error) { metricstest.go
196 > return s.getValue(name, dto.MetricType_COUNTER, tags...)
197 > }
198
199 func (s Snapshot) Gauge(name string, tags ...metrics.Tag) (float64, error) {
go.temporal.io/server/common/metrics/otel_metrics_handler.go 88 covered LOC · 25 ranges

Open complete file

58 cfg ClientConfig,
59 shouldRecordTimerInSeconds bool,
60 > ) (*otelMetricsHandler, error) { otel_metrics_handler.go
61 > c, err := globalRegistry.buildCatalog()
62 > if err != nil {
63 return nil, fmt.Errorf("failed to build metrics catalog: %w", err)
64 }
65
66 > return &otelMetricsHandler{ otel_metrics_handler.go
67 > l: l,
68 > set: makeInitialSet(cfg.Tags),
69 > provider: o,
70 > excludeTags: configExcludeTags(cfg),
71 > catalog: c,
72 > gauges: new(sync.Map),
73 > recordTimerInSeconds: shouldRecordTimerInSeconds,
74 > }, nil
75 }
76
77 // WithTags creates a new Handler with the provided Tag list.
78 // Tags are merged with the existing tags.
79 > func (omp *otelMetricsHandler) WithTags(tags ...Tag) Handler { otel_metrics_handler.go
80 > newHandler := *omp
81 > newHandler.set = newHandler.makeSet(tags)
82 > return &newHandler
83 > }
84
85 // Counter obtains a counter for the given name.
86 > func (omp *otelMetricsHandler) Counter(counter string) CounterIface { otel_metrics_handler.go
87 > opts := addOptions(omp, counterOptions{}, counter)
88 > c, err := omp.provider.GetMeter().Int64Counter(counter, opts...)
89 > if err != nil {
90 omp.l.Error("error getting metric", tag.String("MetricName", counter), tag.Error(err))
91 return CounterFunc(func(i int64, t ...Tag) {})
92 }
93
94 > return CounterFunc(func(i int64, t ...Tag) { otel_metrics_handler.go
95 > option := metric.WithAttributeSet(omp.makeSet(t))
96 > c.Add(context.Background(), i, option)
97 > })
98 }
99
100 > func (omp *otelMetricsHandler) getGaugeAdapter(gauge string) (*gaugeAdapter, error) { otel_metrics_handler.go
101 > if v, ok := omp.gauges.Load(gauge); ok {
102 > return v.(*gaugeAdapter), nil otel_metrics_handler.go
103 > }
104 > adapter := &gaugeAdapter{ otel_metrics_handler.go
105 > values: make(map[attribute.Distinct]gaugeValue),
106 > }
107 > if v, wasLoaded := omp.gauges.LoadOrStore(gauge, adapter); wasLoaded {
108 return v.(*gaugeAdapter), nil
109 }
110
111 > opts := addOptions(omp, gaugeOptions{ otel_metrics_handler.go
112 > metric.WithFloat64Callback(adapter.callback),
113 > }, gauge)
114 > // Register the gauge with otel. It will call our callback when it wants to read the values.
115 > _, err := omp.provider.GetMeter().Float64ObservableGauge(gauge, opts...)
116 > if err != nil {
117 omp.gauges.Delete(gauge)
118 omp.l.Error("error getting metric", tag.String("MetricName", gauge), tag.Error(err))
120 }
121
122 > return adapter, nil otel_metrics_handler.go
123 }
124
125 // Gauge obtains a gauge for the given name.
126 > func (omp *otelMetricsHandler) Gauge(gauge string) GaugeIface { otel_metrics_handler.go
127 > adapter, err := omp.getGaugeAdapter(gauge)
128 > if err != nil {
129 return GaugeFunc(func(i float64, t ...Tag) {})
130 }
131 > return &gaugeAdapterGauge{ otel_metrics_handler.go
132 > omp: omp,
133 > adapter: adapter,
134 > }
135 }
136
137 > func (a *gaugeAdapter) callback(ctx context.Context, o metric.Float64Observer) error { otel_metrics_handler.go
138 > a.lock.Lock()
139 > defer a.lock.Unlock()
140 > for _, v := range a.values {
141 > o.Observe(v.value, metric.WithAttributeSet(v.set))
142 > }
143 > return nil
144 }
145
146 > func (g *gaugeAdapterGauge) Record(v float64, tags ...Tag) { otel_metrics_handler.go
147 > set := g.omp.makeSet(tags)
148 > g.adapter.lock.Lock()
149 > defer g.adapter.lock.Unlock()
150 > g.adapter.values[set.Equivalent()] = gaugeValue{value: v, set: set}
151 > }
152
153 // Timer obtains a timer for the given name.
154 > func (omp *otelMetricsHandler) Timer(timer string) TimerIface { otel_metrics_handler.go
155 > if omp.recordTimerInSeconds {
156 return omp.timerInSeconds(timer)
157 }
158 > return omp.timerInMilliseconds(timer) otel_metrics_handler.go
159 }
160
161 > func (omp *otelMetricsHandler) timerInMilliseconds(timer string) TimerIface { otel_metrics_handler.go
162 > opts := addOptions(omp, int64HistogramOptions{metric.WithUnit(Milliseconds)}, timer)
163 > c, err := omp.provider.GetMeter().Int64Histogram(timer, opts...)
164 > if err != nil {
165 omp.l.Error("error getting metric", tag.String("MetricName", timer), tag.Error(err))
166 return TimerFunc(func(i time.Duration, t ...Tag) {})
167 }
168
169 > return TimerFunc(func(i time.Duration, t ...Tag) { otel_metrics_handler.go
170 > option := metric.WithAttributeSet(omp.makeSet(t))
171 > c.Record(context.Background(), i.Milliseconds(), option)
172 > })
173 }
174
216 // makeSet returns an otel attribute.Set with the given tags merged with the
217 // otelMetricsHandler's tags.
218 > func (omp *otelMetricsHandler) makeSet(tags []Tag) attribute.Set { otel_metrics_handler.go
219 > if len(tags) == 0 {
220 > return omp.set otel_metrics_handler.go
221 > }
222 > attrs := make([]attribute.KeyValue, 0, omp.set.Len()+len(tags)) otel_metrics_handler.go
223 > for i := omp.set.Iter(); i.Next(); {
224 attrs = append(attrs, i.Attribute())
225 }
226 > for _, t := range tags { otel_metrics_handler.go
227 > attrs = append(attrs, omp.convertTag(t))
228 > }
229 > return attribute.NewSet(attrs...)
230 }
231
232 > func (omp *otelMetricsHandler) convertTag(tag Tag) attribute.KeyValue { otel_metrics_handler.go
233 > if vals, ok := omp.excludeTags[tag.Key]; ok {
234 if _, ok := vals[tag.Value]; !ok {
235 return attribute.String(tag.Key, tagExcludedValue)
236 }
237 }
238 > return attribute.String(tag.Key, tag.Value) otel_metrics_handler.go
239 }
240
241 > func makeInitialSet(tags map[string]string) attribute.Set { otel_metrics_handler.go
242 > if len(tags) == 0 {
243 > return *attribute.EmptySet()
244 > }
245 var attrs []attribute.KeyValue
246 for k, v := range tags {
go.temporal.io/server/chasm/search_attribute.go 84 covered LOC · 13 ranges

Open complete file

136 }
137
138 > func newSearchAttributeFieldBool(index int) SearchAttributeFieldBool { search_attribute.go
139 > return SearchAttributeFieldBool{
140 > field: resolveFieldName(enumspb.INDEXED_VALUE_TYPE_BOOL, index),
141 > }
142 > }
143
144 // SearchAttributeFieldDateTime is a search attribute field for a datetime value.
147 }
148
149 > func newSearchAttributeFieldDateTime(index int) SearchAttributeFieldDateTime { search_attribute.go
150 > return SearchAttributeFieldDateTime{
151 > field: resolveFieldName(enumspb.INDEXED_VALUE_TYPE_DATETIME, index),
152 > }
153 > }
154
155 // SearchAttributeFieldInt is a search attribute field for an integer value.
158 }
159
160 > func newSearchAttributeFieldInt(index int) SearchAttributeFieldInt { search_attribute.go
161 > return SearchAttributeFieldInt{
162 > field: resolveFieldName(enumspb.INDEXED_VALUE_TYPE_INT, index),
163 > }
164 > }
165
166 // SearchAttributeFieldDouble is a search attribute field for a double value.
169 }
170
171 > func newSearchAttributeFieldDouble(index int) SearchAttributeFieldDouble { search_attribute.go
172 > return SearchAttributeFieldDouble{
173 > field: resolveFieldName(enumspb.INDEXED_VALUE_TYPE_DOUBLE, index),
174 > }
175 > }
176
177 // SearchAttributeFieldKeyword is a search attribute field for a keyword value.
180 }
181
182 > func newSearchAttributeFieldKeyword(index int) SearchAttributeFieldKeyword { search_attribute.go
183 > return SearchAttributeFieldKeyword{
184 > field: resolveFieldName(enumspb.INDEXED_VALUE_TYPE_KEYWORD, index),
185 > }
186 > }
187
188 > func newSearchAttributeFieldLowCardinalityKeyword(index int) SearchAttributeFieldKeyword { search_attribute.go
189 > return SearchAttributeFieldKeyword{
190 > field: fmt.Sprintf("%s%s%02d", sadefs.ReservedPrefix, "LowCardinalityKeyword", index),
191 > }
192 > }
193
194 // SearchAttributeFieldKeywordList is a search attribute field for a keyword list value.
197 }
198
199 > func newSearchAttributeFieldKeywordList(index int) SearchAttributeFieldKeywordList { search_attribute.go
200 > return SearchAttributeFieldKeywordList{
201 > field: resolveFieldName(enumspb.INDEXED_VALUE_TYPE_KEYWORD_LIST, index),
202 > }
203 > }
204
205 // SearchAttributeFieldText is a search attribute field for a text value.
214 }
215
216 > func resolveFieldName(valueType enumspb.IndexedValueType, index int) string { search_attribute.go
217 > // Columns are named like TemporalBool01, TemporalDatetime01, TemporalDouble01, TemporalInt01.
218 > return fmt.Sprintf("%s%s%02d", sadefs.ReservedPrefix, valueType.String(), index)
219 > }
220
221 func (s searchAttributeDefinition) definition() searchAttributeDefinition {
239 }
240
241 > func newSearchAttributeBoolByField(field string) SearchAttributeBool { search_attribute.go
242 > return SearchAttributeBool{
243 > searchAttributeDefinition: searchAttributeDefinition{
244 > alias: field,
245 > field: field,
246 > valueType: enumspb.INDEXED_VALUE_TYPE_BOOL,
247 > },
248 > }
249 > }
250
251 // Value sets the boolean value of the search attribute.
276 }
277
278 > func newSearchAttributeDateTimeByField(field string) SearchAttributeDateTime { search_attribute.go
279 > return SearchAttributeDateTime{
280 > searchAttributeDefinition: searchAttributeDefinition{
281 > alias: field,
282 > field: field,
283 > valueType: enumspb.INDEXED_VALUE_TYPE_DATETIME,
284 > },
285 > }
286 > }
287
288 // Value sets the date time value of the search attribute.
367
368 // NewSearchAttributeKeyword creates a new keyword search attribute given a predefined chasm field
369 > func NewSearchAttributeKeyword(alias string, keywordField SearchAttributeFieldKeyword) SearchAttributeKeyword { search_attribute.go
370 > return SearchAttributeKeyword{
371 > searchAttributeDefinition: searchAttributeDefinition{
372 > alias: alias,
373 > field: keywordField.field,
374 > valueType: enumspb.INDEXED_VALUE_TYPE_KEYWORD,
375 > },
376 > }
377 > }
378
379 > func newSearchAttributeKeywordByField(field string) SearchAttributeKeyword { search_attribute.go
380 > return SearchAttributeKeyword{
381 > searchAttributeDefinition: searchAttributeDefinition{
382 > alias: field,
383 > field: field,
384 > valueType: enumspb.INDEXED_VALUE_TYPE_KEYWORD,
385 > },
386 > }
387 > }
388
389 // Value sets the string value of the search attribute.
414 }
415
416 > func newSearchAttributeKeywordListByField(field string) SearchAttributeKeywordList { search_attribute.go
417 > return SearchAttributeKeywordList{
418 > searchAttributeDefinition: searchAttributeDefinition{
419 > alias: field,
420 > field: field,
421 > valueType: enumspb.INDEXED_VALUE_TYPE_KEYWORD_LIST,
422 > },
423 > }
424 > }
425
426 // Value sets the string list value of the search attribute.
go.temporal.io/server/api/persistence/v1/predicates.pb.go 83 covered LOC · 23 ranges

Open complete file

57 func (*Predicate) ProtoMessage() {}
58
59 > func (x *Predicate) ProtoReflect() protoreflect.Message { predicates.pb.go
60 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[0]
61 > if x != nil {
62 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
63 > if ms.LoadMessageInfo() == nil {
64 > ms.StoreMessageInfo(mi)
65 > }
66 > return ms
67 }
68 > return mi.MessageOf(x) predicates.pb.go
69 }
70
261 func (*UniversalPredicateAttributes) ProtoMessage() {}
262
263 > func (x *UniversalPredicateAttributes) ProtoReflect() protoreflect.Message { predicates.pb.go
264 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[1]
265 > if x != nil {
266 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
267 if ms.LoadMessageInfo() == nil {
297 func (*EmptyPredicateAttributes) ProtoMessage() {}
298
299 > func (x *EmptyPredicateAttributes) ProtoReflect() protoreflect.Message { predicates.pb.go
300 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[2]
301 > if x != nil {
302 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
303 if ms.LoadMessageInfo() == nil {
334 func (*AndPredicateAttributes) ProtoMessage() {}
335
336 > func (x *AndPredicateAttributes) ProtoReflect() protoreflect.Message { predicates.pb.go
337 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[3]
338 > if x != nil {
339 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
340 if ms.LoadMessageInfo() == nil {
378 func (*OrPredicateAttributes) ProtoMessage() {}
379
380 > func (x *OrPredicateAttributes) ProtoReflect() protoreflect.Message { predicates.pb.go
381 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[4]
382 > if x != nil {
383 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
384 if ms.LoadMessageInfo() == nil {
422 func (*NotPredicateAttributes) ProtoMessage() {}
423
424 > func (x *NotPredicateAttributes) ProtoReflect() protoreflect.Message { predicates.pb.go
425 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[5]
426 > if x != nil {
427 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
428 if ms.LoadMessageInfo() == nil {
466 func (*NamespaceIdPredicateAttributes) ProtoMessage() {}
467
468 > func (x *NamespaceIdPredicateAttributes) ProtoReflect() protoreflect.Message { predicates.pb.go
469 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[6]
470 > if x != nil {
471 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
472 if ms.LoadMessageInfo() == nil {
510 func (*TaskTypePredicateAttributes) ProtoMessage() {}
511
512 > func (x *TaskTypePredicateAttributes) ProtoReflect() protoreflect.Message { predicates.pb.go
513 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[7]
514 > if x != nil {
515 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
516 if ms.LoadMessageInfo() == nil {
554 func (*DestinationPredicateAttributes) ProtoMessage() {}
555
556 > func (x *DestinationPredicateAttributes) ProtoReflect() protoreflect.Message { predicates.pb.go
557 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[8]
558 > if x != nil {
559 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
560 if ms.LoadMessageInfo() == nil {
598 func (*OutboundTaskGroupPredicateAttributes) ProtoMessage() {}
599
600 > func (x *OutboundTaskGroupPredicateAttributes) ProtoReflect() protoreflect.Message { predicates.pb.go
601 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[9]
602 > if x != nil {
603 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
604 if ms.LoadMessageInfo() == nil {
642 func (*OutboundTaskPredicateAttributes) ProtoMessage() {}
643
644 > func (x *OutboundTaskPredicateAttributes) ProtoReflect() protoreflect.Message { predicates.pb.go
645 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[10]
646 > if x != nil {
647 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
648 if ms.LoadMessageInfo() == nil {
828 }
829
830 > func init() { file_temporal_server_api_persistence_v1_predicates_proto_init() } predicates.pb.go
831 > func file_temporal_server_api_persistence_v1_predicates_proto_init() {
832 > if File_temporal_server_api_persistence_v1_predicates_proto != nil {
833 > return
834 > }
835 > file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[0].OneofWrappers = []any{
836 > (*Predicate_UniversalPredicateAttributes)(nil),
837 > (*Predicate_EmptyPredicateAttributes)(nil),
838 > (*Predicate_AndPredicateAttributes)(nil),
839 > (*Predicate_OrPredicateAttributes)(nil),
840 > (*Predicate_NotPredicateAttributes)(nil),
841 > (*Predicate_NamespaceIdPredicateAttributes)(nil),
842 > (*Predicate_TaskTypePredicateAttributes)(nil),
843 > (*Predicate_DestinationPredicateAttributes)(nil),
844 > (*Predicate_OutboundTaskGroupPredicateAttributes)(nil),
845 > (*Predicate_OutboundTaskPredicateAttributes)(nil),
846 > }
847 > type x struct{}
848 > out := protoimpl.TypeBuilder{
849 > File: protoimpl.DescBuilder{
850 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
851 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_predicates_proto_rawDesc), len(file_temporal_server_api_persistence_v1_predicates_proto_rawDesc)),
852 > NumEnums: 0,
853 > NumMessages: 12,
854 > NumExtensions: 0,
855 > NumServices: 0,
856 > },
857 > GoTypes: file_temporal_server_api_persistence_v1_predicates_proto_goTypes,
858 > DependencyIndexes: file_temporal_server_api_persistence_v1_predicates_proto_depIdxs,
859 > MessageInfos: file_temporal_server_api_persistence_v1_predicates_proto_msgTypes,
860 > }.Build()
861 > File_temporal_server_api_persistence_v1_predicates_proto = out.File
862 > file_temporal_server_api_persistence_v1_predicates_proto_goTypes = nil
863 > file_temporal_server_api_persistence_v1_predicates_proto_depIdxs = nil
864 }
go.temporal.io/server/common/metrics/tally_metrics_handler.go 82 covered LOC · 19 ranges

Open complete file

37 }
38
39 > func newSharedScopeCache(maxSize int) *sharedScopeCache { tally_metrics_handler.go
40 > return &sharedScopeCache{
41 > maxSize: maxSize,
42 > scopes: make(map[string]tally.Scope),
43 > handlers: make(map[string]*tallyMetricsHandler),
44 > }
45 > }
46
47 func (c *sharedScopeCache) loadOrStoreScope(key string, create func() tally.Scope) tally.Scope {
68 }
69
70 > func (c *sharedScopeCache) loadOrStoreHandler(key string, create func() *tallyMetricsHandler) *tallyMetricsHandler { tally_metrics_handler.go
71 > c.mu.RLock()
72 > if h, ok := c.handlers[key]; ok {
73 c.mu.RUnlock()
74 return h
75 }
76 > c.mu.RUnlock() tally_metrics_handler.go
77 >
78 > h := create()
79 >
80 > c.mu.Lock()
81 > defer c.mu.Unlock()
82 > // Double-check: another goroutine may have inserted while we were creating.
83 > if existing, ok := c.handlers[key]; ok {
84 return existing
85 }
86 > if len(c.handlers) >= c.maxSize { tally_metrics_handler.go
87 clear(c.handlers)
88 }
89 > c.handlers[key] = h tally_metrics_handler.go
90 > return h
91 }
92
109 var _ Handler = (*tallyMetricsHandler)(nil)
110
111 > func NewTallyMetricsHandler(cfg ClientConfig, scope tally.Scope) *tallyMetricsHandler { tally_metrics_handler.go
112 > perUnitBuckets := make(map[MetricUnit]tally.Buckets)
113 >
114 > for unit, boundariesList := range cfg.PerUnitHistogramBoundaries {
115 perUnitBuckets[MetricUnit(unit)] = tally.ValueBuckets(boundariesList)
116 }
117
118 > maxSize := cfg.TagsCacheMaxSize tally_metrics_handler.go
119 > if maxSize <= 0 {
120 > maxSize = defaultTagsCacheMaxSize tally_metrics_handler.go
121 > }
122
123 > return &tallyMetricsHandler{ tally_metrics_handler.go
124 > scope: scope,
125 > perUnitBuckets: perUnitBuckets,
126 > excludeTags: configExcludeTags(cfg),
127 > cache: newSharedScopeCache(maxSize),
128 > scopeKey: "",
129 > }
130 }
131
132 // tagsCacheKey builds a compact string key from a tag slice for use as a
133 // map lookup key.
134 > func tagsCacheKey(tags []Tag) string { tally_metrics_handler.go
135 > size := 0
136 > for i := range tags {
137 > size += len(tags[i].Key) + len(tags[i].Value) + 2*binary.MaxVarintLen64
138 > }
139 > var sb strings.Builder
140 > sb.Grow(size)
141 > for _, t := range tags {
142 > appendCacheKeyPart(&sb, t.Key)
143 > appendCacheKeyPart(&sb, t.Value)
144 > }
145 > return sb.String()
146 }
147
148 > func appendCacheKeyPart(sb *strings.Builder, value string) { tally_metrics_handler.go
149 > var lenBuf [binary.MaxVarintLen64]byte
150 > n := binary.PutUvarint(lenBuf[:], uint64(len(value)))
151 > _, _ = sb.Write(lenBuf[:n])
152 > sb.WriteString(value)
153 > }
154
155 // WithTags creates a new MetricProvider with provided []Tag
156 // Tags are merged with registered Tags from the source MetricsHandler.
157 // Handlers are cached by tag combination so repeated calls avoid allocations.
158 > func (tmh *tallyMetricsHandler) WithTags(tags ...Tag) Handler { tally_metrics_handler.go
159 > if len(tags) == 0 {
160 return tmh
161 }
162 > normalizedKey := tagsCacheKey(normalizeTagsForCaching(tags, tmh.excludeTags)) tally_metrics_handler.go
163 > key := tmh.scopeKey + normalizedKey
164 > return tmh.cache.loadOrStoreHandler(key, func() *tallyMetricsHandler {
165 > return &tallyMetricsHandler{
166 > scope: tmh.scope.Tagged(tagsToMap(tags, tmh.excludeTags)),
167 > perUnitBuckets: tmh.perUnitBuckets,
168 > excludeTags: tmh.excludeTags,
169 > cache: tmh.cache,
170 > scopeKey: key,
171 > }
172 > })
173 }
174
190 // normalizeTag applies excludeTags substitution to a single tag.
191 // Returns the (possibly modified) tag and whether it was normalized.
192 > func normalizeTag(t Tag, excl excludeTags) (Tag, bool) { tally_metrics_handler.go
193 > if vals, ok := excl[t.Key]; ok {
194 if _, ok := vals[t.Value]; !ok {
195 return Tag{Key: t.Key, Value: tagExcludedValue}, true
196 }
197 }
198 > return t, false tally_metrics_handler.go
199 }
200
202 // canonical tag values for cache key computation. Returns the original slice
203 // unchanged if no tags need normalization (zero-alloc fast path).
204 > func normalizeTagsForCaching(tags []Tag, excl excludeTags) []Tag { tally_metrics_handler.go
205 > if len(excl) == 0 {
206 > return tags tally_metrics_handler.go
207 > }
208 var normalized []Tag
209 for i, t := range tags {
281 }
282
283 > func tagsToMap(t1 []Tag, e excludeTags) map[string]string { tally_metrics_handler.go
284 > if len(t1) == 0 {
285 return nil
286 }
287
288 > m := make(map[string]string, len(t1)) tally_metrics_handler.go
289 > for i := range t1 {
290 > nt, _ := normalizeTag(t1[i], e)
291 > m[nt.Key] = nt.Value
292 > }
293 > return m
294 }
go.temporal.io/server/common/persistence/data_interfaces_mock.go 71 covered LOC · 15 ranges

Open complete file

67
68 // NewMockShardManager creates a new mock instance.
69 > func NewMockShardManager(ctrl *gomock.Controller) *MockShardManager { data_interfaces_mock.go
70 > mock := &MockShardManager{ctrl: ctrl}
71 > mock.recorder = &MockShardManagerMockRecorder{mock}
72 > return mock
73 > }
74
75 // EXPECT returns an object that allows the caller to indicate expected use.
76 > func (m *MockShardManager) EXPECT() *MockShardManagerMockRecorder { data_interfaces_mock.go
77 > return m.recorder
78 > }
79
80 // AssertShardOwnership mocks base method.
81 > func (m *MockShardManager) AssertShardOwnership(ctx context.Context, request *AssertShardOwnershipRequest) error { data_interfaces_mock.go
82 > m.ctrl.T.Helper()
83 > ret := m.ctrl.Call(m, "AssertShardOwnership", ctx, request)
84 > ret0, _ := ret[0].(error)
85 > return ret0
86 > }
87
88 // AssertShardOwnership indicates an expected call of AssertShardOwnership.
89 > func (mr *MockShardManagerMockRecorder) AssertShardOwnership(ctx, request any) *gomock.Call { data_interfaces_mock.go
90 > mr.mock.ctrl.T.Helper()
91 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AssertShardOwnership", reflect.TypeOf((*MockShardManager)(nil).AssertShardOwnership), ctx, request)
92 > }
93
94 // Close mocks base method.
119
120 // GetOrCreateShard mocks base method.
121 > func (m *MockShardManager) GetOrCreateShard(ctx context.Context, request *GetOrCreateShardRequest) (*GetOrCreateShardResponse, error) { data_interfaces_mock.go
122 > m.ctrl.T.Helper()
123 > ret := m.ctrl.Call(m, "GetOrCreateShard", ctx, request)
124 > ret0, _ := ret[0].(*GetOrCreateShardResponse)
125 > ret1, _ := ret[1].(error)
126 > return ret0, ret1
127 > }
128
129 // GetOrCreateShard indicates an expected call of GetOrCreateShard.
130 > func (mr *MockShardManagerMockRecorder) GetOrCreateShard(ctx, request any) *gomock.Call { data_interfaces_mock.go
131 > mr.mock.ctrl.T.Helper()
132 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrCreateShard", reflect.TypeOf((*MockShardManager)(nil).GetOrCreateShard), ctx, request)
133 > }
134
135 // UpdateShard mocks base method.
136 > func (m *MockShardManager) UpdateShard(ctx context.Context, request *UpdateShardRequest) error { data_interfaces_mock.go
137 > m.ctrl.T.Helper()
138 > ret := m.ctrl.Call(m, "UpdateShard", ctx, request)
139 > ret0, _ := ret[0].(error)
140 > return ret0
141 > }
142
143 // UpdateShard indicates an expected call of UpdateShard.
144 > func (mr *MockShardManagerMockRecorder) UpdateShard(ctx, request any) *gomock.Call { data_interfaces_mock.go
145 > mr.mock.ctrl.T.Helper()
146 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateShard", reflect.TypeOf((*MockShardManager)(nil).UpdateShard), ctx, request)
147 > }
148
149 // MockExecutionManager is a mock of ExecutionManager interface.
160
161 // NewMockExecutionManager creates a new mock instance.
162 > func NewMockExecutionManager(ctrl *gomock.Controller) *MockExecutionManager { data_interfaces_mock.go
163 > mock := &MockExecutionManager{ctrl: ctrl}
164 > mock.recorder = &MockExecutionManagerMockRecorder{mock}
165 > return mock
166 > }
167
168 // EXPECT returns an object that allows the caller to indicate expected use.
169 > func (m *MockExecutionManager) EXPECT() *MockExecutionManagerMockRecorder { data_interfaces_mock.go
170 > return m.recorder
171 > }
172
173 // AddHistoryTasks mocks base method.
381
382 // GetHistoryBranchUtil indicates an expected call of GetHistoryBranchUtil.
383 > func (mr *MockExecutionManagerMockRecorder) GetHistoryBranchUtil() *gomock.Call { data_interfaces_mock.go
384 > mr.mock.ctrl.T.Helper()
385 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetHistoryBranchUtil", reflect.TypeOf((*MockExecutionManager)(nil).GetHistoryBranchUtil))
386 > }
387
388 // GetHistoryTasks mocks base method.
635
636 // NewMockTaskManager creates a new mock instance.
637 > func NewMockTaskManager(ctrl *gomock.Controller) *MockTaskManager { data_interfaces_mock.go
638 > mock := &MockTaskManager{ctrl: ctrl}
639 > mock.recorder = &MockTaskManagerMockRecorder{mock}
640 > return mock
641 > }
642
643 // EXPECT returns an object that allows the caller to indicate expected use.
878
879 // NewMockMetadataManager creates a new mock instance.
880 > func NewMockMetadataManager(ctrl *gomock.Controller) *MockMetadataManager { data_interfaces_mock.go
881 > mock := &MockMetadataManager{ctrl: ctrl}
882 > mock.recorder = &MockMetadataManagerMockRecorder{mock}
883 > return mock
884 > }
885
886 // EXPECT returns an object that allows the caller to indicate expected use.
1073
1074 // NewMockClusterMetadataManager creates a new mock instance.
1075 > func NewMockClusterMetadataManager(ctrl *gomock.Controller) *MockClusterMetadataManager { data_interfaces_mock.go
1076 > mock := &MockClusterMetadataManager{ctrl: ctrl}
1077 > mock.recorder = &MockClusterMetadataManagerMockRecorder{mock}
1078 > return mock
1079 > }
1080
1081 // EXPECT returns an object that allows the caller to indicate expected use.
1240
1241 // NewMockNexusEndpointManager creates a new mock instance.
1242 > func NewMockNexusEndpointManager(ctrl *gomock.Controller) *MockNexusEndpointManager { data_interfaces_mock.go
1243 > mock := &MockNexusEndpointManager{ctrl: ctrl}
1244 > mock.recorder = &MockNexusEndpointManagerMockRecorder{mock}
1245 > return mock
1246 > }
1247
1248 // EXPECT returns an object that allows the caller to indicate expected use.
go.temporal.io/server/api/persistence/v1/executions.pb.go 64 covered LOC · 2 ranges

Open complete file

90 }
91
92 > func (x *ShardInfo) GetRangeId() int64 { executions.pb.go
93 > if x != nil {
94 > return x.RangeId
95 > }
96 return 0
97 }
5706 }
5707
5708 > func init() { file_temporal_server_api_persistence_v1_executions_proto_init() } executions.pb.go
5709 > func file_temporal_server_api_persistence_v1_executions_proto_init() {
5710 > if File_temporal_server_api_persistence_v1_executions_proto != nil {
5711 > return
5712 > }
5713 > file_temporal_server_api_persistence_v1_chasm_proto_init()
5714 > file_temporal_server_api_persistence_v1_hsm_proto_init()
5715 > file_temporal_server_api_persistence_v1_queues_proto_init()
5716 > file_temporal_server_api_persistence_v1_update_proto_init()
5717 > file_temporal_server_api_persistence_v1_executions_proto_msgTypes[1].OneofWrappers = []any{
5718 > (*WorkflowExecutionInfo_LastWorkflowTaskFailureCause)(nil),
5719 > (*WorkflowExecutionInfo_LastWorkflowTaskTimedOutType)(nil),
5720 > }
5721 > file_temporal_server_api_persistence_v1_executions_proto_msgTypes[8].OneofWrappers = []any{
5722 > (*TransferTaskInfo_CloseExecutionTaskDetails_)(nil),
5723 > (*TransferTaskInfo_ChasmTaskInfo)(nil),
5724 > }
5725 > file_temporal_server_api_persistence_v1_executions_proto_msgTypes[10].OneofWrappers = []any{
5726 > (*VisibilityTaskInfo_ChasmTaskInfo)(nil),
5727 > }
5728 > file_temporal_server_api_persistence_v1_executions_proto_msgTypes[11].OneofWrappers = []any{
5729 > (*TimerTaskInfo_ChasmTaskInfo)(nil),
5730 > }
5731 > file_temporal_server_api_persistence_v1_executions_proto_msgTypes[13].OneofWrappers = []any{
5732 > (*OutboundTaskInfo_StateMachineInfo)(nil),
5733 > (*OutboundTaskInfo_ChasmTaskInfo)(nil),
5734 > (*OutboundTaskInfo_WorkerCommandsTask)(nil),
5735 > }
5736 > file_temporal_server_api_persistence_v1_executions_proto_msgTypes[17].OneofWrappers = []any{
5737 > (*ActivityInfo_UseWorkflowBuildIdInfo_)(nil),
5738 > (*ActivityInfo_LastIndependentlyAssignedBuildId)(nil),
5739 > }
5740 > file_temporal_server_api_persistence_v1_executions_proto_msgTypes[23].OneofWrappers = []any{
5741 > (*Callback_Nexus_)(nil),
5742 > (*Callback_Hsm)(nil),
5743 > }
5744 > file_temporal_server_api_persistence_v1_executions_proto_msgTypes[40].OneofWrappers = []any{
5745 > (*ActivityInfo_PauseInfo_Manual_)(nil),
5746 > (*ActivityInfo_PauseInfo_RuleId)(nil),
5747 > }
5748 > file_temporal_server_api_persistence_v1_executions_proto_msgTypes[46].OneofWrappers = []any{
5749 > (*CallbackInfo_Trigger_WorkflowClosed)(nil),
5750 > }
5751 > type x struct{}
5752 > out := protoimpl.TypeBuilder{
5753 > File: protoimpl.DescBuilder{
5754 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
5755 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_executions_proto_rawDesc), len(file_temporal_server_api_persistence_v1_executions_proto_rawDesc)),
5756 > NumEnums: 0,
5757 > NumMessages: 47,
5758 > NumExtensions: 0,
5759 > NumServices: 0,
5760 > },
5761 > GoTypes: file_temporal_server_api_persistence_v1_executions_proto_goTypes,
5762 > DependencyIndexes: file_temporal_server_api_persistence_v1_executions_proto_depIdxs,
5763 > MessageInfos: file_temporal_server_api_persistence_v1_executions_proto_msgTypes,
5764 > }.Build()
5765 > File_temporal_server_api_persistence_v1_executions_proto = out.File
5766 > file_temporal_server_api_persistence_v1_executions_proto_goTypes = nil
5767 > file_temporal_server_api_persistence_v1_executions_proto_depIdxs = nil
5768 }
go.temporal.io/server/api/persistence/v1/queues.pb.go 58 covered LOC · 13 ranges

Open complete file

46 func (*TaskKey) ProtoMessage() {}
47
48 > func (x *TaskKey) ProtoReflect() protoreflect.Message { queues.pb.go
49 > mi := &file_temporal_server_api_persistence_v1_queues_proto_msgTypes[0]
50 > if x != nil {
51 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
52 if ms.LoadMessageInfo() == nil {
55 return ms
56 }
57 > return mi.MessageOf(x) queues.pb.go
58 }
59
85 }
86
87 > func (x *QueueState) Reset() { queues.pb.go
88 > *x = QueueState{}
89 > mi := &file_temporal_server_api_persistence_v1_queues_proto_msgTypes[1]
90 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
91 > ms.StoreMessageInfo(mi)
92 > }
93
94 func (x *QueueState) String() string {
98 func (*QueueState) ProtoMessage() {}
99
100 > func (x *QueueState) ProtoReflect() protoreflect.Message { queues.pb.go
101 > mi := &file_temporal_server_api_persistence_v1_queues_proto_msgTypes[1]
102 > if x != nil {
103 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) queues.pb.go
104 > if ms.LoadMessageInfo() == nil {
105 > ms.StoreMessageInfo(mi)
106 > }
107 > return ms
108 }
109 return mi.MessageOf(x)
149 func (*QueueReaderState) ProtoMessage() {}
150
151 > func (x *QueueReaderState) ProtoReflect() protoreflect.Message { queues.pb.go
152 > mi := &file_temporal_server_api_persistence_v1_queues_proto_msgTypes[2]
153 > if x != nil {
154 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) queues.pb.go
155 > if ms.LoadMessageInfo() == nil {
156 > ms.StoreMessageInfo(mi)
157 > }
158 > return ms
159 }
160 > return mi.MessageOf(x) queues.pb.go
161 }
162
194 func (*QueueSliceScope) ProtoMessage() {}
195
196 > func (x *QueueSliceScope) ProtoReflect() protoreflect.Message { queues.pb.go
197 > mi := &file_temporal_server_api_persistence_v1_queues_proto_msgTypes[3]
198 > if x != nil {
199 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
200 if ms.LoadMessageInfo() == nil {
203 return ms
204 }
205 > return mi.MessageOf(x) queues.pb.go
206 }
207
246 func (*QueueSliceRange) ProtoMessage() {}
247
248 > func (x *QueueSliceRange) ProtoReflect() protoreflect.Message { queues.pb.go
249 > mi := &file_temporal_server_api_persistence_v1_queues_proto_msgTypes[4]
250 > if x != nil {
251 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
252 if ms.LoadMessageInfo() == nil {
255 return ms
256 }
257 > return mi.MessageOf(x) queues.pb.go
258 }
259
616 }
617
618 > func init() { file_temporal_server_api_persistence_v1_queues_proto_init() } queues.pb.go
619 > func file_temporal_server_api_persistence_v1_queues_proto_init() {
620 > if File_temporal_server_api_persistence_v1_queues_proto != nil {
621 > return
622 > }
623 > file_temporal_server_api_persistence_v1_predicates_proto_init()
624 > type x struct{}
625 > out := protoimpl.TypeBuilder{
626 > File: protoimpl.DescBuilder{
627 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
628 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_queues_proto_rawDesc), len(file_temporal_server_api_persistence_v1_queues_proto_rawDesc)),
629 > NumEnums: 0,
630 > NumMessages: 12,
631 > NumExtensions: 0,
632 > NumServices: 0,
633 > },
634 > GoTypes: file_temporal_server_api_persistence_v1_queues_proto_goTypes,
635 > DependencyIndexes: file_temporal_server_api_persistence_v1_queues_proto_depIdxs,
636 > MessageInfos: file_temporal_server_api_persistence_v1_queues_proto_msgTypes,
637 > }.Build()
638 > File_temporal_server_api_persistence_v1_queues_proto = out.File
639 > file_temporal_server_api_persistence_v1_queues_proto_goTypes = nil
640 > file_temporal_server_api_persistence_v1_queues_proto_depIdxs = nil
641 }
go.temporal.io/server/common/membership/interfaces_mock.go 53 covered LOC · 12 ranges

Open complete file

32
33 // NewMockMonitor creates a new mock instance.
34 > func NewMockMonitor(ctrl *gomock.Controller) *MockMonitor { interfaces_mock.go
35 > mock := &MockMonitor{ctrl: ctrl}
36 > mock.recorder = &MockMonitorMockRecorder{mock}
37 > return mock
38 > }
39
40 // EXPECT returns an object that allows the caller to indicate expected use.
41 > func (m *MockMonitor) EXPECT() *MockMonitorMockRecorder { interfaces_mock.go
42 > return m.recorder
43 > }
44
45 // ApproximateMaxPropagationTime mocks base method.
111
112 // GetResolver indicates an expected call of GetResolver.
113 > func (mr *MockMonitorMockRecorder) GetResolver(service any) *gomock.Call { interfaces_mock.go
114 > mr.mock.ctrl.T.Helper()
115 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetResolver", reflect.TypeOf((*MockMonitor)(nil).GetResolver), service)
116 > }
117
118 // SetDraining mocks base method.
151
152 // WaitUntilInitialized indicates an expected call of WaitUntilInitialized.
153 > func (mr *MockMonitorMockRecorder) WaitUntilInitialized(arg0 any) *gomock.Call { interfaces_mock.go
154 > mr.mock.ctrl.T.Helper()
155 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitUntilInitialized", reflect.TypeOf((*MockMonitor)(nil).WaitUntilInitialized), arg0)
156 > }
157
158 // MockServiceResolver is a mock of ServiceResolver interface.
169
170 // NewMockServiceResolver creates a new mock instance.
171 > func NewMockServiceResolver(ctrl *gomock.Controller) *MockServiceResolver { interfaces_mock.go
172 > mock := &MockServiceResolver{ctrl: ctrl}
173 > mock.recorder = &MockServiceResolverMockRecorder{mock}
174 > return mock
175 > }
176
177 // EXPECT returns an object that allows the caller to indicate expected use.
178 > func (m *MockServiceResolver) EXPECT() *MockServiceResolverMockRecorder { interfaces_mock.go
179 > return m.recorder
180 > }
181
182 // AddListener mocks base method.
223
224 // Lookup mocks base method.
225 > func (m *MockServiceResolver) Lookup(key string) (HostInfo, error) { interfaces_mock.go
226 > m.ctrl.T.Helper()
227 > ret := m.ctrl.Call(m, "Lookup", key)
228 > ret0, _ := ret[0].(HostInfo)
229 > ret1, _ := ret[1].(error)
230 > return ret0, ret1
231 > }
232
233 // Lookup indicates an expected call of Lookup.
234 > func (mr *MockServiceResolverMockRecorder) Lookup(key any) *gomock.Call { interfaces_mock.go
235 > mr.mock.ctrl.T.Helper()
236 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Lookup", reflect.TypeOf((*MockServiceResolver)(nil).Lookup), key)
237 > }
238
239 // LookupN mocks base method.
318
319 // NewMockHostInfoProvider creates a new mock instance.
320 > func NewMockHostInfoProvider(ctrl *gomock.Controller) *MockHostInfoProvider { interfaces_mock.go
321 > mock := &MockHostInfoProvider{ctrl: ctrl}
322 > mock.recorder = &MockHostInfoProviderMockRecorder{mock}
323 > return mock
324 > }
325
326 // EXPECT returns an object that allows the caller to indicate expected use.
327 > func (m *MockHostInfoProvider) EXPECT() *MockHostInfoProviderMockRecorder { interfaces_mock.go
328 > return m.recorder
329 > }
330
331 // HostInfo mocks base method.
332 > func (m *MockHostInfoProvider) HostInfo() HostInfo { interfaces_mock.go
333 > m.ctrl.T.Helper()
334 > ret := m.ctrl.Call(m, "HostInfo")
335 > ret0, _ := ret[0].(HostInfo)
336 > return ret0
337 > }
338
339 // HostInfo indicates an expected call of HostInfo.
340 > func (mr *MockHostInfoProviderMockRecorder) HostInfo() *gomock.Call { interfaces_mock.go
341 > mr.mock.ctrl.T.Helper()
342 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HostInfo", reflect.TypeOf((*MockHostInfoProvider)(nil).HostInfo))
343 > }
go.temporal.io/server/common/locks/priority_semaphore_impl.go 48 covered LOC · 12 ranges

Open complete file

67 // maximum combined weight for concurrent access, capable of handling multiple priority levels.
68 // Most of the logic is taken directly from golang's semaphore.Weighted.
69 > func NewPrioritySemaphore(n int) *PrioritySemaphoreImpl { priority_semaphore_impl.go
70 > waitLists := make([]*list.List, NumPriorities)
71 > for i := range waitLists {
72 > waitLists[i] = list.New()
73 > }
74 > return &PrioritySemaphoreImpl{
75 > size: n,
76 > waitLists: waitLists,
77 > }
78 }
79
81 // are available or ctx is done. On success, returns nil. On failure, returns
82 // ctx.Err() and leaves the semaphore unchanged.
83 > func (s *PrioritySemaphoreImpl) Acquire(ctx context.Context, priority Priority, n int) error { priority_semaphore_impl.go
84 > if priority >= NumPriorities {
85 // nolint:forbidigo
86 panic(fmt.Sprintf("semaphore: invalid priority %v, priority must be less than %v", priority, NumPriorities))
87 }
88
89 > done := ctx.Done() priority_semaphore_impl.go
90 >
91 > s.mu.Lock()
92 > select {
93 > case <-done: priority_semaphore_impl.go
94 > // ctx becoming done has "happened before" acquiring the semaphore,
95 > // whether it became done before the call began or while we were
96 > // waiting for the mutex. We prefer to fail even if we could acquire
97 > // the mutex without blocking.
98 > s.mu.Unlock()
99 > return ctx.Err()
101 }
102 // Check if acquisition can proceed without waiting
103 > if s.size-s.cur >= n && s.noWaiters(priority) { priority_semaphore_impl.go
104 > // Since we hold s.mu and haven't synchronized since checking done, if priority_semaphore_impl.go
105 > // ctx becomes done before we return here, it becoming done must have
106 > // "happened concurrently" with this call - it cannot "happen before"
107 > // we return in this branch. So, we're ok to always acquire here.
108 > s.cur += n
109 > s.mu.Unlock()
110 > return nil
111 > }
112
113 if n > s.size {
173 }
174
175 > func (s *PrioritySemaphoreImpl) Release(n int) { priority_semaphore_impl.go
176 > s.mu.Lock()
177 > defer s.mu.Unlock()
178 > s.cur -= n
179 > if s.cur < 0 {
180 s.mu.Unlock()
181 panic("semaphore: released more than held")
182 }
183 > s.notifyWaiters() priority_semaphore_impl.go
184 }
185
186 > func (s *PrioritySemaphoreImpl) notifyWaiters() { priority_semaphore_impl.go
187 > for _, l := range s.waitLists {
188 > for {
189 > next := l.Front()
190 > if next == nil {
191 > break // No more waiters blocked.
192 }
193
219
220 // noWaiters returns if there is no waiter that has priority higher or equal to lowestPriority.
221 > func (s *PrioritySemaphoreImpl) noWaiters(lowestPriority Priority) bool { priority_semaphore_impl.go
222 > for _, l := range s.waitLists[:lowestPriority+1] {
223 > if l.Len() > 0 {
224 return false
225 }
226 }
227 > return true priority_semaphore_impl.go
228 }
go.temporal.io/server/common/dynamicconfig/collection.go 46 covered LOC · 10 ranges

Open complete file

111 // NewCollection creates a new collection. For subscriptions to work, you must call Start/Stop.
112 // Get will work without Start/Stop.
113 > func NewCollection(client Client, logger log.Logger) *Collection { collection.go
114 > // Do this at the first convenient place we have a logger:
115 > logSharedStructureWarnings(logger)
116 >
117 > return &Collection{
118 > client: client,
119 > logger: logger,
120 > errCount: -1,
121 > subscriptions: make(map[Key]map[int]any),
122 > convertCache: new(sync.Map),
123 > indexCache: new(sync.Map),
124 > }
125 > }
126
127 func (c *Collection) Start() {
212 cvs []ConstrainedValue,
213 precedence []Constraints,
214 > ) (*ConstrainedValue, error) { collection.go
215 > if len(cvs) == 0 {
216 > return nil, errKeyNotPresent collection.go
217 > } else if len(cvs) > constraintsCacheThreshold && len(cvs) <= math.MaxInt32 { collection.go
218 return findMatchWithCache(cache, cvs, precedence)
219 }
279 convert func(value any) (T, error),
280 precedence []Constraints,
281 > ) T { collection.go
282 > cvs := c.client.GetValue(key)
283 > v, _ := matchAndConvertCvs(c, key, def, convert, precedence, cvs)
284 > return v
285 > }
286
287 func matchAndConvertCvs[T any](
292 precedence []Constraints,
293 cvs []ConstrainedValue,
294 > ) (T, any) { collection.go
295 > cvp, err := findMatch(c.indexCache, cvs, precedence)
296 > if err != nil {
297 > // couldn't find a constrained match, use default collection.go
298 > return def, usingDefaultValue
299 > }
300
301 typedVal, err := convertWithCache(c, key, convert, cvp)
676 // treat the fields independently), or the zero value of its type (if you want to treat the fields
677 // as a group and default unset fields to zero).
678 > func ConvertStructure[T any](def T) func(v any) (T, error) { collection.go
679 > return func(v any) (T, error) {
680 > // if we already have the right type, no conversion is necessary
681 > if typedV, ok := v.(T); ok {
682 return typedV, nil
683 }
685 // Deep-copy the default and decode over it. This allows using e.g. a struct with some
686 // default fields filled in and a config that only set some fields.
687 > out := deepCopyForMapstructure(def) collection.go
688 >
689 > dec, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
690 > Result: &out,
691 > DecodeHook: mapstructure.ComposeDecodeHookFunc(
692 > mapstructureHookDuration,
693 > mapstructureHookTimestamp,
694 > mapstructureHookProtoEnum,
695 > mapstructureHookGeneric,
696 > ),
697 > })
698 > if err != nil {
699 return out, err
700 }
701 > err = dec.Decode(v) collection.go
702 > return out, err
703 }
704 }
go.temporal.io/server/service/history/shard/task_key_manager.go 46 covered LOC · 8 ranges

Open complete file

28 logger log.Logger,
29 renewRangeIDFn renewRangeIDFn,
30 > ) *taskKeyManager { task_key_manager.go
31 > return &taskKeyManager{
32 > generator: newTaskKeyGenerator(
33 > config.RangeSizeBits,
34 > timeSource,
35 > logger,
36 > renewRangeIDFn,
37 > ),
38 > tracker: newTaskRequestTracker(taskCategoryRegistry),
39 > timeSource: timeSource,
40 > logger: logger,
41 > config: config,
42 > }
43 > }
44
45 func (m *taskKeyManager) setAndTrackTaskKeys(
66 }
67
68 > func (m *taskKeyManager) drainTaskRequests() { task_key_manager.go
69 > m.tracker.drain()
70 > }
71
72 func (m *taskKeyManager) setRangeID(
73 rangeID int64,
75 > m.generator.setRangeID(rangeID)
76 >
77 > // rangeID update means all pending add tasks requests either already succeeded
78 > // are guaranteed to fail, so we can clear pending requests in the tracker
79 > m.tracker.clear()
80 > }
81
82 func (m *taskKeyManager) setTaskMinScheduledTime(
83 taskMinScheduledTime time.Time,
85 > m.generator.setTaskMinScheduledTime(taskMinScheduledTime)
86 > }
87
88 func (m *taskKeyManager) getExclusiveReaderHighWatermark(
89 category tasks.Category,
90 > ) tasks.Key { task_key_manager.go
91 > minTaskKey, ok := m.tracker.minTaskKey(category)
92 > if !ok {
93 > minTaskKey = tasks.MaximumKey task_key_manager.go
94 > }
95
96 // TODO: should this be moved generator.setTaskKeys() ?
97 > m.setTaskMinScheduledTime( task_key_manager.go
98 > // TODO: Truncation here is just to make sure task scheduled time has the same precision as the old logic.
99 > // Remove this truncation once we validate the rest of the code can worker correctly with higher precision.
100 > m.timeSource.Now().Add(m.config.TimerProcessorMaxTimeShift()).Truncate(common.ScheduledTaskMinPrecision),
101 > )
102 >
103 > nextTaskKey := m.generator.peekTaskKey(category)
104 >
105 > exclusiveReaderHighWatermark := tasks.MinKey(
106 > minTaskKey,
107 > nextTaskKey,
108 > )
109 > if category.Type() == tasks.CategoryTypeScheduled {
110 exclusiveReaderHighWatermark.TaskID = 0
111
go.temporal.io/server/api/historyservice/v1/request_response.pb.go 45 covered LOC · 1 range

Open complete file

11956 }
11957
11958 > func init() { file_temporal_server_api_historyservice_v1_request_response_proto_init() } request_response.pb.go
11959 > func file_temporal_server_api_historyservice_v1_request_response_proto_init() {
11960 > if File_temporal_server_api_historyservice_v1_request_response_proto != nil {
11961 > return
11962 > }
11963 > file_temporal_server_api_historyservice_v1_request_response_proto_msgTypes[107].OneofWrappers = []any{
11964 > (*StreamWorkflowReplicationMessagesRequest_SyncReplicationState)(nil),
11965 > }
11966 > file_temporal_server_api_historyservice_v1_request_response_proto_msgTypes[108].OneofWrappers = []any{
11967 > (*StreamWorkflowReplicationMessagesResponse_Messages)(nil),
11968 > }
11969 > file_temporal_server_api_historyservice_v1_request_response_proto_msgTypes[134].OneofWrappers = []any{
11970 > (*CompleteNexusOperationChasmRequest_Success)(nil),
11971 > (*CompleteNexusOperationChasmRequest_Failure)(nil),
11972 > }
11973 > file_temporal_server_api_historyservice_v1_request_response_proto_msgTypes[136].OneofWrappers = []any{
11974 > (*CompleteNexusOperationRequest_Success)(nil),
11975 > (*CompleteNexusOperationRequest_Failure)(nil),
11976 > }
11977 > file_temporal_server_api_historyservice_v1_request_response_proto_msgTypes[162].OneofWrappers = []any{
11978 > (*ExecuteMultiOperationRequest_Operation_StartWorkflow)(nil),
11979 > (*ExecuteMultiOperationRequest_Operation_UpdateWorkflow)(nil),
11980 > }
11981 > file_temporal_server_api_historyservice_v1_request_response_proto_msgTypes[163].OneofWrappers = []any{
11982 > (*ExecuteMultiOperationResponse_Response_StartWorkflow)(nil),
11983 > (*ExecuteMultiOperationResponse_Response_UpdateWorkflow)(nil),
11984 > }
11985 > type x struct{}
11986 > out := protoimpl.TypeBuilder{
11987 > File: protoimpl.DescBuilder{
11988 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
11989 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_historyservice_v1_request_response_proto_rawDesc), len(file_temporal_server_api_historyservice_v1_request_response_proto_rawDesc)),
11990 > NumEnums: 0,
11991 > NumMessages: 171,
11992 > NumExtensions: 1,
11993 > NumServices: 0,
11994 > },
11995 > GoTypes: file_temporal_server_api_historyservice_v1_request_response_proto_goTypes,
11996 > DependencyIndexes: file_temporal_server_api_historyservice_v1_request_response_proto_depIdxs,
11997 > MessageInfos: file_temporal_server_api_historyservice_v1_request_response_proto_msgTypes,
11998 > ExtensionInfos: file_temporal_server_api_historyservice_v1_request_response_proto_extTypes,
11999 > }.Build()
12000 > File_temporal_server_api_historyservice_v1_request_response_proto = out.File
12001 > file_temporal_server_api_historyservice_v1_request_response_proto_goTypes = nil
12002 > file_temporal_server_api_historyservice_v1_request_response_proto_depIdxs = nil
12003 }
go.temporal.io/server/common/log/tag/tags.go 45 covered LOC · 15 ranges

Open complete file

70
71 // WorkflowAction returns tag for WorkflowAction
72 > func workflowAction(action string) ZapTag { tags.go
73 > return NewStringTag("wf-action", action)
74 > }
75
76 // WorkflowListFilterType returns tag for WorkflowListFilterType
77 > func workflowListFilterType(listFilterType string) ZapTag { tags.go
78 > return NewStringTag("wf-list-filter-type", listFilterType)
79 > }
80
81 // general
376
377 // Component returns tag for Component
378 > func component(component string) ZapTag { tags.go
379 > return NewStringTag("component", component)
380 > }
381
382 // Lifecycle returns tag for Lifecycle
383 > func lifecycle(lifecycle string) ZapTag { tags.go
384 > return NewStringTag("lifecycle", lifecycle)
385 > }
386
387 // StoreOperation returns tag for StoreOperation
388 > func storeOperation(storeOperation string) ZapTag { tags.go
389 > return NewStringTag("store-operation", storeOperation)
390 > }
391
392 // OperationResult returns tag for OperationResult
393 > func operationResult(operationResult string) ZapTag { tags.go
394 > return NewStringTag("operation-result", operationResult)
395 > }
396
397 // ErrorType returns tag for ErrorType
401
402 // errorType returns tag for ErrorType given a string
403 > func errorType(errorType string) ZapTag { tags.go
404 > return NewStringTag("error-type", errorType)
405 > }
406
407 // Shardupdate returns tag for Shardupdate
408 > func shardupdate(shardupdate string) ZapTag { tags.go
409 > return NewStringTag("shard-update", shardupdate)
410 > }
411
412 // scope returns a tag for scope
413 // Pre-defined scope tags are in values.go.
414 > func scope(scope string) ZapTag { tags.go
415 > return NewStringTag("scope", scope)
416 > }
417
418 // general
434
435 // Address return tag for Address
436 > func Address(ad string) ZapTag { tags.go
437 > return NewStringTag("address", ad)
438 > }
439
440 // HostID return tag for HostID
524
525 // Number returns tag for Number
526 > func Number(n int64) ZapTag { tags.go
527 > return NewInt64("number", n)
528 > }
529
530 // NextNumber returns tag for NextNumber
531 > func NextNumber(n int64) ZapTag { tags.go
532 > return NewInt64("next-number", n)
533 > }
534
535 // ServerName returns tag for ServerName
553
554 // ShardID returns tag for ShardID
555 > func ShardID(shardID int32) ZapTag { tags.go
556 > return NewInt32("shard-id", shardID)
557 > }
558
559 // ShardTime returns tag for ShardTime
563
564 // PreviousShardRangeID returns tag for PreviousShardRangeID
565 > func PreviousShardRangeID(id int64) ZapTag { tags.go
566 > return NewInt64("previous-shard-range-id", id)
567 > }
568
569 // ShardRangeID returns tag for ShardRangeID
570 > func ShardRangeID(id int64) ZapTag { tags.go
571 > return NewInt64("shard-range-id", id)
572 > }
573
574 // ShardContextState returns tag for ShardContextState
go.temporal.io/server/common/metrics/defs.go 44 covered LOC · 8 ranges

Open complete file

20 )
21
22 > func NewTimerDef(name string, opts ...Option) timerDefinition { defs.go
23 > // This line cannot be combined with others!
24 > // This ensures the stack trace has information of the caller.
25 > def := newMetricDefinition(name, opts...)
26 > globalRegistry.register(def)
27 > return timerDefinition{def}
28 > }
29
30 > func NewBytesHistogramDef(name string, opts ...Option) histogramDefinition { defs.go
31 > // This line cannot be combined with others!
32 > // This ensures the stack trace has information of the caller.
33 > def := newMetricDefinition(name, append(opts, WithUnit(Bytes))...)
34 > globalRegistry.register(def)
35 > return histogramDefinition{def}
36 > }
37
38 > func NewDimensionlessHistogramDef(name string, opts ...Option) histogramDefinition { defs.go
39 > // This line cannot be combined with others!
40 > // This ensures the stack trace has information of the caller.
41 > def := newMetricDefinition(name, append(opts, WithUnit(Dimensionless))...)
42 > globalRegistry.register(def)
43 > return histogramDefinition{def}
44 > }
45
46 > func NewCounterDef(name string, opts ...Option) counterDefinition { defs.go
47 > // This line cannot be combined with others!
48 > // This ensures the stack trace has information of the caller.
49 > def := newMetricDefinition(name, opts...)
50 > globalRegistry.register(def)
51 > return counterDefinition{def}
52 > }
53
54 > func NewGaugeDef(name string, opts ...Option) gaugeDefinition { defs.go
55 > // This line cannot be combined with others!
56 > // This ensures the stack trace has information of the caller.
57 > def := newMetricDefinition(name, opts...)
58 > globalRegistry.register(def)
59 > return gaugeDefinition{def}
60 > }
61
62 func (d histogramDefinition) With(handler Handler) HistogramIface {
64 }
65
66 > func (d counterDefinition) With(handler Handler) CounterIface { defs.go
67 > return handler.Counter(d.name)
68 > }
69
70 > func (d gaugeDefinition) With(handler Handler) GaugeIface { defs.go
71 > return handler.Gauge(d.name)
72 > }
73
74 > func (d timerDefinition) With(handler Handler) TimerIface { defs.go
75 > return handler.Timer(d.name)
76 > }
go.temporal.io/server/api/matchingservice/v1/request_response.pb.go 43 covered LOC · 1 range

Open complete file

6833 }
6834
6835 > func init() { file_temporal_server_api_matchingservice_v1_request_response_proto_init() } request_response.pb.go
6836 > func file_temporal_server_api_matchingservice_v1_request_response_proto_init() {
6837 > if File_temporal_server_api_matchingservice_v1_request_response_proto != nil {
6838 > return
6839 > }
6840 > file_temporal_server_api_matchingservice_v1_request_response_proto_msgTypes[27].OneofWrappers = []any{
6841 > (*UpdateWorkerBuildIdCompatibilityRequest_ApplyPublicRequest_)(nil),
6842 > (*UpdateWorkerBuildIdCompatibilityRequest_RemoveBuildIds_)(nil),
6843 > (*UpdateWorkerBuildIdCompatibilityRequest_PersistUnknownBuildId)(nil),
6844 > }
6845 > file_temporal_server_api_matchingservice_v1_request_response_proto_msgTypes[29].OneofWrappers = []any{
6846 > (*GetWorkerVersioningRulesRequest_Request)(nil),
6847 > }
6848 > file_temporal_server_api_matchingservice_v1_request_response_proto_msgTypes[31].OneofWrappers = []any{
6849 > (*UpdateWorkerVersioningRulesRequest_Request)(nil),
6850 > }
6851 > file_temporal_server_api_matchingservice_v1_request_response_proto_msgTypes[37].OneofWrappers = []any{
6852 > (*SyncDeploymentUserDataRequest_UpdateVersionData)(nil),
6853 > (*SyncDeploymentUserDataRequest_ForgetVersion)(nil),
6854 > }
6855 > file_temporal_server_api_matchingservice_v1_request_response_proto_msgTypes[56].OneofWrappers = []any{
6856 > (*DispatchNexusTaskResponse_HandlerError)(nil),
6857 > (*DispatchNexusTaskResponse_Response)(nil),
6858 > (*DispatchNexusTaskResponse_RequestTimeout)(nil),
6859 > (*DispatchNexusTaskResponse_Failure)(nil),
6860 > }
6861 > type x struct{}
6862 > out := protoimpl.TypeBuilder{
6863 > File: protoimpl.DescBuilder{
6864 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
6865 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_matchingservice_v1_request_response_proto_rawDesc), len(file_temporal_server_api_matchingservice_v1_request_response_proto_rawDesc)),
6866 > NumEnums: 0,
6867 > NumMessages: 97,
6868 > NumExtensions: 0,
6869 > NumServices: 0,
6870 > },
6871 > GoTypes: file_temporal_server_api_matchingservice_v1_request_response_proto_goTypes,
6872 > DependencyIndexes: file_temporal_server_api_matchingservice_v1_request_response_proto_depIdxs,
6873 > MessageInfos: file_temporal_server_api_matchingservice_v1_request_response_proto_msgTypes,
6874 > }.Build()
6875 > File_temporal_server_api_matchingservice_v1_request_response_proto = out.File
6876 > file_temporal_server_api_matchingservice_v1_request_response_proto_goTypes = nil
6877 > file_temporal_server_api_matchingservice_v1_request_response_proto_depIdxs = nil
6878 }
go.temporal.io/server/common/backoff/retrypolicy.go 42 covered LOC · 7 ranges

Open complete file

80
81 // NewExponentialRetryPolicy returns an instance of ExponentialRetryPolicy using the provided initialInterval
82 > func NewExponentialRetryPolicy(initialInterval time.Duration) *ExponentialRetryPolicy { retrypolicy.go
83 > p := &ExponentialRetryPolicy{
84 > initialInterval: initialInterval,
85 > backoffCoefficient: defaultBackoffCoefficient,
86 > maximumInterval: defaultMaximumInterval,
87 > expirationInterval: defaultExpirationInterval,
88 > maximumAttempts: defaultMaximumAttempts,
89 > }
90 >
91 > return p
92 > }
93
94 // NewRetrier is used for creating a new instance of Retrier
95 > func NewRetrier(policy RetryPolicy, timeSource clock.TimeSource) Retrier { retrypolicy.go
96 > return &retrierImpl{
97 > policy: policy,
98 > timeSource: timeSource,
99 > startTime: timeSource.Now(),
100 > currentAttempt: 1,
101 > }
102 > }
103
104 // WithInitialInterval sets the initial interval used by ExponentialRetryPolicy for the very first retry
121 // This does *not* cause the policy to stop retrying when the interval between retries reaches the supplied duration.
122 // That is what WithExpirationInterval does. Instead, this prevents the interval from exceeding maximumInterval.
123 > func (p *ExponentialRetryPolicy) WithMaximumInterval(maximumInterval time.Duration) *ExponentialRetryPolicy { retrypolicy.go
124 > p.maximumInterval = maximumInterval
125 > return p
126 > }
127
128 // WithExpirationInterval sets the absolute expiration interval for all retries
129 > func (p *ExponentialRetryPolicy) WithExpirationInterval(expirationInterval time.Duration) *ExponentialRetryPolicy { retrypolicy.go
130 > p.expirationInterval = expirationInterval
131 > return p
132 > }
133
134 // WithMaximumAttempts sets the maximum number of retry attempts
135 > func (p *ExponentialRetryPolicy) WithMaximumAttempts(maximumAttempts int) *ExponentialRetryPolicy { retrypolicy.go
136 > p.maximumAttempts = maximumAttempts
137 > return p
138 > }
139
140 // ComputeNextDelay returns the next delay interval. This is used by Retrier to delay calling the operation again
267 var _ RetryPolicy = (*ConstantDelayRetryPolicy)(nil)
268
269 > func NewConstantDelayRetryPolicy(delay time.Duration) *ConstantDelayRetryPolicy { retrypolicy.go
270 > return &ConstantDelayRetryPolicy{
271 > maximumAttempts: defaultMaximumAttempts,
272 > jitterPct: defaultJitterPct,
273 > delay: delay,
274 > }
275 > }
276
277 > func (p *ConstantDelayRetryPolicy) WithMaximumAttempts(maximumAttempts int) *ConstantDelayRetryPolicy { retrypolicy.go
278 > p.maximumAttempts = maximumAttempts
279 > return p
280 > }
281
282 func (p *ConstantDelayRetryPolicy) WithJitter(jitterPct float64) *ConstantDelayRetryPolicy {
go.temporal.io/server/common/log/tag/zap_tag.go 42 covered LOC · 10 ranges

Open complete file

26 }
27
28 > func (t ZapTag) Field() zap.Field { zap_tag.go
29 > return t.field
30 > }
31
32 > func (t ZapTag) Key() string { zap_tag.go
33 > return t.field.Key
34 > }
35
36 func (t ZapTag) Value() any {
44 }
45
46 > func NewStringTag(key string, value string) ZapTag { zap_tag.go
47 > return ZapTag{
48 > field: zap.String(key, value),
49 > }
50 > }
51
52 func NewStringsTag(key string, value []string) ZapTag {
82 }
83
84 > func NewInt64(key string, value int64) ZapTag { zap_tag.go
85 > return ZapTag{
86 > field: zap.Int64(key, value),
87 > }
88 > }
89
90 > func NewInt(key string, value int) ZapTag { zap_tag.go
91 > return ZapTag{
92 > field: zap.Int(key, value),
93 > }
94 > }
95
96 > func NewInt32(key string, value int32) ZapTag { zap_tag.go
97 > return ZapTag{
98 > field: zap.Int32(key, value),
99 > }
100 > }
101
102 func NewUInt32(key string, value uint32) ZapTag {
118 }
119
120 > func NewBoolTag(key string, value bool) ZapTag { zap_tag.go
121 > return ZapTag{
122 > field: zap.Bool(key, value),
123 > }
124 > }
125
126 func NewErrorTag(key string, value error) ZapTag {
130 }
131
132 > func NewDurationTag(key string, value time.Duration) ZapTag { zap_tag.go
133 > return ZapTag{
134 > field: zap.Duration(key, value),
135 > }
136 > }
137
138 func NewDurationPtrTag(key string, value *durationpb.Duration) ZapTag {
188 }
189
190 > func Int(key string, value int) ZapTag { zap_tag.go
191 > return NewInt(key, value)
192 > }
193
194 func Int32(key string, value int32) ZapTag {
208 }
209
210 > func Duration(key string, value time.Duration) ZapTag { zap_tag.go
211 > return NewDurationTag(key, value)
212 > }
213
214 func DurationPtr(key string, value *durationpb.Duration) ZapTag {
go.temporal.io/server/service/history/shard/context_factory.go 39 covered LOC · 3 ranges

Open complete file

74 )
75
76 > func ContextFactoryProvider(params ContextFactoryParams) ContextFactory { context_factory.go
77 > return &contextFactoryImpl{
78 > ContextFactoryParams: &params,
79 > }
80 > }
81
82 func (c *contextFactoryImpl) CreateContext(
83 shardID int32,
84 closeCallback CloseCallback,
85 > ) (historyi.ControllableContext, error) { context_factory.go
86 > shard, err := newContext(
87 > shardID,
88 > c.EngineFactory,
89 > c.Config,
90 > c.PersistenceConfig,
91 > closeCallback,
92 > c.Logger,
93 > c.ThrottledLogger,
94 > c.PersistenceExecutionManager,
95 > c.PersistenceShardManager,
96 > c.ClientBean,
97 > c.HistoryClient,
98 > c.MetricsHandler,
99 > c.EventLogger,
100 > c.PayloadSerializer,
101 > c.TimeSource,
102 > c.NamespaceRegistry,
103 > c.SaProvider,
104 > c.SaMapperProvider,
105 > c.ClusterMetadata,
106 > c.ArchivalMetadata,
107 > c.HostInfoProvider,
108 > c.TaskCategoryRegistry,
109 > c.EventsCache,
110 > c.StateMachineRegistry,
111 > c.ChasmRegistry,
112 > c.ChasmWorkflowRegistry,
113 > c.EndpointRegistry,
114 > c.HandoverTrackerFactory,
115 > )
116 > if err != nil {
117 return nil, err
118 }
119 > shard.start() context_factory.go
120 > return shard, nil
121 }
go.temporal.io/server/api/adminservice/v1/request_response.pb.go 36 covered LOC · 1 range

Open complete file

6623 }
6624
6625 > func init() { file_temporal_server_api_adminservice_v1_request_response_proto_init() } request_response.pb.go
6626 > func file_temporal_server_api_adminservice_v1_request_response_proto_init() {
6627 > if File_temporal_server_api_adminservice_v1_request_response_proto != nil {
6628 > return
6629 > }
6630 > file_temporal_server_api_adminservice_v1_request_response_proto_msgTypes[59].OneofWrappers = []any{
6631 > (*StreamWorkflowReplicationMessagesRequest_SyncReplicationState)(nil),
6632 > }
6633 > file_temporal_server_api_adminservice_v1_request_response_proto_msgTypes[60].OneofWrappers = []any{
6634 > (*StreamWorkflowReplicationMessagesResponse_Messages)(nil),
6635 > }
6636 > file_temporal_server_api_adminservice_v1_request_response_proto_msgTypes[61].OneofWrappers = []any{
6637 > (*GetNamespaceRequest_Namespace)(nil),
6638 > (*GetNamespaceRequest_Id)(nil),
6639 > }
6640 > file_temporal_server_api_adminservice_v1_request_response_proto_msgTypes[90].OneofWrappers = []any{
6641 > (*StartAdminBatchOperationRequest_RefreshTasksOperation)(nil),
6642 > }
6643 > type x struct{}
6644 > out := protoimpl.TypeBuilder{
6645 > File: protoimpl.DescBuilder{
6646 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
6647 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_adminservice_v1_request_response_proto_rawDesc), len(file_temporal_server_api_adminservice_v1_request_response_proto_rawDesc)),
6648 > NumEnums: 1,
6649 > NumMessages: 105,
6650 > NumExtensions: 0,
6651 > NumServices: 0,
6652 > },
6653 > GoTypes: file_temporal_server_api_adminservice_v1_request_response_proto_goTypes,
6654 > DependencyIndexes: file_temporal_server_api_adminservice_v1_request_response_proto_depIdxs,
6655 > EnumInfos: file_temporal_server_api_adminservice_v1_request_response_proto_enumTypes,
6656 > MessageInfos: file_temporal_server_api_adminservice_v1_request_response_proto_msgTypes,
6657 > }.Build()
6658 > File_temporal_server_api_adminservice_v1_request_response_proto = out.File
6659 > file_temporal_server_api_adminservice_v1_request_response_proto_goTypes = nil
6660 > file_temporal_server_api_adminservice_v1_request_response_proto_depIdxs = nil
6661 }
go.temporal.io/server/api/replication/v1/message.pb.go 36 covered LOC · 2 ranges

Open complete file

2441 }
2442
2443 > func init() { file_temporal_server_api_replication_v1_message_proto_init() } message.pb.go
2444 > func file_temporal_server_api_replication_v1_message_proto_init() {
2445 > if File_temporal_server_api_replication_v1_message_proto != nil {
2446 return
2447 }
2448 > file_temporal_server_api_replication_v1_message_proto_msgTypes[0].OneofWrappers = []any{ message.pb.go
2449 > (*ReplicationTask_NamespaceTaskAttributes)(nil),
2450 > (*ReplicationTask_SyncShardStatusTaskAttributes)(nil),
2451 > (*ReplicationTask_SyncActivityTaskAttributes)(nil),
2452 > (*ReplicationTask_HistoryTaskAttributes)(nil),
2453 > (*ReplicationTask_SyncWorkflowStateTaskAttributes)(nil),
2454 > (*ReplicationTask_TaskQueueUserDataAttributes)(nil),
2455 > (*ReplicationTask_SyncHsmAttributes)(nil),
2456 > (*ReplicationTask_BackfillHistoryTaskAttributes)(nil),
2457 > (*ReplicationTask_VerifyVersionedTransitionTaskAttributes)(nil),
2458 > (*ReplicationTask_SyncVersionedTransitionTaskAttributes)(nil),
2459 > }
2460 > file_temporal_server_api_replication_v1_message_proto_msgTypes[21].OneofWrappers = []any{
2461 > (*VersionedTransitionArtifact_SyncWorkflowStateMutationAttributes)(nil),
2462 > (*VersionedTransitionArtifact_SyncWorkflowStateSnapshotAttributes)(nil),
2463 > }
2464 > type x struct{}
2465 > out := protoimpl.TypeBuilder{
2466 > File: protoimpl.DescBuilder{
2467 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
2468 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_replication_v1_message_proto_rawDesc), len(file_temporal_server_api_replication_v1_message_proto_rawDesc)),
2469 > NumEnums: 0,
2470 > NumMessages: 23,
2471 > NumExtensions: 0,
2472 > NumServices: 0,
2473 > },
2474 > GoTypes: file_temporal_server_api_replication_v1_message_proto_goTypes,
2475 > DependencyIndexes: file_temporal_server_api_replication_v1_message_proto_depIdxs,
2476 > MessageInfos: file_temporal_server_api_replication_v1_message_proto_msgTypes,
2477 > }.Build()
2478 > File_temporal_server_api_replication_v1_message_proto = out.File
2479 > file_temporal_server_api_replication_v1_message_proto_goTypes = nil
2480 > file_temporal_server_api_replication_v1_message_proto_depIdxs = nil
2481 }
go.temporal.io/server/common/namespace/testconstructors.go 36 covered LOC · 8 ranges

Open complete file

13 config *persistencespb.NamespaceConfig,
14 targetCluster string,
15 > ) *Namespace { testconstructors.go
16 > detail := &persistencespb.NamespaceDetail{
17 > Info: ensureInfo(info),
18 > Config: ensureConfig(config),
19 > ReplicationConfig: &persistencespb.NamespaceReplicationConfig{
20 > ActiveClusterName: targetCluster,
21 > Clusters: []string{targetCluster},
22 > },
23 > FailoverVersion: common.EmptyVersion,
24 > }
25 > factory := NewDefaultReplicationResolverFactory()
26 > resolver := factory(detail)
27 > ns, _ := FromPersistentState(detail, resolver, WithGlobalFlag(false))
28 > return ns
29 > }
30
31 // NewNamespaceForTest returns an entry with test data
55 repConfig *persistencespb.NamespaceReplicationConfig,
56 failoverVersion int64,
57 > ) *Namespace { testconstructors.go
58 > detail := &persistencespb.NamespaceDetail{
59 > Info: ensureInfo(info),
60 > Config: ensureConfig(config),
61 > ReplicationConfig: ensureRepConfig(repConfig),
62 > FailoverVersion: failoverVersion,
63 > }
64 > factory := NewDefaultReplicationResolverFactory()
65 > resolver := factory(detail)
66 > ns, _ := FromPersistentState(detail, resolver, WithGlobalFlag(true))
67 > return ns
68 > }
69
70 > func ensureInfo(proto *persistencespb.NamespaceInfo) *persistencespb.NamespaceInfo { testconstructors.go
71 > if proto == nil {
72 return &persistencespb.NamespaceInfo{}
73 }
74 > return proto testconstructors.go
75 }
76
77 > func ensureConfig(proto *persistencespb.NamespaceConfig) *persistencespb.NamespaceConfig { testconstructors.go
78 > if proto == nil {
79 return &persistencespb.NamespaceConfig{}
80 }
81 > return proto testconstructors.go
82 }
83
84 > func ensureRepConfig(proto *persistencespb.NamespaceReplicationConfig) *persistencespb.NamespaceReplicationConfig { testconstructors.go
85 > if proto == nil {
86 return &persistencespb.NamespaceReplicationConfig{}
87 }
88 > return proto testconstructors.go
89 }
go.temporal.io/server/service/history/shard/task_request_tracker.go 35 covered LOC · 7 ranges

Open complete file

24 )
25
26 > func newTaskRequestTracker(registry tasks.TaskCategoryRegistry) *taskRequestTracker { task_request_tracker.go
27 > outstandingTaskKeys := make(map[tasks.Category]map[tasks.Key]struct{})
28 > for _, category := range registry.GetCategories() {
29 > outstandingTaskKeys[category] = make(map[tasks.Key]struct{})
30 > }
31 > return &taskRequestTracker{
32 > pendingTaskKeys: outstandingTaskKeys,
33 > }
34 }
35
92 func (t *taskRequestTracker) minTaskKey(
93 category tasks.Category,
94 > ) (tasks.Key, bool) { task_request_tracker.go
95 > t.Lock()
96 > defer t.Unlock()
97 >
98 > pendingTasksForCategory := t.pendingTaskKeys[category]
99 > if len(pendingTasksForCategory) == 0 {
100 > return tasks.MinimumKey, false task_request_tracker.go
101 > }
102
103 minKey := tasks.MaximumKey
115 // otherwise inflight request can fails as those requests are conditioned on
116 // the current rangeID
117 > func (t *taskRequestTracker) drain() { task_request_tracker.go
118 > t.Lock()
119 >
120 > if t.inflightRequestCount == 0 {
121 > t.Unlock()
122 > return
123 > }
124
125 waitCh := make(chan struct{})
130 }
131
132 > func (t *taskRequestTracker) clear() { task_request_tracker.go
133 > t.Lock()
134 > defer t.Unlock()
135 >
136 > for category := range t.pendingTaskKeys {
137 > t.pendingTaskKeys[category] = make(map[tasks.Key]struct{})
138 > }
139 > t.inflightRequestCount = 0
140 > t.closeWaitChannelsLocked()
141 }
142
143 > func (t *taskRequestTracker) closeWaitChannelsLocked() { task_request_tracker.go
144 > for _, waitCh := range t.waitChannels {
145 close(waitCh)
146 }
147 > t.waitChannels = nil task_request_tracker.go
148 }
go.temporal.io/server/api/persistence/v1/chasm.pb.go 33 covered LOC · 1 range

Open complete file

1180 }
1181
1182 > func init() { file_temporal_server_api_persistence_v1_chasm_proto_init() } chasm.pb.go
1183 > func file_temporal_server_api_persistence_v1_chasm_proto_init() {
1184 > if File_temporal_server_api_persistence_v1_chasm_proto != nil {
1185 > return
1186 > }
1187 > file_temporal_server_api_persistence_v1_hsm_proto_init()
1188 > file_temporal_server_api_persistence_v1_chasm_proto_msgTypes[1].OneofWrappers = []any{
1189 > (*ChasmNodeMetadata_ComponentAttributes)(nil),
1190 > (*ChasmNodeMetadata_DataAttributes)(nil),
1191 > (*ChasmNodeMetadata_CollectionAttributes)(nil),
1192 > (*ChasmNodeMetadata_PointerAttributes)(nil),
1193 > }
1194 > file_temporal_server_api_persistence_v1_chasm_proto_msgTypes[10].OneofWrappers = []any{
1195 > (*ChasmNexusCompletion_Success)(nil),
1196 > (*ChasmNexusCompletion_Failure)(nil),
1197 > }
1198 > type x struct{}
1199 > out := protoimpl.TypeBuilder{
1200 > File: protoimpl.DescBuilder{
1201 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
1202 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_chasm_proto_rawDesc), len(file_temporal_server_api_persistence_v1_chasm_proto_rawDesc)),
1203 > NumEnums: 0,
1204 > NumMessages: 15,
1205 > NumExtensions: 0,
1206 > NumServices: 0,
1207 > },
1208 > GoTypes: file_temporal_server_api_persistence_v1_chasm_proto_goTypes,
1209 > DependencyIndexes: file_temporal_server_api_persistence_v1_chasm_proto_depIdxs,
1210 > MessageInfos: file_temporal_server_api_persistence_v1_chasm_proto_msgTypes,
1211 > }.Build()
1212 > File_temporal_server_api_persistence_v1_chasm_proto = out.File
1213 > file_temporal_server_api_persistence_v1_chasm_proto_goTypes = nil
1214 > file_temporal_server_api_persistence_v1_chasm_proto_depIdxs = nil
1215 }
go.temporal.io/server/common/cache/lru.go 33 covered LOC · 8 ranges

Open complete file

135
136 // New creates a new cache with the given options
137 > func New(maxSize int, opts *Options) StoppableCache { lru.go
138 > return NewWithMetrics(maxSize, opts, metrics.NoopMetricsHandler)
139 > }
140
141 // NewWithMetrics creates a new cache that will emit capacity and ttl metrics.
142 // handler should be tagged with metrics.CacheTypeTag.
143 > func NewWithMetrics(maxSize int, opts *Options, handler metrics.Handler) StoppableCache { lru.go
144 > if opts == nil {
145 opts = &Options{}
146 }
147
148 > backgroundEvict := opts.BackgroundEvict lru.go
149 > if backgroundEvict == nil {
150 > backgroundEvict = func() dynamicconfig.CacheBackgroundEvictSettings { lru.go
151 > return dynamicconfig.CacheBackgroundEvictSettings{
152 > Enabled: false,
153 > }
154 > }
155 }
156
157 > timeSource := opts.TimeSource lru.go
158 > if timeSource == nil {
159 > timeSource = clock.NewRealTimeSource() lru.go
160 > }
161
162 > metrics.CacheSize.With(handler).Record(float64(maxSize)) lru.go
163 > metrics.CacheTtl.With(handler).Record(opts.TTL)
164 > c := &lru{
165 > byAccess: list.New(),
166 > byKey: make(map[any]*list.Element),
167 > ttl: opts.TTL,
168 > maxSize: maxSize,
169 > currSize: 0,
170 > pin: opts.Pin,
171 > onPut: opts.OnPut,
172 > onEvict: opts.OnEvict,
173 > timeSource: timeSource,
174 > metricsHandler: handler,
175 > backgroundEvict: backgroundEvict,
176 > }
177 > if c.backgroundEvict().Enabled {
178 c.loops.Go(c.bgEvictLoop)
179 }
180 > return c lru.go
181 }
182
go.temporal.io/server/api/persistence/v1/hsm.pb.go 32 covered LOC · 1 range

Open complete file

895 }
896
897 > func init() { file_temporal_server_api_persistence_v1_hsm_proto_init() } hsm.pb.go
898 > func file_temporal_server_api_persistence_v1_hsm_proto_init() {
899 > if File_temporal_server_api_persistence_v1_hsm_proto != nil {
900 > return
901 > }
902 > file_temporal_server_api_persistence_v1_hsm_proto_msgTypes[8].OneofWrappers = []any{
903 > (*StateMachineTombstone_ActivityScheduledEventId)(nil),
904 > (*StateMachineTombstone_TimerId)(nil),
905 > (*StateMachineTombstone_ChildExecutionInitiatedEventId)(nil),
906 > (*StateMachineTombstone_RequestCancelInitiatedEventId)(nil),
907 > (*StateMachineTombstone_SignalExternalInitiatedEventId)(nil),
908 > (*StateMachineTombstone_UpdateId)(nil),
909 > (*StateMachineTombstone_StateMachinePath)(nil),
910 > (*StateMachineTombstone_ChasmNodePath)(nil),
911 > }
912 > type x struct{}
913 > out := protoimpl.TypeBuilder{
914 > File: protoimpl.DescBuilder{
915 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
916 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_hsm_proto_rawDesc), len(file_temporal_server_api_persistence_v1_hsm_proto_rawDesc)),
917 > NumEnums: 0,
918 > NumMessages: 12,
919 > NumExtensions: 0,
920 > NumServices: 0,
921 > },
922 > GoTypes: file_temporal_server_api_persistence_v1_hsm_proto_goTypes,
923 > DependencyIndexes: file_temporal_server_api_persistence_v1_hsm_proto_depIdxs,
924 > MessageInfos: file_temporal_server_api_persistence_v1_hsm_proto_msgTypes,
925 > }.Build()
926 > File_temporal_server_api_persistence_v1_hsm_proto = out.File
927 > file_temporal_server_api_persistence_v1_hsm_proto_goTypes = nil
928 > file_temporal_server_api_persistence_v1_hsm_proto_depIdxs = nil
929 }
go.temporal.io/server/common/future/future_impl.go 32 covered LOC · 8 ranges

Open complete file

29 )
30
31 > func NewFuture[T any]() *FutureImpl[T] { future_impl.go
32 > var value T
33 > return &FutureImpl[T]{
34 > status: pending,
35 > readyCh: make(chan struct{}),
36 >
37 > value: value,
38 > err: nil,
39 > }
40 > }
41
42 func (f *FutureImpl[T]) Get(
43 ctx context.Context,
44 > ) (T, error) { future_impl.go
45 > if f.Ready() {
46 > return f.value, f.err future_impl.go
47 > }
48
49 > select { future_impl.go
50 > case <-f.readyCh: future_impl.go
51 > return f.value, f.err
52 case <-ctx.Done():
53 var value T
67 value T,
68 err error,
69 > ) { future_impl.go
70 > // cannot directly set status to `ready`, to prevent data race in case multiple `Get` occurs
71 > // instead set status to `setting` to prevent concurrent completion of this future
72 > if !atomic.CompareAndSwapInt32(
73 > &f.status,
74 > pending,
75 > setting,
76 > ) {
77 panic("future has already been completed")
78 }
79
80 > f.value = value future_impl.go
81 > f.err = err
82 > atomic.CompareAndSwapInt32(&f.status, setting, ready)
83 > close(f.readyCh)
84 }
85
104 }
105
106 > func (f *FutureImpl[T]) Ready() bool { future_impl.go
107 > return atomic.LoadInt32(&f.status) == ready
108 > }
go.temporal.io/server/service/history/interfaces/engine_mock.go 32 covered LOC · 8 ranges

Open complete file

45
46 // NewMockEngine creates a new mock instance.
47 > func NewMockEngine(ctrl *gomock.Controller) *MockEngine { engine_mock.go
48 > mock := &MockEngine{ctrl: ctrl}
49 > mock.recorder = &MockEngineMockRecorder{mock}
50 > return mock
51 > }
52
53 // EXPECT returns an object that allows the caller to indicate expected use.
54 > func (m *MockEngine) EXPECT() *MockEngineMockRecorder { engine_mock.go
55 > return m.recorder
56 > }
57
58 // AddTasks mocks base method.
440
441 // NotifyNewTasks mocks base method.
442 > func (m *MockEngine) NotifyNewTasks(arg0 map[tasks.Category][]tasks.Task) { engine_mock.go
443 > m.ctrl.T.Helper()
444 > m.ctrl.Call(m, "NotifyNewTasks", arg0)
445 > }
446
447 // NotifyNewTasks indicates an expected call of NotifyNewTasks.
448 > func (mr *MockEngineMockRecorder) NotifyNewTasks(arg0 any) *gomock.Call { engine_mock.go
449 > mr.mock.ctrl.T.Helper()
450 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifyNewTasks", reflect.TypeOf((*MockEngine)(nil).NotifyNewTasks), arg0)
451 > }
452
453 // PauseActivity mocks base method.
893
894 // Start mocks base method.
895 > func (m *MockEngine) Start() { engine_mock.go
896 > m.ctrl.T.Helper()
897 > m.ctrl.Call(m, "Start")
898 > }
899
900 // Start indicates an expected call of Start.
901 > func (mr *MockEngineMockRecorder) Start() *gomock.Call { engine_mock.go
902 > mr.mock.ctrl.T.Helper()
903 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Start", reflect.TypeOf((*MockEngine)(nil).Start))
904 > }
905
906 // StartWorkflowExecution mocks base method.
934
935 // Stop mocks base method.
936 > func (m *MockEngine) Stop() { engine_mock.go
937 > m.ctrl.T.Helper()
938 > m.ctrl.Call(m, "Stop")
939 > }
940
941 // Stop indicates an expected call of Stop.
942 > func (mr *MockEngineMockRecorder) Stop() *gomock.Call { engine_mock.go
943 > mr.mock.ctrl.T.Helper()
944 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Stop", reflect.TypeOf((*MockEngine)(nil).Stop))
945 > }
946
947 // SubscribeReplicationNotification mocks base method.
go.temporal.io/server/api/persistence/v1/update.pb.go 31 covered LOC · 1 range

Open complete file

422 }
423
424 > func init() { file_temporal_server_api_persistence_v1_update_proto_init() } update.pb.go
425 > func file_temporal_server_api_persistence_v1_update_proto_init() {
426 > if File_temporal_server_api_persistence_v1_update_proto != nil {
427 > return
428 > }
429 > file_temporal_server_api_persistence_v1_hsm_proto_init()
430 > file_temporal_server_api_persistence_v1_update_proto_msgTypes[0].OneofWrappers = []any{
431 > (*UpdateAdmissionInfo_HistoryPointer_)(nil),
432 > }
433 > file_temporal_server_api_persistence_v1_update_proto_msgTypes[3].OneofWrappers = []any{
434 > (*UpdateInfo_Acceptance)(nil),
435 > (*UpdateInfo_Completion)(nil),
436 > (*UpdateInfo_Admission)(nil),
437 > }
438 > type x struct{}
439 > out := protoimpl.TypeBuilder{
440 > File: protoimpl.DescBuilder{
441 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
442 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_update_proto_rawDesc), len(file_temporal_server_api_persistence_v1_update_proto_rawDesc)),
443 > NumEnums: 0,
444 > NumMessages: 5,
445 > NumExtensions: 0,
446 > NumServices: 0,
447 > },
448 > GoTypes: file_temporal_server_api_persistence_v1_update_proto_goTypes,
449 > DependencyIndexes: file_temporal_server_api_persistence_v1_update_proto_depIdxs,
450 > MessageInfos: file_temporal_server_api_persistence_v1_update_proto_msgTypes,
451 > }.Build()
452 > File_temporal_server_api_persistence_v1_update_proto = out.File
453 > file_temporal_server_api_persistence_v1_update_proto_goTypes = nil
454 > file_temporal_server_api_persistence_v1_update_proto_depIdxs = nil
455 }
go.temporal.io/server/common/dynamicconfig/deepcopy.go 31 covered LOC · 6 ranges

Open complete file

9 // deepCopyForMapstructure does a simple deep copy of T. Fancy cases (anything other than plain old data)
10 // is not handled and will panic.
11 > func deepCopyForMapstructure[T any](t T) T { deepcopy.go
12 > // nolint:revive // this will be triggered from a static initializer before it can be triggered from production code
13 > return deepCopyValue(reflect.ValueOf(t)).Interface().(T)
14 > }
15
16 > func deepCopyValue(v reflect.Value) reflect.Value { deepcopy.go
17 > switch v.Kind() {
18 case reflect.Bool, reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,
19 reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64,
20 > reflect.Uintptr, reflect.Float32, reflect.Float64, reflect.String: deepcopy.go
21 > nv := reflect.New(v.Type()).Elem()
22 > nv.Set(v)
23 > return nv
24 case reflect.Array:
25 nv := reflect.New(v.Type()).Elem()
42 }
43 return deepCopyValue(v.Elem()).Addr()
44 > case reflect.Slice: deepcopy.go
45 > if v.IsNil() {
46 > return v
47 > }
48 nv := reflect.MakeSlice(v.Type(), v.Len(), v.Len())
49 for i := range v.Len() {
51 }
52 return nv
53 > case reflect.Struct: deepcopy.go
54 > // Special case for time.Time: it has unexported fields so we can't copy it field by
55 > // field, but we can copy zero values (which is all we need for default values).
56 > if v.Type() == reflect.TypeFor[time.Time]() {
57 > if v.Interface().(time.Time).IsZero() {
58 > return reflect.ValueOf(time.Time{})
59 > }
60 // nolint:forbidigo // this will be triggered from a static initializer before it can be triggered from production code
61 panic(fmt.Sprintf("Can't deep copy non-zero time.Time: %v", v.Interface()))
62 }
63 > nv := reflect.New(v.Type()).Elem() deepcopy.go
64 > for i := range v.Type().NumField() {
65 > nv.Field(i).Set(deepCopyValue(v.Field(i)))
66 > }
67 > return nv
68 > case reflect.Interface, reflect.Func, reflect.Chan:
69 > // only nil values of any other reference types allowed!
70 > if v.IsNil() {
71 > return v
72 > }
73 fallthrough
74 default:
go.temporal.io/server/common/persistence/sql/sqlplugin/mysql/execution_maps.go 30 covered LOC · 5 ranges

Open complete file

53 )
54
55 > func stringMap(a []string, f func(string) string) []string { execution_maps.go
56 > b := make([]string, len(a))
57 > for i, v := range a {
58 > b[i] = f(v)
59 > }
60 > return b
61 }
62
63 > func makeDeleteMapQry(tableName string) string { execution_maps.go
64 > return fmt.Sprintf(deleteMapQryTemplate, tableName)
65 > }
66
67 > func makeSetKeyInMapQry(tableName string, nonPrimaryKeyColumns []string, mapKeyName string) string { execution_maps.go
68 > return fmt.Sprintf(setKeyInMapQryTemplate,
69 > tableName,
70 > strings.Join(nonPrimaryKeyColumns, ","),
71 > strings.Join(stringMap(nonPrimaryKeyColumns, func(x string) string {
72 > return ":" + x
73 > }), ","),
74 > strings.Join(stringMap(nonPrimaryKeyColumns, func(x string) string {
75 > return x + "=VALUES(" + x + ")"
76 > }), ","),
77 mapKeyName)
78 }
79
80 > func makeDeleteKeyInMapQry(tableName string, mapKeyName string) string { execution_maps.go
81 > return fmt.Sprintf(deleteKeyInMapQryTemplate,
82 > tableName,
83 > mapKeyName)
84 > }
85
86 > func makeGetMapQryTemplate(tableName string, nonPrimaryKeyColumns []string, mapKeyName string) string { execution_maps.go
87 > return fmt.Sprintf(getMapQryTemplate,
88 > tableName,
89 > mapKeyName,
90 > strings.Join(nonPrimaryKeyColumns, ","))
91 > }
92
93 var (
go.temporal.io/server/common/persistence/sql/sqlplugin/postgresql/execution_maps.go 30 covered LOC · 6 ranges

Open complete file

86 )
87
88 > func stringMap(a []string, f func(string) string) []string { execution_maps.go
89 > b := make([]string, len(a))
90 > for i, v := range a {
91 > b[i] = f(v)
92 > }
93 > return b
94 }
95
96 > func makeDeleteMapQry(tableName string) string { execution_maps.go
97 > return fmt.Sprintf(deleteMapQueryTemplate, tableName)
98 > }
99
100 > func makeSetKeyInMapQry(tableName string, nonPrimaryKeyColumns []string, mapKeyName string) string { execution_maps.go
101 > return fmt.Sprintf(setKeyInMapQueryTemplate,
102 > tableName,
103 > strings.Join(nonPrimaryKeyColumns, ","),
104 > strings.Join(stringMap(nonPrimaryKeyColumns, func(x string) string {
105 > return ":" + x
106 > }), ","),
107 mapKeyName,
108 > strings.Join(stringMap(nonPrimaryKeyColumns, func(x string) string { execution_maps.go
109 > return "excluded." + x
110 > }), ","))
111 }
112
113 > func makeDeleteKeyInMapQry(tableName string, mapKeyName string) string { execution_maps.go
114 > return fmt.Sprintf(deleteKeyInMapQueryTemplate,
115 > tableName,
116 > mapKeyName)
117 > }
118
119 > func makeGetMapQryTemplate(tableName string, nonPrimaryKeyColumns []string, mapKeyName string) string { execution_maps.go
120 > return fmt.Sprintf(getMapQueryTemplate,
121 > tableName,
122 > mapKeyName,
123 > strings.Join(nonPrimaryKeyColumns, ","))
124 > }
125
126 var (
go.temporal.io/server/common/persistence/sql/sqlplugin/sqlite/execution_maps.go 30 covered LOC · 5 ranges

Open complete file

52 )
53
54 > func stringMap(a []string, f func(string) string) []string { execution_maps.go
55 > b := make([]string, len(a))
56 > for i, v := range a {
57 > b[i] = f(v)
58 > }
59 > return b
60 }
61
62 > func makeDeleteMapQry(tableName string) string { execution_maps.go
63 > return fmt.Sprintf(deleteMapQryTemplate, tableName)
64 > }
65
66 > func makeSetKeyInMapQry(tableName string, nonPrimaryKeyColumns []string, mapKeyName string) string { execution_maps.go
67 > return fmt.Sprintf(setKeyInMapQryTemplate,
68 > tableName,
69 > strings.Join(nonPrimaryKeyColumns, ","),
70 > strings.Join(stringMap(nonPrimaryKeyColumns, func(x string) string {
71 > return ":" + x
72 > }), ","),
73 > strings.Join(stringMap(nonPrimaryKeyColumns, func(x string) string {
74 > return x + "=" + x
75 > }), ","),
76 mapKeyName)
77 }
78
79 > func makeDeleteKeyInMapQry(tableName string, mapKeyName string) string { execution_maps.go
80 > return fmt.Sprintf(deleteKeyInMapQryTemplate,
81 > tableName,
82 > mapKeyName)
83 > }
84
85 > func makeGetMapQryTemplate(tableName string, nonPrimaryKeyColumns []string, mapKeyName string) string { execution_maps.go
86 > return fmt.Sprintf(getMapQryTemplate,
87 > tableName,
88 > mapKeyName,
89 > strings.Join(nonPrimaryKeyColumns, ","))
90 > }
91
92 var (
go.temporal.io/server/common/searchattribute/sadefs/constants.go 30 covered LOC · 9 ranges

Open complete file

261 }
262
263 > dbCustomSearchAttributeFieldNameRE = func() map[enumspb.IndexedValueType]*regexp.Regexp { constants.go
264 > res := map[enumspb.IndexedValueType]*regexp.Regexp{}
265 > for t := range defaultNumDBCustomSearchAttributes {
266 > res[t] = regexp.MustCompile(fmt.Sprintf(`^%s(0[1-9]|[1-9][0-9])$`, t.String()))
267 > }
268 > return res
269 }()
270 )
271
272 // System returns a clone of the system search attributes map.
273 > func System() map[string]enumspb.IndexedValueType { constants.go
274 > return maps.Clone(system)
275 > }
276
277 // Predefined returns a clone of the predefined search attributes map.
278 > func Predefined() map[string]enumspb.IndexedValueType { constants.go
279 > return maps.Clone(predefined)
280 > }
281
282 // PredefinedWhiteList returns a clone of the predefined whitelist search attributes map.
283 > func PredefinedWhiteList() map[string]enumspb.IndexedValueType { constants.go
284 > return maps.Clone(predefinedWhiteList)
285 > }
286
287 // Reserved returns a clone of the reserved field names map.
343 // GetSqlDbColName maps system and reserved search attributes to column names for SQL tables.
344 // If the input is not a system or reserved search attribute, then it returns the input.
345 > func GetSqlDbColName(name string) string { constants.go
346 > if fieldName, ok := sqlDbSystemNameToColName[name]; ok {
347 > return fieldName constants.go
348 > }
349 return name
350 }
352 func GetDBIndexSearchAttributes(
353 override map[enumspb.IndexedValueType]int,
354 > ) *persistencespb.IndexSearchAttributes { constants.go
355 > csa := map[string]enumspb.IndexedValueType{}
356 > for saType, defaultNumAttrs := range defaultNumDBCustomSearchAttributes {
357 > numAttrs := defaultNumAttrs
358 > if value, ok := override[saType]; ok {
359 numAttrs = value
360 }
361 > for i := range numAttrs { constants.go
362 > csa[fmt.Sprintf("%s%02d", saType.String(), i+1)] = saType
363 > }
364 }
365 > return &persistencespb.IndexSearchAttributes{ constants.go
366 > CustomSearchAttributes: csa,
367 > }
368 }
369
go.temporal.io/server/api/taskqueue/v1/message.pb.go 29 covered LOC · 2 ranges

Open complete file

1330 }
1331
1332 > func init() { file_temporal_server_api_taskqueue_v1_message_proto_init() } message.pb.go
1333 > func file_temporal_server_api_taskqueue_v1_message_proto_init() {
1334 > if File_temporal_server_api_taskqueue_v1_message_proto != nil {
1335 return
1336 }
1337 > file_temporal_server_api_taskqueue_v1_message_proto_msgTypes[0].OneofWrappers = []any{ message.pb.go
1338 > (*TaskVersionDirective_UseAssignmentRules)(nil),
1339 > (*TaskVersionDirective_AssignedBuildId)(nil),
1340 > }
1341 > file_temporal_server_api_taskqueue_v1_message_proto_msgTypes[5].OneofWrappers = []any{
1342 > (*TaskQueuePartition_NormalPartitionId)(nil),
1343 > (*TaskQueuePartition_StickyName)(nil),
1344 > (*TaskQueuePartition_WorkerCommands)(nil),
1345 > }
1346 > type x struct{}
1347 > out := protoimpl.TypeBuilder{
1348 > File: protoimpl.DescBuilder{
1349 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
1350 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_taskqueue_v1_message_proto_rawDesc), len(file_temporal_server_api_taskqueue_v1_message_proto_rawDesc)),
1351 > NumEnums: 0,
1352 > NumMessages: 16,
1353 > NumExtensions: 0,
1354 > NumServices: 0,
1355 > },
1356 > GoTypes: file_temporal_server_api_taskqueue_v1_message_proto_goTypes,
1357 > DependencyIndexes: file_temporal_server_api_taskqueue_v1_message_proto_depIdxs,
1358 > MessageInfos: file_temporal_server_api_taskqueue_v1_message_proto_msgTypes,
1359 > }.Build()
1360 > File_temporal_server_api_taskqueue_v1_message_proto = out.File
1361 > file_temporal_server_api_taskqueue_v1_message_proto_goTypes = nil
1362 > file_temporal_server_api_taskqueue_v1_message_proto_depIdxs = nil
1363 }
go.temporal.io/server/client/client_bean_mock.go 28 covered LOC · 7 ranges

Open complete file

34
35 // NewMockBean creates a new mock instance.
36 > func NewMockBean(ctrl *gomock.Controller) *MockBean { client_bean_mock.go
37 > mock := &MockBean{ctrl: ctrl}
38 > mock.recorder = &MockBeanMockRecorder{mock}
39 > return mock
40 > }
41
42 // EXPECT returns an object that allows the caller to indicate expected use.
43 > func (m *MockBean) EXPECT() *MockBeanMockRecorder { client_bean_mock.go
44 > return m.recorder
45 > }
46
47 // Close mocks base method.
66
67 // GetFrontendClient indicates an expected call of GetFrontendClient.
68 > func (mr *MockBeanMockRecorder) GetFrontendClient() *gomock.Call { client_bean_mock.go
69 > mr.mock.ctrl.T.Helper()
70 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetFrontendClient", reflect.TypeOf((*MockBean)(nil).GetFrontendClient))
71 > }
72
73 // GetHistoryClient mocks base method.
80
81 // GetHistoryClient indicates an expected call of GetHistoryClient.
82 > func (mr *MockBeanMockRecorder) GetHistoryClient() *gomock.Call { client_bean_mock.go
83 > mr.mock.ctrl.T.Helper()
84 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetHistoryClient", reflect.TypeOf((*MockBean)(nil).GetHistoryClient))
85 > }
86
87 // GetMatchingClient mocks base method.
95
96 // GetMatchingClient indicates an expected call of GetMatchingClient.
97 > func (mr *MockBeanMockRecorder) GetMatchingClient(namespaceIDToName any) *gomock.Call { client_bean_mock.go
98 > mr.mock.ctrl.T.Helper()
99 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMatchingClient", reflect.TypeOf((*MockBean)(nil).GetMatchingClient), namespaceIDToName)
100 > }
101
102 // GetRemoteAdminClient mocks base method.
110
111 // GetRemoteAdminClient indicates an expected call of GetRemoteAdminClient.
112 > func (mr *MockBeanMockRecorder) GetRemoteAdminClient(arg0 any) *gomock.Call { client_bean_mock.go
113 > mr.mock.ctrl.T.Helper()
114 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRemoteAdminClient", reflect.TypeOf((*MockBean)(nil).GetRemoteAdminClient), arg0)
115 > }
116
117 // GetRemoteFrontendClient mocks base method.
126
127 // GetRemoteFrontendClient indicates an expected call of GetRemoteFrontendClient.
128 > func (mr *MockBeanMockRecorder) GetRemoteFrontendClient(arg0 any) *gomock.Call { client_bean_mock.go
129 > mr.mock.ctrl.T.Helper()
130 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRemoteFrontendClient", reflect.TypeOf((*MockBean)(nil).GetRemoteFrontendClient), arg0)
131 > }
go.temporal.io/server/common/cluster/metadata_mock.go 28 covered LOC · 6 ranges

Open complete file

30
31 // NewMockMetadata creates a new mock instance.
32 > func NewMockMetadata(ctrl *gomock.Controller) *MockMetadata { metadata_mock.go
33 > mock := &MockMetadata{ctrl: ctrl}
34 > mock.recorder = &MockMetadataMockRecorder{mock}
35 > return mock
36 > }
37
38 // EXPECT returns an object that allows the caller to indicate expected use.
39 > func (m *MockMetadata) EXPECT() *MockMetadataMockRecorder { metadata_mock.go
40 > return m.recorder
41 > }
42
43 // ClusterNameForFailoverVersion mocks base method.
56
57 // GetAllClusterInfo mocks base method.
58 > func (m *MockMetadata) GetAllClusterInfo() map[string]ClusterInformation { metadata_mock.go
59 > m.ctrl.T.Helper()
60 > ret := m.ctrl.Call(m, "GetAllClusterInfo")
61 > ret0, _ := ret[0].(map[string]ClusterInformation)
62 > return ret0
63 > }
64
65 // GetAllClusterInfo indicates an expected call of GetAllClusterInfo.
66 > func (mr *MockMetadataMockRecorder) GetAllClusterInfo() *gomock.Call { metadata_mock.go
67 > mr.mock.ctrl.T.Helper()
68 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllClusterInfo", reflect.TypeOf((*MockMetadata)(nil).GetAllClusterInfo))
69 > }
70
71 // GetClusterID mocks base method.
84
85 // GetCurrentClusterName mocks base method.
86 > func (m *MockMetadata) GetCurrentClusterName() string { metadata_mock.go
87 > m.ctrl.T.Helper()
88 > ret := m.ctrl.Call(m, "GetCurrentClusterName")
89 > ret0, _ := ret[0].(string)
90 > return ret0
91 > }
92
93 // GetCurrentClusterName indicates an expected call of GetCurrentClusterName.
94 > func (mr *MockMetadataMockRecorder) GetCurrentClusterName() *gomock.Call { metadata_mock.go
95 > mr.mock.ctrl.T.Helper()
96 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCurrentClusterName", reflect.TypeOf((*MockMetadata)(nil).GetCurrentClusterName))
97 > }
98
99 // GetFailoverVersionIncrement mocks base method.
go.temporal.io/server/service/history/shard/task_key_generator.go 26 covered LOC · 5 ranges

Open complete file

39 logger log.Logger,
40 renewRangeIDFn renewRangeIDFn,
41 > ) *taskKeyGenerator { task_key_generator.go
42 > return &taskKeyGenerator{
43 > nextTaskID: taskIDUninitialized,
44 > exclusiveMaxTaskID: taskIDUninitialized,
45 > rangeSizeBits: rangeSizeBits,
46 > timeSource: timeSource,
47 > logger: logger,
48 > renewRangeIDFn: renewRangeIDFn,
49 > }
50 > }
51
52 func (a *taskKeyGenerator) setTaskKeys(
114 func (a *taskKeyGenerator) peekTaskKey(
115 category tasks.Category,
116 > ) tasks.Key { task_key_generator.go
117 > switch category.Type() {
118 > case tasks.CategoryTypeImmediate: task_key_generator.go
119 > return tasks.NewImmediateKey(a.nextTaskID)
120 case tasks.CategoryTypeScheduled:
121 return tasks.NewKey(
149 }
150
151 > func (a *taskKeyGenerator) setRangeID(rangeID int64) { task_key_generator.go
152 > a.nextTaskID = rangeID << a.rangeSizeBits
153 > a.exclusiveMaxTaskID = (rangeID + 1) << a.rangeSizeBits
154 >
155 > a.logger.Info("Task key range updated",
156 > tag.Number(a.nextTaskID),
157 > tag.NextNumber(a.exclusiveMaxTaskID),
158 > )
159 > }
160
161 func (a *taskKeyGenerator) setTaskMinScheduledTime(
162 taskMinScheduledTime time.Time,
164 > a.taskMinScheduledTime = util.MaxTime(a.taskMinScheduledTime, taskMinScheduledTime)
165 > }
166
167 func (a *taskKeyGenerator) generateTaskID() (int64, error) {
go.temporal.io/server/chasm/lib/nexusoperation/gen/nexusoperationpb/v1/operation.pb.go 25 covered LOC · 2 ranges

Open complete file

998 }
999
1000 > func init() { file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_init() } operation.pb.go
1001 > func file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_init() {
1002 > if File_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto != nil {
1003 return
1004 }
1005 > file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_msgTypes[2].OneofWrappers = []any{ operation.pb.go
1006 > (*OperationOutcome_Successful_)(nil),
1007 > (*OperationOutcome_Failed_)(nil),
1008 > }
1009 > type x struct{}
1010 > out := protoimpl.TypeBuilder{
1011 > File: protoimpl.DescBuilder{
1012 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
1013 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_rawDesc), len(file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_rawDesc)),
1014 > NumEnums: 2,
1015 > NumMessages: 8,
1016 > NumExtensions: 0,
1017 > NumServices: 0,
1018 > },
1019 > GoTypes: file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_goTypes,
1020 > DependencyIndexes: file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_depIdxs,
1021 > EnumInfos: file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_enumTypes,
1022 > MessageInfos: file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_msgTypes,
1023 > }.Build()
1024 > File_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto = out.File
1025 > file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_goTypes = nil
1026 > file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_depIdxs = nil
1027 }
go.temporal.io/server/common/routing/route.go 25 covered LOC · 8 ranges

Open complete file

36
37 // NewRoute returns a new [Route] instance with the given components.
38 > func NewRoute[T any](components ...Component[T]) Route[T] { route.go
39 > return Route[T]{components: components}
40 > }
41
42 // RouteBuilder is a builder for the [Route] interface.
46
47 // NewBuilder creates a new [RouteBuilder] instance, which can be used to define a new [Route] via a fluent API.
48 > func NewBuilder[T any]() *RouteBuilder[T] { route.go
49 > return &RouteBuilder[T]{}
50 > }
51
52 // With adds a series of [Component] instances to the [Route].
53 > func (r *RouteBuilder[T]) With(c ...Component[T]) *RouteBuilder[T] { route.go
54 > r.components = append(r.components, c...)
55 > return r
56 > }
57
58 // Constant adds a [Constant] component to the [Route].
59 > func (r *RouteBuilder[T]) Constant(values ...string) *RouteBuilder[T] { route.go
60 > return r.With(Constant[T](values...))
61 > }
62
63 // StringVariable adds a [StringVariable] component to the [Route].
64 > func (r *RouteBuilder[T]) StringVariable(name string, getter func(*T) *string) *RouteBuilder[T] { route.go
65 > return r.With(StringVariable[T](name, getter))
66 > }
67
68 // Build returns a read-only [Route].
69 > func (r *RouteBuilder[T]) Build() Route[T] { route.go
70 > return NewRoute[T](r.components...)
71 > }
72
73 // Representation returns the [github.com/gorilla/mux] compatible string representation of the route for usage in a
111 // Constant returns a [Component] that represents a series of constant HTTP path components in a Route.
112 // They will be joined via strings when used to construct a path or path representation.
113 > func Constant[T any](values ...string) constant[T] { route.go
114 > return values
115 > }
116
117 type constant[T any] []string
128
129 // StringVariable returns a [Component] that represents a string variable in a Route.
130 > func StringVariable[T any](name string, getter func(*T) *string) stringVariable[T] { route.go
131 > return stringVariable[T]{name, getter}
132 > }
133
134 type stringVariable[T any] struct {
go.temporal.io/server/api/persistence/v1/nexus.pb.go 24 covered LOC · 2 ranges

Open complete file

481 }
482
483 > func init() { file_temporal_server_api_persistence_v1_nexus_proto_init() } nexus.pb.go
484 > func file_temporal_server_api_persistence_v1_nexus_proto_init() {
485 > if File_temporal_server_api_persistence_v1_nexus_proto != nil {
486 return
487 }
488 > file_temporal_server_api_persistence_v1_nexus_proto_msgTypes[1].OneofWrappers = []any{ nexus.pb.go
489 > (*NexusEndpointTarget_Worker_)(nil),
490 > (*NexusEndpointTarget_External_)(nil),
491 > }
492 > type x struct{}
493 > out := protoimpl.TypeBuilder{
494 > File: protoimpl.DescBuilder{
495 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
496 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_nexus_proto_rawDesc), len(file_temporal_server_api_persistence_v1_nexus_proto_rawDesc)),
497 > NumEnums: 0,
498 > NumMessages: 6,
499 > NumExtensions: 0,
500 > NumServices: 0,
501 > },
502 > GoTypes: file_temporal_server_api_persistence_v1_nexus_proto_goTypes,
503 > DependencyIndexes: file_temporal_server_api_persistence_v1_nexus_proto_depIdxs,
504 > MessageInfos: file_temporal_server_api_persistence_v1_nexus_proto_msgTypes,
505 > }.Build()
506 > File_temporal_server_api_persistence_v1_nexus_proto = out.File
507 > file_temporal_server_api_persistence_v1_nexus_proto_goTypes = nil
508 > file_temporal_server_api_persistence_v1_nexus_proto_depIdxs = nil
509 }
go.temporal.io/server/api/persistence/v1/workflow_mutable_state.pb.go 24 covered LOC · 2 ranges

Open complete file

532 }
533
534 > func init() { file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_init() } workflow_mutable_state.pb.go
535 > func file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_init() {
536 > if File_temporal_server_api_persistence_v1_workflow_mutable_state_proto != nil {
537 return
538 }
539 > file_temporal_server_api_persistence_v1_chasm_proto_init() workflow_mutable_state.pb.go
540 > file_temporal_server_api_persistence_v1_executions_proto_init()
541 > file_temporal_server_api_persistence_v1_hsm_proto_init()
542 > file_temporal_server_api_persistence_v1_update_proto_init()
543 > type x struct{}
544 > out := protoimpl.TypeBuilder{
545 > File: protoimpl.DescBuilder{
546 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
547 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_rawDesc), len(file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_rawDesc)),
548 > NumEnums: 0,
549 > NumMessages: 16,
550 > NumExtensions: 0,
551 > NumServices: 0,
552 > },
553 > GoTypes: file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_goTypes,
554 > DependencyIndexes: file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_depIdxs,
555 > MessageInfos: file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_msgTypes,
556 > }.Build()
557 > File_temporal_server_api_persistence_v1_workflow_mutable_state_proto = out.File
558 > file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_goTypes = nil
559 > file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_depIdxs = nil
560 }
go.temporal.io/server/chasm/lib/callback/gen/callbackpb/v1/message.pb.go 24 covered LOC · 2 ranges

Open complete file

462 }
463
464 > func init() { file_temporal_server_chasm_lib_callback_proto_v1_message_proto_init() } message.pb.go
465 > func file_temporal_server_chasm_lib_callback_proto_v1_message_proto_init() {
466 > if File_temporal_server_chasm_lib_callback_proto_v1_message_proto != nil {
467 return
468 }
469 > file_temporal_server_chasm_lib_callback_proto_v1_message_proto_msgTypes[1].OneofWrappers = []any{ message.pb.go
470 > (*Callback_Nexus_)(nil),
471 > }
472 > type x struct{}
473 > out := protoimpl.TypeBuilder{
474 > File: protoimpl.DescBuilder{
475 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
476 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_callback_proto_v1_message_proto_rawDesc), len(file_temporal_server_chasm_lib_callback_proto_v1_message_proto_rawDesc)),
477 > NumEnums: 1,
478 > NumMessages: 5,
479 > NumExtensions: 0,
480 > NumServices: 0,
481 > },
482 > GoTypes: file_temporal_server_chasm_lib_callback_proto_v1_message_proto_goTypes,
483 > DependencyIndexes: file_temporal_server_chasm_lib_callback_proto_v1_message_proto_depIdxs,
484 > EnumInfos: file_temporal_server_chasm_lib_callback_proto_v1_message_proto_enumTypes,
485 > MessageInfos: file_temporal_server_chasm_lib_callback_proto_v1_message_proto_msgTypes,
486 > }.Build()
487 > File_temporal_server_chasm_lib_callback_proto_v1_message_proto = out.File
488 > file_temporal_server_chasm_lib_callback_proto_v1_message_proto_goTypes = nil
489 > file_temporal_server_chasm_lib_callback_proto_v1_message_proto_depIdxs = nil
490 }
go.temporal.io/server/common/persistence/serialization/codec.go 24 covered LOC · 11 ranges

Open complete file

26 // encodingTypeFromEnv returns an EncodingType based on the environment variable `TEMPORAL_TEST_DATA_ENCODING`.
27 // It defaults to "ENCODING_TYPE_PROTO3" codec if the environment variable is not set.
28 > func encodingTypeFromEnv() enumspb.EncodingType { codec.go
29 > codecType := os.Getenv(SerializerDataEncodingEnvVar)
30 > switch strings.ToLower(codecType) {
31 > case "", "proto3": codec.go
32 > return enumspb.ENCODING_TYPE_PROTO3
33 case "json":
34 return enumspb.ENCODING_TYPE_JSON
65 encoding enumspb.EncodingType,
66 options ...EncodeOption,
67 > ) (*commonpb.DataBlob, error) { codec.go
68 > opts := encodeOptions{}
69 > for _, option := range options {
70 option(&opts)
71 }
72
73 > if m == nil { codec.go
74 return &commonpb.DataBlob{
75 Data: nil,
78 }
79
80 > switch encoding { codec.go
81 case enumspb.ENCODING_TYPE_JSON:
82 blob, err := codec.NewJSONPBEncoder().Encode(m)
88 EncodingType: enumspb.ENCODING_TYPE_JSON,
89 }, nil
90 > case enumspb.ENCODING_TYPE_PROTO3: codec.go
91 > data, err := proto.MarshalOptions{Deterministic: opts.deterministic}.Marshal(m)
92 > if err != nil {
93 return nil, NewSerializationError(enumspb.ENCODING_TYPE_PROTO3, err)
94 }
95 > return &commonpb.DataBlob{ codec.go
96 > EncodingType: enumspb.ENCODING_TYPE_PROTO3,
97 > Data: data,
98 > }, nil
99 default:
100 return nil, NewUnknownEncodingTypeError(encoding.String(), enumspb.ENCODING_TYPE_JSON, enumspb.ENCODING_TYPE_PROTO3)
102 }
103
104 > func Decode(data *commonpb.DataBlob, result proto.Message) error { codec.go
105 > if data == nil {
106 return NewDeserializationError(enumspb.ENCODING_TYPE_UNSPECIFIED, errors.New("cannot decode nil"))
107 }
108
109 > switch data.EncodingType { codec.go
110 case enumspb.ENCODING_TYPE_JSON:
111 return codec.NewJSONPBEncoder().Decode(data.Data, result)
112 > case enumspb.ENCODING_TYPE_PROTO3: codec.go
113 > err := proto.Unmarshal(data.Data, result)
114 > if err != nil {
115 return NewDeserializationError(enumspb.ENCODING_TYPE_PROTO3, err)
116 }
117 > return nil codec.go
118 default:
119 return NewUnknownEncodingTypeError(data.EncodingType.String(), enumspb.ENCODING_TYPE_JSON, enumspb.ENCODING_TYPE_PROTO3)
go.temporal.io/server/api/enums/v1/predicate.pb.go 23 covered LOC · 3 ranges

Open complete file

111 }
112
113 > func (PredicateType) Descriptor() protoreflect.EnumDescriptor { predicate.pb.go
114 > return file_temporal_server_api_enums_v1_predicate_proto_enumTypes[0].Descriptor()
115 > }
116
117 func (PredicateType) Type() protoreflect.EnumType {
170 }
171
172 > func init() { file_temporal_server_api_enums_v1_predicate_proto_init() } predicate.pb.go
173 > func file_temporal_server_api_enums_v1_predicate_proto_init() {
174 > if File_temporal_server_api_enums_v1_predicate_proto != nil {
175 return
176 }
177 > type x struct{} predicate.pb.go
178 > out := protoimpl.TypeBuilder{
179 > File: protoimpl.DescBuilder{
180 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
181 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_enums_v1_predicate_proto_rawDesc), len(file_temporal_server_api_enums_v1_predicate_proto_rawDesc)),
182 > NumEnums: 1,
183 > NumMessages: 0,
184 > NumExtensions: 0,
185 > NumServices: 0,
186 > },
187 > GoTypes: file_temporal_server_api_enums_v1_predicate_proto_goTypes,
188 > DependencyIndexes: file_temporal_server_api_enums_v1_predicate_proto_depIdxs,
189 > EnumInfos: file_temporal_server_api_enums_v1_predicate_proto_enumTypes,
190 > }.Build()
191 > File_temporal_server_api_enums_v1_predicate_proto = out.File
192 > file_temporal_server_api_enums_v1_predicate_proto_goTypes = nil
193 > file_temporal_server_api_enums_v1_predicate_proto_depIdxs = nil
194 }
go.temporal.io/server/api/enums/v1/task.pb.go 23 covered LOC · 3 ranges

Open complete file

303 }
304
305 > func (TaskType) Descriptor() protoreflect.EnumDescriptor { task.pb.go
306 > return file_temporal_server_api_enums_v1_task_proto_enumTypes[1].Descriptor()
307 > }
308
309 func (TaskType) Type() protoreflect.EnumType {
456 }
457
458 > func init() { file_temporal_server_api_enums_v1_task_proto_init() } task.pb.go
459 > func file_temporal_server_api_enums_v1_task_proto_init() {
460 > if File_temporal_server_api_enums_v1_task_proto != nil {
461 return
462 }
463 > type x struct{} task.pb.go
464 > out := protoimpl.TypeBuilder{
465 > File: protoimpl.DescBuilder{
466 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
467 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_enums_v1_task_proto_rawDesc), len(file_temporal_server_api_enums_v1_task_proto_rawDesc)),
468 > NumEnums: 3,
469 > NumMessages: 0,
470 > NumExtensions: 0,
471 > NumServices: 0,
472 > },
473 > GoTypes: file_temporal_server_api_enums_v1_task_proto_goTypes,
474 > DependencyIndexes: file_temporal_server_api_enums_v1_task_proto_depIdxs,
475 > EnumInfos: file_temporal_server_api_enums_v1_task_proto_enumTypes,
476 > }.Build()
477 > File_temporal_server_api_enums_v1_task_proto = out.File
478 > file_temporal_server_api_enums_v1_task_proto_goTypes = nil
479 > file_temporal_server_api_enums_v1_task_proto_depIdxs = nil
480 }
go.temporal.io/server/common/dynamicconfig/shared_structure.go 23 covered LOC · 6 ranges

Open complete file

17 )
18
19 > func warnDefaultSharedStructure(key string, def any) { shared_structure.go
20 > if path := hasSharedStructure(reflect.ValueOf(def), "root"); path != "" {
21 sharedStructureWarnings.Store(key, path)
22 }
23 }
24
25 > func logSharedStructureWarnings(logger log.Logger) { shared_structure.go
26 > // If you see this warning, it means that a default value used in New*TypedSetting has a
27 > // non-nil slice or map in it. That can lead to confusing behavior since the value from
28 > // dynamic config will be merged over the default value (e.g. the slice will be appended
29 > // to, not replaced). If that behavior is desired, you can avoid this warning by using
30 > // New*TypedSettingWithConverter and referring to dynamicconfig.ConvertStructure
31 > // explicitly. Otherwise use nil slices and maps, including at the top level
32 > // (so `[]string(nil)` instead of `[]string{}`).
33 > logSharedStructureWarningsOnce.Do(func() {
34 > sharedStructureWarnings.Range(func(key, path any) bool {
35 softassert.Fail(logger,
36 "default value contains shared structure",
42 }
43
44 > func hasSharedStructure(v reflect.Value, path string) string { shared_structure.go
45 > // nolint:exhaustive // deliberately not exhaustive
46 > switch v.Kind() {
47 > case reflect.Map, reflect.Slice, reflect.Pointer:
48 > if !v.IsNil() {
49 return path
50 }
51 > case reflect.Interface: shared_structure.go
52 > if !v.IsNil() {
53 return hasSharedStructure(v.Elem(), path)
54 }
55 > case reflect.Struct: shared_structure.go
56 > for i := range v.NumField() {
57 > if p := hasSharedStructure(v.Field(i), path+"."+v.Type().Field(i).Name); p != "" {
58 return p
59 }
go.temporal.io/server/common/namespace/namespace.go 23 covered LOC · 6 ranges

Open complete file

81 resolver ReplicationResolver,
82 mutations ...Mutation,
83 > ) (*Namespace, error) { namespace.go
84 > if resolver == nil {
85 return nil, serviceerror.NewInvalidArgument("replicationResolver must be provided")
86 }
87 > ns := &Namespace{ namespace.go
88 > info: detail.Info,
89 > config: detail.Config,
90 > configVersion: detail.ConfigVersion,
91 > customSearchAttributesMapper: CustomSearchAttributesMapper{
92 > fieldToAlias: detail.Config.CustomSearchAttributeAliases,
93 > aliasToField: util.InverseMap(detail.Config.CustomSearchAttributeAliases),
94 > },
95 > replicationResolver: resolver,
96 > }
97 >
98 > for _, m := range mutations {
99 > m.apply(ns) namespace.go
100 > }
101
102 > return ns, nil namespace.go
103 }
104
337 }
338
339 > func (id ID) String() string { namespace.go
340 > return string(id)
341 > }
342
343 func (id ID) IsEmpty() bool {
345 }
346
347 > func (n Name) String() string { namespace.go
348 > return string(n)
349 > }
350
351 func (n Name) IsEmpty() bool {
go.temporal.io/server/api/common/v1/api_category.pb.go 22 covered LOC · 2 ranges

Open complete file

204 }
205
206 > func init() { file_temporal_server_api_common_v1_api_category_proto_init() } api_category.pb.go
207 > func file_temporal_server_api_common_v1_api_category_proto_init() {
208 > if File_temporal_server_api_common_v1_api_category_proto != nil {
209 return
210 }
211 > type x struct{} api_category.pb.go
212 > out := protoimpl.TypeBuilder{
213 > File: protoimpl.DescBuilder{
214 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
215 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_common_v1_api_category_proto_rawDesc), len(file_temporal_server_api_common_v1_api_category_proto_rawDesc)),
216 > NumEnums: 1,
217 > NumMessages: 1,
218 > NumExtensions: 1,
219 > NumServices: 0,
220 > },
221 > GoTypes: file_temporal_server_api_common_v1_api_category_proto_goTypes,
222 > DependencyIndexes: file_temporal_server_api_common_v1_api_category_proto_depIdxs,
223 > EnumInfos: file_temporal_server_api_common_v1_api_category_proto_enumTypes,
224 > MessageInfos: file_temporal_server_api_common_v1_api_category_proto_msgTypes,
225 > ExtensionInfos: file_temporal_server_api_common_v1_api_category_proto_extTypes,
226 > }.Build()
227 > File_temporal_server_api_common_v1_api_category_proto = out.File
228 > file_temporal_server_api_common_v1_api_category_proto_goTypes = nil
229 > file_temporal_server_api_common_v1_api_category_proto_depIdxs = nil
230 }
go.temporal.io/server/chasm/lib/nexusoperation/gen/nexusoperationpb/v1/request_response.pb.go 22 covered LOC · 1 range

Open complete file

672 }
673
674 > func init() { file_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto_init() } request_response.pb.go
675 > func file_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto_init() {
676 > if File_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto != nil {
677 > return
678 > }
679 > type x struct{}
680 > out := protoimpl.TypeBuilder{
681 > File: protoimpl.DescBuilder{
682 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
683 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto_rawDesc), len(file_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto_rawDesc)),
684 > NumEnums: 0,
685 > NumMessages: 12,
686 > NumExtensions: 0,
687 > NumServices: 0,
688 > },
689 > GoTypes: file_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto_goTypes,
690 > DependencyIndexes: file_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto_depIdxs,
691 > MessageInfos: file_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto_msgTypes,
692 > }.Build()
693 > File_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto = out.File
694 > file_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto_goTypes = nil
695 > file_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto_depIdxs = nil
696 }
go.temporal.io/server/api/persistence/v1/task_queues.pb.go 21 covered LOC · 2 ranges

Open complete file

899 }
900
901 > func init() { file_temporal_server_api_persistence_v1_task_queues_proto_init() } task_queues.pb.go
902 > func file_temporal_server_api_persistence_v1_task_queues_proto_init() {
903 > if File_temporal_server_api_persistence_v1_task_queues_proto != nil {
904 return
905 }
906 > type x struct{} task_queues.pb.go
907 > out := protoimpl.TypeBuilder{
908 > File: protoimpl.DescBuilder{
909 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
910 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_task_queues_proto_rawDesc), len(file_temporal_server_api_persistence_v1_task_queues_proto_rawDesc)),
911 > NumEnums: 1,
912 > NumMessages: 13,
913 > NumExtensions: 0,
914 > NumServices: 0,
915 > },
916 > GoTypes: file_temporal_server_api_persistence_v1_task_queues_proto_goTypes,
917 > DependencyIndexes: file_temporal_server_api_persistence_v1_task_queues_proto_depIdxs,
918 > EnumInfos: file_temporal_server_api_persistence_v1_task_queues_proto_enumTypes,
919 > MessageInfos: file_temporal_server_api_persistence_v1_task_queues_proto_msgTypes,
920 > }.Build()
921 > File_temporal_server_api_persistence_v1_task_queues_proto = out.File
922 > file_temporal_server_api_persistence_v1_task_queues_proto_goTypes = nil
923 > file_temporal_server_api_persistence_v1_task_queues_proto_depIdxs = nil
924 }
go.temporal.io/server/api/routing/v1/extension.pb.go 21 covered LOC · 2 ranges

Open complete file

144 }
145
146 > func init() { file_temporal_server_api_routing_v1_extension_proto_init() } extension.pb.go
147 > func file_temporal_server_api_routing_v1_extension_proto_init() {
148 > if File_temporal_server_api_routing_v1_extension_proto != nil {
149 return
150 }
151 > type x struct{} extension.pb.go
152 > out := protoimpl.TypeBuilder{
153 > File: protoimpl.DescBuilder{
154 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
155 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_routing_v1_extension_proto_rawDesc), len(file_temporal_server_api_routing_v1_extension_proto_rawDesc)),
156 > NumEnums: 0,
157 > NumMessages: 1,
158 > NumExtensions: 1,
159 > NumServices: 0,
160 > },
161 > GoTypes: file_temporal_server_api_routing_v1_extension_proto_goTypes,
162 > DependencyIndexes: file_temporal_server_api_routing_v1_extension_proto_depIdxs,
163 > MessageInfos: file_temporal_server_api_routing_v1_extension_proto_msgTypes,
164 > ExtensionInfos: file_temporal_server_api_routing_v1_extension_proto_extTypes,
165 > }.Build()
166 > File_temporal_server_api_routing_v1_extension_proto = out.File
167 > file_temporal_server_api_routing_v1_extension_proto_goTypes = nil
168 > file_temporal_server_api_routing_v1_extension_proto_depIdxs = nil
169 }
go.temporal.io/server/service/history/shard/ownership.go 21 covered LOC · 5 ranges

Open complete file

44 logger log.Logger,
45 metricsHandler metrics.Handler,
46 > ) *ownership { ownership.go
47 > hostIdentity := hostInfoProvider.HostInfo().Identity()
48 > logger = log.With(logger, tag.ComponentShardController, tag.Address(hostIdentity))
49 > return &ownership{
50 > acquireCh: make(chan struct{}, 1),
51 > config: config,
52 > historyServiceResolver: historyServiceResolver,
53 > hostInfoProvider: hostInfoProvider,
54 > logger: logger,
55 > membershipUpdateCh: make(chan *membership.ChangedEvent, 1),
56 > metricsHandler: metricsHandler,
57 > }
58 > }
59
60 func (o *ownership) start(controller *ControllerImpl) {
133 // controller. If membership lists another host as the owner, it returns a
134 // ShardOwnershipLost error with the correct owner.
135 > func (o *ownership) verifyOwnership(shardID int32) error { ownership.go
136 > ownerInfo, err := o.historyServiceResolver.Lookup(convert.Int32ToString(shardID))
137 > if err != nil {
138 return err
139 }
140
141 > hostInfo := o.hostInfoProvider.HostInfo() ownership.go
142 > if ownerInfo.Identity() != hostInfo.Identity() {
143 > return serviceerrors.NewShardOwnershipLost(ownerInfo.Identity(), hostInfo.GetAddress()) ownership.go
144 > }
145
146 > return nil ownership.go
147 }
go.temporal.io/server/api/adminservice/v1/service.pb.go 20 covered LOC · 2 ranges

Open complete file

273 }
274
275 > func init() { file_temporal_server_api_adminservice_v1_service_proto_init() } service.pb.go
276 > func file_temporal_server_api_adminservice_v1_service_proto_init() {
277 > if File_temporal_server_api_adminservice_v1_service_proto != nil {
278 return
279 }
280 > file_temporal_server_api_adminservice_v1_request_response_proto_init() service.pb.go
281 > type x struct{}
282 > out := protoimpl.TypeBuilder{
283 > File: protoimpl.DescBuilder{
284 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
285 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_adminservice_v1_service_proto_rawDesc), len(file_temporal_server_api_adminservice_v1_service_proto_rawDesc)),
286 > NumEnums: 0,
287 > NumMessages: 0,
288 > NumExtensions: 0,
289 > NumServices: 1,
290 > },
291 > GoTypes: file_temporal_server_api_adminservice_v1_service_proto_goTypes,
292 > DependencyIndexes: file_temporal_server_api_adminservice_v1_service_proto_depIdxs,
293 > }.Build()
294 > File_temporal_server_api_adminservice_v1_service_proto = out.File
295 > file_temporal_server_api_adminservice_v1_service_proto_goTypes = nil
296 > file_temporal_server_api_adminservice_v1_service_proto_depIdxs = nil
297 }
go.temporal.io/server/api/archiver/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

431 }
432
433 > func init() { file_temporal_server_api_archiver_v1_message_proto_init() } message.pb.go
434 > func file_temporal_server_api_archiver_v1_message_proto_init() {
435 > if File_temporal_server_api_archiver_v1_message_proto != nil {
436 return
437 }
438 > type x struct{} message.pb.go
439 > out := protoimpl.TypeBuilder{
440 > File: protoimpl.DescBuilder{
441 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
442 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_archiver_v1_message_proto_rawDesc), len(file_temporal_server_api_archiver_v1_message_proto_rawDesc)),
443 > NumEnums: 0,
444 > NumMessages: 4,
445 > NumExtensions: 0,
446 > NumServices: 0,
447 > },
448 > GoTypes: file_temporal_server_api_archiver_v1_message_proto_goTypes,
449 > DependencyIndexes: file_temporal_server_api_archiver_v1_message_proto_depIdxs,
450 > MessageInfos: file_temporal_server_api_archiver_v1_message_proto_msgTypes,
451 > }.Build()
452 > File_temporal_server_api_archiver_v1_message_proto = out.File
453 > file_temporal_server_api_archiver_v1_message_proto_goTypes = nil
454 > file_temporal_server_api_archiver_v1_message_proto_depIdxs = nil
455 }
go.temporal.io/server/api/chasm/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

206 }
207
208 > func init() { file_temporal_server_api_chasm_v1_message_proto_init() } message.pb.go
209 > func file_temporal_server_api_chasm_v1_message_proto_init() {
210 > if File_temporal_server_api_chasm_v1_message_proto != nil {
211 return
212 }
213 > type x struct{} message.pb.go
214 > out := protoimpl.TypeBuilder{
215 > File: protoimpl.DescBuilder{
216 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
217 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_chasm_v1_message_proto_rawDesc), len(file_temporal_server_api_chasm_v1_message_proto_rawDesc)),
218 > NumEnums: 0,
219 > NumMessages: 1,
220 > NumExtensions: 0,
221 > NumServices: 0,
222 > },
223 > GoTypes: file_temporal_server_api_chasm_v1_message_proto_goTypes,
224 > DependencyIndexes: file_temporal_server_api_chasm_v1_message_proto_depIdxs,
225 > MessageInfos: file_temporal_server_api_chasm_v1_message_proto_msgTypes,
226 > }.Build()
227 > File_temporal_server_api_chasm_v1_message_proto = out.File
228 > file_temporal_server_api_chasm_v1_message_proto_goTypes = nil
229 > file_temporal_server_api_chasm_v1_message_proto_depIdxs = nil
230 }
go.temporal.io/server/api/clock/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

193 }
194
195 > func init() { file_temporal_server_api_clock_v1_message_proto_init() } message.pb.go
196 > func file_temporal_server_api_clock_v1_message_proto_init() {
197 > if File_temporal_server_api_clock_v1_message_proto != nil {
198 return
199 }
200 > type x struct{} message.pb.go
201 > out := protoimpl.TypeBuilder{
202 > File: protoimpl.DescBuilder{
203 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
204 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_clock_v1_message_proto_rawDesc), len(file_temporal_server_api_clock_v1_message_proto_rawDesc)),
205 > NumEnums: 0,
206 > NumMessages: 2,
207 > NumExtensions: 0,
208 > NumServices: 0,
209 > },
210 > GoTypes: file_temporal_server_api_clock_v1_message_proto_goTypes,
211 > DependencyIndexes: file_temporal_server_api_clock_v1_message_proto_depIdxs,
212 > MessageInfos: file_temporal_server_api_clock_v1_message_proto_msgTypes,
213 > }.Build()
214 > File_temporal_server_api_clock_v1_message_proto = out.File
215 > file_temporal_server_api_clock_v1_message_proto_goTypes = nil
216 > file_temporal_server_api_clock_v1_message_proto_depIdxs = nil
217 }
go.temporal.io/server/api/cluster/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

342 }
343
344 > func init() { file_temporal_server_api_cluster_v1_message_proto_init() } message.pb.go
345 > func file_temporal_server_api_cluster_v1_message_proto_init() {
346 > if File_temporal_server_api_cluster_v1_message_proto != nil {
347 return
348 }
349 > type x struct{} message.pb.go
350 > out := protoimpl.TypeBuilder{
351 > File: protoimpl.DescBuilder{
352 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
353 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_cluster_v1_message_proto_rawDesc), len(file_temporal_server_api_cluster_v1_message_proto_rawDesc)),
354 > NumEnums: 0,
355 > NumMessages: 4,
356 > NumExtensions: 0,
357 > NumServices: 0,
358 > },
359 > GoTypes: file_temporal_server_api_cluster_v1_message_proto_goTypes,
360 > DependencyIndexes: file_temporal_server_api_cluster_v1_message_proto_depIdxs,
361 > MessageInfos: file_temporal_server_api_cluster_v1_message_proto_msgTypes,
362 > }.Build()
363 > File_temporal_server_api_cluster_v1_message_proto = out.File
364 > file_temporal_server_api_cluster_v1_message_proto_goTypes = nil
365 > file_temporal_server_api_cluster_v1_message_proto_depIdxs = nil
366 }
go.temporal.io/server/api/common/v1/dlq.pb.go 20 covered LOC · 2 ranges

Open complete file

295 }
296
297 > func init() { file_temporal_server_api_common_v1_dlq_proto_init() } dlq.pb.go
298 > func file_temporal_server_api_common_v1_dlq_proto_init() {
299 > if File_temporal_server_api_common_v1_dlq_proto != nil {
300 return
301 }
302 > type x struct{} dlq.pb.go
303 > out := protoimpl.TypeBuilder{
304 > File: protoimpl.DescBuilder{
305 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
306 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_common_v1_dlq_proto_rawDesc), len(file_temporal_server_api_common_v1_dlq_proto_rawDesc)),
307 > NumEnums: 0,
308 > NumMessages: 4,
309 > NumExtensions: 0,
310 > NumServices: 0,
311 > },
312 > GoTypes: file_temporal_server_api_common_v1_dlq_proto_goTypes,
313 > DependencyIndexes: file_temporal_server_api_common_v1_dlq_proto_depIdxs,
314 > MessageInfos: file_temporal_server_api_common_v1_dlq_proto_msgTypes,
315 > }.Build()
316 > File_temporal_server_api_common_v1_dlq_proto = out.File
317 > file_temporal_server_api_common_v1_dlq_proto_goTypes = nil
318 > file_temporal_server_api_common_v1_dlq_proto_depIdxs = nil
319 }
go.temporal.io/server/api/contextpropagation/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

109 }
110
111 > func init() { file_temporal_server_api_contextpropagation_v1_message_proto_init() } message.pb.go
112 > func file_temporal_server_api_contextpropagation_v1_message_proto_init() {
113 > if File_temporal_server_api_contextpropagation_v1_message_proto != nil {
114 return
115 }
116 > type x struct{} message.pb.go
117 > out := protoimpl.TypeBuilder{
118 > File: protoimpl.DescBuilder{
119 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
120 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_contextpropagation_v1_message_proto_rawDesc), len(file_temporal_server_api_contextpropagation_v1_message_proto_rawDesc)),
121 > NumEnums: 0,
122 > NumMessages: 2,
123 > NumExtensions: 0,
124 > NumServices: 0,
125 > },
126 > GoTypes: file_temporal_server_api_contextpropagation_v1_message_proto_goTypes,
127 > DependencyIndexes: file_temporal_server_api_contextpropagation_v1_message_proto_depIdxs,
128 > MessageInfos: file_temporal_server_api_contextpropagation_v1_message_proto_msgTypes,
129 > }.Build()
130 > File_temporal_server_api_contextpropagation_v1_message_proto = out.File
131 > file_temporal_server_api_contextpropagation_v1_message_proto_goTypes = nil
132 > file_temporal_server_api_contextpropagation_v1_message_proto_depIdxs = nil
133 }
go.temporal.io/server/api/deployment/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

4626 }
4627
4628 > func init() { file_temporal_server_api_deployment_v1_message_proto_init() } message.pb.go
4629 > func file_temporal_server_api_deployment_v1_message_proto_init() {
4630 > if File_temporal_server_api_deployment_v1_message_proto != nil {
4631 return
4632 }
4633 > type x struct{} message.pb.go
4634 > out := protoimpl.TypeBuilder{
4635 > File: protoimpl.DescBuilder{
4636 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
4637 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_deployment_v1_message_proto_rawDesc), len(file_temporal_server_api_deployment_v1_message_proto_rawDesc)),
4638 > NumEnums: 0,
4639 > NumMessages: 75,
4640 > NumExtensions: 0,
4641 > NumServices: 0,
4642 > },
4643 > GoTypes: file_temporal_server_api_deployment_v1_message_proto_goTypes,
4644 > DependencyIndexes: file_temporal_server_api_deployment_v1_message_proto_depIdxs,
4645 > MessageInfos: file_temporal_server_api_deployment_v1_message_proto_msgTypes,
4646 > }.Build()
4647 > File_temporal_server_api_deployment_v1_message_proto = out.File
4648 > file_temporal_server_api_deployment_v1_message_proto_goTypes = nil
4649 > file_temporal_server_api_deployment_v1_message_proto_depIdxs = nil
4650 }
go.temporal.io/server/api/enums/v1/cluster.pb.go 20 covered LOC · 2 ranges

Open complete file

209 }
210
211 > func init() { file_temporal_server_api_enums_v1_cluster_proto_init() } cluster.pb.go
212 > func file_temporal_server_api_enums_v1_cluster_proto_init() {
213 > if File_temporal_server_api_enums_v1_cluster_proto != nil {
214 return
215 }
216 > type x struct{} cluster.pb.go
217 > out := protoimpl.TypeBuilder{
218 > File: protoimpl.DescBuilder{
219 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
220 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_enums_v1_cluster_proto_rawDesc), len(file_temporal_server_api_enums_v1_cluster_proto_rawDesc)),
221 > NumEnums: 2,
222 > NumMessages: 0,
223 > NumExtensions: 0,
224 > NumServices: 0,
225 > },
226 > GoTypes: file_temporal_server_api_enums_v1_cluster_proto_goTypes,
227 > DependencyIndexes: file_temporal_server_api_enums_v1_cluster_proto_depIdxs,
228 > EnumInfos: file_temporal_server_api_enums_v1_cluster_proto_enumTypes,
229 > }.Build()
230 > File_temporal_server_api_enums_v1_cluster_proto = out.File
231 > file_temporal_server_api_enums_v1_cluster_proto_goTypes = nil
232 > file_temporal_server_api_enums_v1_cluster_proto_depIdxs = nil
233 }
go.temporal.io/server/api/enums/v1/common.pb.go 20 covered LOC · 2 ranges

Open complete file

264 }
265
266 > func init() { file_temporal_server_api_enums_v1_common_proto_init() } common.pb.go
267 > func file_temporal_server_api_enums_v1_common_proto_init() {
268 > if File_temporal_server_api_enums_v1_common_proto != nil {
269 return
270 }
271 > type x struct{} common.pb.go
272 > out := protoimpl.TypeBuilder{
273 > File: protoimpl.DescBuilder{
274 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
275 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_enums_v1_common_proto_rawDesc), len(file_temporal_server_api_enums_v1_common_proto_rawDesc)),
276 > NumEnums: 3,
277 > NumMessages: 0,
278 > NumExtensions: 0,
279 > NumServices: 0,
280 > },
281 > GoTypes: file_temporal_server_api_enums_v1_common_proto_goTypes,
282 > DependencyIndexes: file_temporal_server_api_enums_v1_common_proto_depIdxs,
283 > EnumInfos: file_temporal_server_api_enums_v1_common_proto_enumTypes,
284 > }.Build()
285 > File_temporal_server_api_enums_v1_common_proto = out.File
286 > file_temporal_server_api_enums_v1_common_proto_goTypes = nil
287 > file_temporal_server_api_enums_v1_common_proto_depIdxs = nil
288 }
go.temporal.io/server/api/enums/v1/dlq.pb.go 20 covered LOC · 2 ranges

Open complete file

187 }
188
189 > func init() { file_temporal_server_api_enums_v1_dlq_proto_init() } dlq.pb.go
190 > func file_temporal_server_api_enums_v1_dlq_proto_init() {
191 > if File_temporal_server_api_enums_v1_dlq_proto != nil {
192 return
193 }
194 > type x struct{} dlq.pb.go
195 > out := protoimpl.TypeBuilder{
196 > File: protoimpl.DescBuilder{
197 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
198 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_enums_v1_dlq_proto_rawDesc), len(file_temporal_server_api_enums_v1_dlq_proto_rawDesc)),
199 > NumEnums: 2,
200 > NumMessages: 0,
201 > NumExtensions: 0,
202 > NumServices: 0,
203 > },
204 > GoTypes: file_temporal_server_api_enums_v1_dlq_proto_goTypes,
205 > DependencyIndexes: file_temporal_server_api_enums_v1_dlq_proto_depIdxs,
206 > EnumInfos: file_temporal_server_api_enums_v1_dlq_proto_enumTypes,
207 > }.Build()
208 > File_temporal_server_api_enums_v1_dlq_proto = out.File
209 > file_temporal_server_api_enums_v1_dlq_proto_goTypes = nil
210 > file_temporal_server_api_enums_v1_dlq_proto_depIdxs = nil
211 }
go.temporal.io/server/api/enums/v1/fairness_state.pb.go 20 covered LOC · 2 ranges

Open complete file

123 }
124
125 > func init() { file_temporal_server_api_enums_v1_fairness_state_proto_init() } fairness_state.pb.go
126 > func file_temporal_server_api_enums_v1_fairness_state_proto_init() {
127 > if File_temporal_server_api_enums_v1_fairness_state_proto != nil {
128 return
129 }
130 > type x struct{} fairness_state.pb.go
131 > out := protoimpl.TypeBuilder{
132 > File: protoimpl.DescBuilder{
133 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
134 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_enums_v1_fairness_state_proto_rawDesc), len(file_temporal_server_api_enums_v1_fairness_state_proto_rawDesc)),
135 > NumEnums: 1,
136 > NumMessages: 0,
137 > NumExtensions: 0,
138 > NumServices: 0,
139 > },
140 > GoTypes: file_temporal_server_api_enums_v1_fairness_state_proto_goTypes,
141 > DependencyIndexes: file_temporal_server_api_enums_v1_fairness_state_proto_depIdxs,
142 > EnumInfos: file_temporal_server_api_enums_v1_fairness_state_proto_enumTypes,
143 > }.Build()
144 > File_temporal_server_api_enums_v1_fairness_state_proto = out.File
145 > file_temporal_server_api_enums_v1_fairness_state_proto_goTypes = nil
146 > file_temporal_server_api_enums_v1_fairness_state_proto_depIdxs = nil
147 }
go.temporal.io/server/api/enums/v1/nexus.pb.go 20 covered LOC · 2 ranges

Open complete file

158 }
159
160 > func init() { file_temporal_server_api_enums_v1_nexus_proto_init() } nexus.pb.go
161 > func file_temporal_server_api_enums_v1_nexus_proto_init() {
162 > if File_temporal_server_api_enums_v1_nexus_proto != nil {
163 return
164 }
165 > type x struct{} nexus.pb.go
166 > out := protoimpl.TypeBuilder{
167 > File: protoimpl.DescBuilder{
168 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
169 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_enums_v1_nexus_proto_rawDesc), len(file_temporal_server_api_enums_v1_nexus_proto_rawDesc)),
170 > NumEnums: 1,
171 > NumMessages: 0,
172 > NumExtensions: 0,
173 > NumServices: 0,
174 > },
175 > GoTypes: file_temporal_server_api_enums_v1_nexus_proto_goTypes,
176 > DependencyIndexes: file_temporal_server_api_enums_v1_nexus_proto_depIdxs,
177 > EnumInfos: file_temporal_server_api_enums_v1_nexus_proto_enumTypes,
178 > }.Build()
179 > File_temporal_server_api_enums_v1_nexus_proto = out.File
180 > file_temporal_server_api_enums_v1_nexus_proto_goTypes = nil
181 > file_temporal_server_api_enums_v1_nexus_proto_depIdxs = nil
182 }
go.temporal.io/server/api/enums/v1/replication.pb.go 20 covered LOC · 2 ranges

Open complete file

314 }
315
316 > func init() { file_temporal_server_api_enums_v1_replication_proto_init() } replication.pb.go
317 > func file_temporal_server_api_enums_v1_replication_proto_init() {
318 > if File_temporal_server_api_enums_v1_replication_proto != nil {
319 return
320 }
321 > type x struct{} replication.pb.go
322 > out := protoimpl.TypeBuilder{
323 > File: protoimpl.DescBuilder{
324 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
325 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_enums_v1_replication_proto_rawDesc), len(file_temporal_server_api_enums_v1_replication_proto_rawDesc)),
326 > NumEnums: 3,
327 > NumMessages: 0,
328 > NumExtensions: 0,
329 > NumServices: 0,
330 > },
331 > GoTypes: file_temporal_server_api_enums_v1_replication_proto_goTypes,
332 > DependencyIndexes: file_temporal_server_api_enums_v1_replication_proto_depIdxs,
333 > EnumInfos: file_temporal_server_api_enums_v1_replication_proto_enumTypes,
334 > }.Build()
335 > File_temporal_server_api_enums_v1_replication_proto = out.File
336 > file_temporal_server_api_enums_v1_replication_proto_goTypes = nil
337 > file_temporal_server_api_enums_v1_replication_proto_depIdxs = nil
338 }
go.temporal.io/server/api/enums/v1/workflow.pb.go 20 covered LOC · 2 ranges

Open complete file

275 }
276
277 > func init() { file_temporal_server_api_enums_v1_workflow_proto_init() } workflow.pb.go
278 > func file_temporal_server_api_enums_v1_workflow_proto_init() {
279 > if File_temporal_server_api_enums_v1_workflow_proto != nil {
280 return
281 }
282 > type x struct{} workflow.pb.go
283 > out := protoimpl.TypeBuilder{
284 > File: protoimpl.DescBuilder{
285 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
286 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_enums_v1_workflow_proto_rawDesc), len(file_temporal_server_api_enums_v1_workflow_proto_rawDesc)),
287 > NumEnums: 3,
288 > NumMessages: 0,
289 > NumExtensions: 0,
290 > NumServices: 0,
291 > },
292 > GoTypes: file_temporal_server_api_enums_v1_workflow_proto_goTypes,
293 > DependencyIndexes: file_temporal_server_api_enums_v1_workflow_proto_depIdxs,
294 > EnumInfos: file_temporal_server_api_enums_v1_workflow_proto_enumTypes,
295 > }.Build()
296 > File_temporal_server_api_enums_v1_workflow_proto = out.File
297 > file_temporal_server_api_enums_v1_workflow_proto_goTypes = nil
298 > file_temporal_server_api_enums_v1_workflow_proto_depIdxs = nil
299 }
go.temporal.io/server/api/enums/v1/workflow_task_type.pb.go 20 covered LOC · 2 ranges

Open complete file

124 }
125
126 > func init() { file_temporal_server_api_enums_v1_workflow_task_type_proto_init() } workflow_task_type.pb.go
127 > func file_temporal_server_api_enums_v1_workflow_task_type_proto_init() {
128 > if File_temporal_server_api_enums_v1_workflow_task_type_proto != nil {
129 return
130 }
131 > type x struct{} workflow_task_type.pb.go
132 > out := protoimpl.TypeBuilder{
133 > File: protoimpl.DescBuilder{
134 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
135 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_enums_v1_workflow_task_type_proto_rawDesc), len(file_temporal_server_api_enums_v1_workflow_task_type_proto_rawDesc)),
136 > NumEnums: 1,
137 > NumMessages: 0,
138 > NumExtensions: 0,
139 > NumServices: 0,
140 > },
141 > GoTypes: file_temporal_server_api_enums_v1_workflow_task_type_proto_goTypes,
142 > DependencyIndexes: file_temporal_server_api_enums_v1_workflow_task_type_proto_depIdxs,
143 > EnumInfos: file_temporal_server_api_enums_v1_workflow_task_type_proto_enumTypes,
144 > }.Build()
145 > File_temporal_server_api_enums_v1_workflow_task_type_proto = out.File
146 > file_temporal_server_api_enums_v1_workflow_task_type_proto_goTypes = nil
147 > file_temporal_server_api_enums_v1_workflow_task_type_proto_depIdxs = nil
148 }
go.temporal.io/server/api/errordetails/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

625 }
626
627 > func init() { file_temporal_server_api_errordetails_v1_message_proto_init() } message.pb.go
628 > func file_temporal_server_api_errordetails_v1_message_proto_init() {
629 > if File_temporal_server_api_errordetails_v1_message_proto != nil {
630 return
631 }
632 > type x struct{} message.pb.go
633 > out := protoimpl.TypeBuilder{
634 > File: protoimpl.DescBuilder{
635 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
636 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_errordetails_v1_message_proto_rawDesc), len(file_temporal_server_api_errordetails_v1_message_proto_rawDesc)),
637 > NumEnums: 0,
638 > NumMessages: 10,
639 > NumExtensions: 0,
640 > NumServices: 0,
641 > },
642 > GoTypes: file_temporal_server_api_errordetails_v1_message_proto_goTypes,
643 > DependencyIndexes: file_temporal_server_api_errordetails_v1_message_proto_depIdxs,
644 > MessageInfos: file_temporal_server_api_errordetails_v1_message_proto_msgTypes,
645 > }.Build()
646 > File_temporal_server_api_errordetails_v1_message_proto = out.File
647 > file_temporal_server_api_errordetails_v1_message_proto_goTypes = nil
648 > file_temporal_server_api_errordetails_v1_message_proto_depIdxs = nil
649 }
go.temporal.io/server/api/health/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

300 }
301
302 > func init() { file_temporal_server_api_health_v1_message_proto_init() } message.pb.go
303 > func file_temporal_server_api_health_v1_message_proto_init() {
304 > if File_temporal_server_api_health_v1_message_proto != nil {
305 return
306 }
307 > type x struct{} message.pb.go
308 > out := protoimpl.TypeBuilder{
309 > File: protoimpl.DescBuilder{
310 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
311 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_health_v1_message_proto_rawDesc), len(file_temporal_server_api_health_v1_message_proto_rawDesc)),
312 > NumEnums: 0,
313 > NumMessages: 3,
314 > NumExtensions: 0,
315 > NumServices: 0,
316 > },
317 > GoTypes: file_temporal_server_api_health_v1_message_proto_goTypes,
318 > DependencyIndexes: file_temporal_server_api_health_v1_message_proto_depIdxs,
319 > MessageInfos: file_temporal_server_api_health_v1_message_proto_msgTypes,
320 > }.Build()
321 > File_temporal_server_api_health_v1_message_proto = out.File
322 > file_temporal_server_api_health_v1_message_proto_goTypes = nil
323 > file_temporal_server_api_health_v1_message_proto_depIdxs = nil
324 }
go.temporal.io/server/api/history/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

498 }
499
500 > func init() { file_temporal_server_api_history_v1_message_proto_init() } message.pb.go
501 > func file_temporal_server_api_history_v1_message_proto_init() {
502 > if File_temporal_server_api_history_v1_message_proto != nil {
503 return
504 }
505 > type x struct{} message.pb.go
506 > out := protoimpl.TypeBuilder{
507 > File: protoimpl.DescBuilder{
508 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
509 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_history_v1_message_proto_rawDesc), len(file_temporal_server_api_history_v1_message_proto_rawDesc)),
510 > NumEnums: 0,
511 > NumMessages: 8,
512 > NumExtensions: 0,
513 > NumServices: 0,
514 > },
515 > GoTypes: file_temporal_server_api_history_v1_message_proto_goTypes,
516 > DependencyIndexes: file_temporal_server_api_history_v1_message_proto_depIdxs,
517 > MessageInfos: file_temporal_server_api_history_v1_message_proto_msgTypes,
518 > }.Build()
519 > File_temporal_server_api_history_v1_message_proto = out.File
520 > file_temporal_server_api_history_v1_message_proto_goTypes = nil
521 > file_temporal_server_api_history_v1_message_proto_depIdxs = nil
522 }
go.temporal.io/server/api/historyservice/v1/service.pb.go 20 covered LOC · 2 ranges

Open complete file

428 }
429
430 > func init() { file_temporal_server_api_historyservice_v1_service_proto_init() } service.pb.go
431 > func file_temporal_server_api_historyservice_v1_service_proto_init() {
432 > if File_temporal_server_api_historyservice_v1_service_proto != nil {
433 return
434 }
435 > file_temporal_server_api_historyservice_v1_request_response_proto_init() service.pb.go
436 > type x struct{}
437 > out := protoimpl.TypeBuilder{
438 > File: protoimpl.DescBuilder{
439 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
440 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_historyservice_v1_service_proto_rawDesc), len(file_temporal_server_api_historyservice_v1_service_proto_rawDesc)),
441 > NumEnums: 0,
442 > NumMessages: 0,
443 > NumExtensions: 0,
444 > NumServices: 1,
445 > },
446 > GoTypes: file_temporal_server_api_historyservice_v1_service_proto_goTypes,
447 > DependencyIndexes: file_temporal_server_api_historyservice_v1_service_proto_depIdxs,
448 > }.Build()
449 > File_temporal_server_api_historyservice_v1_service_proto = out.File
450 > file_temporal_server_api_historyservice_v1_service_proto_goTypes = nil
451 > file_temporal_server_api_historyservice_v1_service_proto_depIdxs = nil
452 }
go.temporal.io/server/api/matchingservice/v1/service.pb.go 20 covered LOC · 2 ranges

Open complete file

250 }
251
252 > func init() { file_temporal_server_api_matchingservice_v1_service_proto_init() } service.pb.go
253 > func file_temporal_server_api_matchingservice_v1_service_proto_init() {
254 > if File_temporal_server_api_matchingservice_v1_service_proto != nil {
255 return
256 }
257 > file_temporal_server_api_matchingservice_v1_request_response_proto_init() service.pb.go
258 > type x struct{}
259 > out := protoimpl.TypeBuilder{
260 > File: protoimpl.DescBuilder{
261 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
262 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_matchingservice_v1_service_proto_rawDesc), len(file_temporal_server_api_matchingservice_v1_service_proto_rawDesc)),
263 > NumEnums: 0,
264 > NumMessages: 0,
265 > NumExtensions: 0,
266 > NumServices: 1,
267 > },
268 > GoTypes: file_temporal_server_api_matchingservice_v1_service_proto_goTypes,
269 > DependencyIndexes: file_temporal_server_api_matchingservice_v1_service_proto_depIdxs,
270 > }.Build()
271 > File_temporal_server_api_matchingservice_v1_service_proto = out.File
272 > file_temporal_server_api_matchingservice_v1_service_proto_goTypes = nil
273 > file_temporal_server_api_matchingservice_v1_service_proto_depIdxs = nil
274 }
go.temporal.io/server/api/metrics/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

104 }
105
106 > func init() { file_temporal_server_api_metrics_v1_message_proto_init() } message.pb.go
107 > func file_temporal_server_api_metrics_v1_message_proto_init() {
108 > if File_temporal_server_api_metrics_v1_message_proto != nil {
109 return
110 }
111 > type x struct{} message.pb.go
112 > out := protoimpl.TypeBuilder{
113 > File: protoimpl.DescBuilder{
114 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
115 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_metrics_v1_message_proto_rawDesc), len(file_temporal_server_api_metrics_v1_message_proto_rawDesc)),
116 > NumEnums: 0,
117 > NumMessages: 2,
118 > NumExtensions: 0,
119 > NumServices: 0,
120 > },
121 > GoTypes: file_temporal_server_api_metrics_v1_message_proto_goTypes,
122 > DependencyIndexes: file_temporal_server_api_metrics_v1_message_proto_depIdxs,
123 > MessageInfos: file_temporal_server_api_metrics_v1_message_proto_msgTypes,
124 > }.Build()
125 > File_temporal_server_api_metrics_v1_message_proto = out.File
126 > file_temporal_server_api_metrics_v1_message_proto_goTypes = nil
127 > file_temporal_server_api_metrics_v1_message_proto_depIdxs = nil
128 }
go.temporal.io/server/api/namespace/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

114 }
115
116 > func init() { file_temporal_server_api_namespace_v1_message_proto_init() } message.pb.go
117 > func file_temporal_server_api_namespace_v1_message_proto_init() {
118 > if File_temporal_server_api_namespace_v1_message_proto != nil {
119 return
120 }
121 > type x struct{} message.pb.go
122 > out := protoimpl.TypeBuilder{
123 > File: protoimpl.DescBuilder{
124 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
125 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_namespace_v1_message_proto_rawDesc), len(file_temporal_server_api_namespace_v1_message_proto_rawDesc)),
126 > NumEnums: 0,
127 > NumMessages: 1,
128 > NumExtensions: 0,
129 > NumServices: 0,
130 > },
131 > GoTypes: file_temporal_server_api_namespace_v1_message_proto_goTypes,
132 > DependencyIndexes: file_temporal_server_api_namespace_v1_message_proto_depIdxs,
133 > MessageInfos: file_temporal_server_api_namespace_v1_message_proto_msgTypes,
134 > }.Build()
135 > File_temporal_server_api_namespace_v1_message_proto = out.File
136 > file_temporal_server_api_namespace_v1_message_proto_goTypes = nil
137 > file_temporal_server_api_namespace_v1_message_proto_depIdxs = nil
138 }
go.temporal.io/server/api/persistence/v1/chasm_visibility.pb.go 20 covered LOC · 2 ranges

Open complete file

146 }
147
148 > func init() { file_temporal_server_api_persistence_v1_chasm_visibility_proto_init() } chasm_visibility.pb.go
149 > func file_temporal_server_api_persistence_v1_chasm_visibility_proto_init() {
150 > if File_temporal_server_api_persistence_v1_chasm_visibility_proto != nil {
151 return
152 }
153 > type x struct{} chasm_visibility.pb.go
154 > out := protoimpl.TypeBuilder{
155 > File: protoimpl.DescBuilder{
156 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
157 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_chasm_visibility_proto_rawDesc), len(file_temporal_server_api_persistence_v1_chasm_visibility_proto_rawDesc)),
158 > NumEnums: 0,
159 > NumMessages: 2,
160 > NumExtensions: 0,
161 > NumServices: 0,
162 > },
163 > GoTypes: file_temporal_server_api_persistence_v1_chasm_visibility_proto_goTypes,
164 > DependencyIndexes: file_temporal_server_api_persistence_v1_chasm_visibility_proto_depIdxs,
165 > MessageInfos: file_temporal_server_api_persistence_v1_chasm_visibility_proto_msgTypes,
166 > }.Build()
167 > File_temporal_server_api_persistence_v1_chasm_visibility_proto = out.File
168 > file_temporal_server_api_persistence_v1_chasm_visibility_proto_goTypes = nil
169 > file_temporal_server_api_persistence_v1_chasm_visibility_proto_depIdxs = nil
170 }
go.temporal.io/server/api/persistence/v1/cluster_metadata.pb.go 20 covered LOC · 2 ranges

Open complete file

289 }
290
291 > func init() { file_temporal_server_api_persistence_v1_cluster_metadata_proto_init() } cluster_metadata.pb.go
292 > func file_temporal_server_api_persistence_v1_cluster_metadata_proto_init() {
293 > if File_temporal_server_api_persistence_v1_cluster_metadata_proto != nil {
294 return
295 }
296 > type x struct{} cluster_metadata.pb.go
297 > out := protoimpl.TypeBuilder{
298 > File: protoimpl.DescBuilder{
299 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
300 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_cluster_metadata_proto_rawDesc), len(file_temporal_server_api_persistence_v1_cluster_metadata_proto_rawDesc)),
301 > NumEnums: 0,
302 > NumMessages: 5,
303 > NumExtensions: 0,
304 > NumServices: 0,
305 > },
306 > GoTypes: file_temporal_server_api_persistence_v1_cluster_metadata_proto_goTypes,
307 > DependencyIndexes: file_temporal_server_api_persistence_v1_cluster_metadata_proto_depIdxs,
308 > MessageInfos: file_temporal_server_api_persistence_v1_cluster_metadata_proto_msgTypes,
309 > }.Build()
310 > File_temporal_server_api_persistence_v1_cluster_metadata_proto = out.File
311 > file_temporal_server_api_persistence_v1_cluster_metadata_proto_goTypes = nil
312 > file_temporal_server_api_persistence_v1_cluster_metadata_proto_depIdxs = nil
313 }
go.temporal.io/server/api/persistence/v1/history_tree.pb.go 20 covered LOC · 2 ranges

Open complete file

274 }
275
276 > func init() { file_temporal_server_api_persistence_v1_history_tree_proto_init() } history_tree.pb.go
277 > func file_temporal_server_api_persistence_v1_history_tree_proto_init() {
278 > if File_temporal_server_api_persistence_v1_history_tree_proto != nil {
279 return
280 }
281 > type x struct{} history_tree.pb.go
282 > out := protoimpl.TypeBuilder{
283 > File: protoimpl.DescBuilder{
284 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
285 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_history_tree_proto_rawDesc), len(file_temporal_server_api_persistence_v1_history_tree_proto_rawDesc)),
286 > NumEnums: 0,
287 > NumMessages: 3,
288 > NumExtensions: 0,
289 > NumServices: 0,
290 > },
291 > GoTypes: file_temporal_server_api_persistence_v1_history_tree_proto_goTypes,
292 > DependencyIndexes: file_temporal_server_api_persistence_v1_history_tree_proto_depIdxs,
293 > MessageInfos: file_temporal_server_api_persistence_v1_history_tree_proto_msgTypes,
294 > }.Build()
295 > File_temporal_server_api_persistence_v1_history_tree_proto = out.File
296 > file_temporal_server_api_persistence_v1_history_tree_proto_goTypes = nil
297 > file_temporal_server_api_persistence_v1_history_tree_proto_depIdxs = nil
298 }
go.temporal.io/server/api/persistence/v1/namespaces.pb.go 20 covered LOC · 2 ranges

Open complete file

536 }
537
538 > func init() { file_temporal_server_api_persistence_v1_namespaces_proto_init() } namespaces.pb.go
539 > func file_temporal_server_api_persistence_v1_namespaces_proto_init() {
540 > if File_temporal_server_api_persistence_v1_namespaces_proto != nil {
541 return
542 }
543 > type x struct{} namespaces.pb.go
544 > out := protoimpl.TypeBuilder{
545 > File: protoimpl.DescBuilder{
546 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
547 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_namespaces_proto_rawDesc), len(file_temporal_server_api_persistence_v1_namespaces_proto_rawDesc)),
548 > NumEnums: 0,
549 > NumMessages: 8,
550 > NumExtensions: 0,
551 > NumServices: 0,
552 > },
553 > GoTypes: file_temporal_server_api_persistence_v1_namespaces_proto_goTypes,
554 > DependencyIndexes: file_temporal_server_api_persistence_v1_namespaces_proto_depIdxs,
555 > MessageInfos: file_temporal_server_api_persistence_v1_namespaces_proto_msgTypes,
556 > }.Build()
557 > File_temporal_server_api_persistence_v1_namespaces_proto = out.File
558 > file_temporal_server_api_persistence_v1_namespaces_proto_goTypes = nil
559 > file_temporal_server_api_persistence_v1_namespaces_proto_depIdxs = nil
560 }
go.temporal.io/server/api/persistence/v1/queue_metadata.pb.go 20 covered LOC · 2 ranges

Open complete file

105 }
106
107 > func init() { file_temporal_server_api_persistence_v1_queue_metadata_proto_init() } queue_metadata.pb.go
108 > func file_temporal_server_api_persistence_v1_queue_metadata_proto_init() {
109 > if File_temporal_server_api_persistence_v1_queue_metadata_proto != nil {
110 return
111 }
112 > type x struct{} queue_metadata.pb.go
113 > out := protoimpl.TypeBuilder{
114 > File: protoimpl.DescBuilder{
115 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
116 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_queue_metadata_proto_rawDesc), len(file_temporal_server_api_persistence_v1_queue_metadata_proto_rawDesc)),
117 > NumEnums: 0,
118 > NumMessages: 2,
119 > NumExtensions: 0,
120 > NumServices: 0,
121 > },
122 > GoTypes: file_temporal_server_api_persistence_v1_queue_metadata_proto_goTypes,
123 > DependencyIndexes: file_temporal_server_api_persistence_v1_queue_metadata_proto_depIdxs,
124 > MessageInfos: file_temporal_server_api_persistence_v1_queue_metadata_proto_msgTypes,
125 > }.Build()
126 > File_temporal_server_api_persistence_v1_queue_metadata_proto = out.File
127 > file_temporal_server_api_persistence_v1_queue_metadata_proto_goTypes = nil
128 > file_temporal_server_api_persistence_v1_queue_metadata_proto_depIdxs = nil
129 }
go.temporal.io/server/api/persistence/v1/tasks.pb.go 20 covered LOC · 2 ranges

Open complete file

846 }
847
848 > func init() { file_temporal_server_api_persistence_v1_tasks_proto_init() } tasks.pb.go
849 > func file_temporal_server_api_persistence_v1_tasks_proto_init() {
850 > if File_temporal_server_api_persistence_v1_tasks_proto != nil {
851 return
852 }
853 > type x struct{} tasks.pb.go
854 > out := protoimpl.TypeBuilder{
855 > File: protoimpl.DescBuilder{
856 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
857 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_tasks_proto_rawDesc), len(file_temporal_server_api_persistence_v1_tasks_proto_rawDesc)),
858 > NumEnums: 0,
859 > NumMessages: 8,
860 > NumExtensions: 0,
861 > NumServices: 0,
862 > },
863 > GoTypes: file_temporal_server_api_persistence_v1_tasks_proto_goTypes,
864 > DependencyIndexes: file_temporal_server_api_persistence_v1_tasks_proto_depIdxs,
865 > MessageInfos: file_temporal_server_api_persistence_v1_tasks_proto_msgTypes,
866 > }.Build()
867 > File_temporal_server_api_persistence_v1_tasks_proto = out.File
868 > file_temporal_server_api_persistence_v1_tasks_proto_goTypes = nil
869 > file_temporal_server_api_persistence_v1_tasks_proto_depIdxs = nil
870 }
go.temporal.io/server/api/token/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

785 }
786
787 > func init() { file_temporal_server_api_token_v1_message_proto_init() } message.pb.go
788 > func file_temporal_server_api_token_v1_message_proto_init() {
789 > if File_temporal_server_api_token_v1_message_proto != nil {
790 return
791 }
792 > type x struct{} message.pb.go
793 > out := protoimpl.TypeBuilder{
794 > File: protoimpl.DescBuilder{
795 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
796 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_token_v1_message_proto_rawDesc), len(file_temporal_server_api_token_v1_message_proto_rawDesc)),
797 > NumEnums: 0,
798 > NumMessages: 7,
799 > NumExtensions: 0,
800 > NumServices: 0,
801 > },
802 > GoTypes: file_temporal_server_api_token_v1_message_proto_goTypes,
803 > DependencyIndexes: file_temporal_server_api_token_v1_message_proto_depIdxs,
804 > MessageInfos: file_temporal_server_api_token_v1_message_proto_msgTypes,
805 > }.Build()
806 > File_temporal_server_api_token_v1_message_proto = out.File
807 > file_temporal_server_api_token_v1_message_proto_goTypes = nil
808 > file_temporal_server_api_token_v1_message_proto_depIdxs = nil
809 }
go.temporal.io/server/api/visibilityservice/v1/request_response.pb.go 20 covered LOC · 2 ranges

Open complete file

402 }
403
404 > func init() { file_temporal_server_api_visibilityservice_v1_request_response_proto_init() } request_response.pb.go
405 > func file_temporal_server_api_visibilityservice_v1_request_response_proto_init() {
406 > if File_temporal_server_api_visibilityservice_v1_request_response_proto != nil {
407 return
408 }
409 > type x struct{} request_response.pb.go
410 > out := protoimpl.TypeBuilder{
411 > File: protoimpl.DescBuilder{
412 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
413 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_visibilityservice_v1_request_response_proto_rawDesc), len(file_temporal_server_api_visibilityservice_v1_request_response_proto_rawDesc)),
414 > NumEnums: 0,
415 > NumMessages: 5,
416 > NumExtensions: 0,
417 > NumServices: 0,
418 > },
419 > GoTypes: file_temporal_server_api_visibilityservice_v1_request_response_proto_goTypes,
420 > DependencyIndexes: file_temporal_server_api_visibilityservice_v1_request_response_proto_depIdxs,
421 > MessageInfos: file_temporal_server_api_visibilityservice_v1_request_response_proto_msgTypes,
422 > }.Build()
423 > File_temporal_server_api_visibilityservice_v1_request_response_proto = out.File
424 > file_temporal_server_api_visibilityservice_v1_request_response_proto_goTypes = nil
425 > file_temporal_server_api_visibilityservice_v1_request_response_proto_depIdxs = nil
426 }
go.temporal.io/server/api/workflow/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

278 }
279
280 > func init() { file_temporal_server_api_workflow_v1_message_proto_init() } message.pb.go
281 > func file_temporal_server_api_workflow_v1_message_proto_init() {
282 > if File_temporal_server_api_workflow_v1_message_proto != nil {
283 return
284 }
285 > type x struct{} message.pb.go
286 > out := protoimpl.TypeBuilder{
287 > File: protoimpl.DescBuilder{
288 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
289 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_workflow_v1_message_proto_rawDesc), len(file_temporal_server_api_workflow_v1_message_proto_rawDesc)),
290 > NumEnums: 0,
291 > NumMessages: 3,
292 > NumExtensions: 0,
293 > NumServices: 0,
294 > },
295 > GoTypes: file_temporal_server_api_workflow_v1_message_proto_goTypes,
296 > DependencyIndexes: file_temporal_server_api_workflow_v1_message_proto_depIdxs,
297 > MessageInfos: file_temporal_server_api_workflow_v1_message_proto_msgTypes,
298 > }.Build()
299 > File_temporal_server_api_workflow_v1_message_proto = out.File
300 > file_temporal_server_api_workflow_v1_message_proto_goTypes = nil
301 > file_temporal_server_api_workflow_v1_message_proto_depIdxs = nil
302 }
go.temporal.io/server/chasm/lib/callback/gen/callbackpb/v1/tasks.pb.go 20 covered LOC · 2 ranges

Open complete file

148 }
149
150 > func init() { file_temporal_server_chasm_lib_callback_proto_v1_tasks_proto_init() } tasks.pb.go
151 > func file_temporal_server_chasm_lib_callback_proto_v1_tasks_proto_init() {
152 > if File_temporal_server_chasm_lib_callback_proto_v1_tasks_proto != nil {
153 return
154 }
155 > type x struct{} tasks.pb.go
156 > out := protoimpl.TypeBuilder{
157 > File: protoimpl.DescBuilder{
158 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
159 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_callback_proto_v1_tasks_proto_rawDesc), len(file_temporal_server_chasm_lib_callback_proto_v1_tasks_proto_rawDesc)),
160 > NumEnums: 0,
161 > NumMessages: 2,
162 > NumExtensions: 0,
163 > NumServices: 0,
164 > },
165 > GoTypes: file_temporal_server_chasm_lib_callback_proto_v1_tasks_proto_goTypes,
166 > DependencyIndexes: file_temporal_server_chasm_lib_callback_proto_v1_tasks_proto_depIdxs,
167 > MessageInfos: file_temporal_server_chasm_lib_callback_proto_v1_tasks_proto_msgTypes,
168 > }.Build()
169 > File_temporal_server_chasm_lib_callback_proto_v1_tasks_proto = out.File
170 > file_temporal_server_chasm_lib_callback_proto_v1_tasks_proto_goTypes = nil
171 > file_temporal_server_chasm_lib_callback_proto_v1_tasks_proto_depIdxs = nil
172 }
go.temporal.io/server/chasm/lib/nexusoperation/gen/nexusoperationpb/v1/service.pb.go 20 covered LOC · 2 ranges

Open complete file

71 }
72
73 > func init() { file_temporal_server_chasm_lib_nexusoperation_proto_v1_service_proto_init() } service.pb.go
74 > func file_temporal_server_chasm_lib_nexusoperation_proto_v1_service_proto_init() {
75 > if File_temporal_server_chasm_lib_nexusoperation_proto_v1_service_proto != nil {
76 return
77 }
78 > file_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto_init() service.pb.go
79 > type x struct{}
80 > out := protoimpl.TypeBuilder{
81 > File: protoimpl.DescBuilder{
82 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
83 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_nexusoperation_proto_v1_service_proto_rawDesc), len(file_temporal_server_chasm_lib_nexusoperation_proto_v1_service_proto_rawDesc)),
84 > NumEnums: 0,
85 > NumMessages: 0,
86 > NumExtensions: 0,
87 > NumServices: 1,
88 > },
89 > GoTypes: file_temporal_server_chasm_lib_nexusoperation_proto_v1_service_proto_goTypes,
90 > DependencyIndexes: file_temporal_server_chasm_lib_nexusoperation_proto_v1_service_proto_depIdxs,
91 > }.Build()
92 > File_temporal_server_chasm_lib_nexusoperation_proto_v1_service_proto = out.File
93 > file_temporal_server_chasm_lib_nexusoperation_proto_v1_service_proto_goTypes = nil
94 > file_temporal_server_chasm_lib_nexusoperation_proto_v1_service_proto_depIdxs = nil
95 }
go.temporal.io/server/chasm/lib/nexusoperation/gen/nexusoperationpb/v1/tasks.pb.go 20 covered LOC · 2 ranges

Open complete file

354 }
355
356 > func init() { file_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto_init() } tasks.pb.go
357 > func file_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto_init() {
358 > if File_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto != nil {
359 return
360 }
361 > type x struct{} tasks.pb.go
362 > out := protoimpl.TypeBuilder{
363 > File: protoimpl.DescBuilder{
364 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
365 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto_rawDesc), len(file_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto_rawDesc)),
366 > NumEnums: 0,
367 > NumMessages: 7,
368 > NumExtensions: 0,
369 > NumServices: 0,
370 > },
371 > GoTypes: file_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto_goTypes,
372 > DependencyIndexes: file_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto_depIdxs,
373 > MessageInfos: file_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto_msgTypes,
374 > }.Build()
375 > File_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto = out.File
376 > file_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto_goTypes = nil
377 > file_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto_depIdxs = nil
378 }
go.temporal.io/server/chasm/lib/workflow/gen/workflowpb/v1/state.pb.go 20 covered LOC · 2 ranges

Open complete file

211 }
212
213 > func init() { file_temporal_server_chasm_lib_workflow_proto_v1_state_proto_init() } state.pb.go
214 > func file_temporal_server_chasm_lib_workflow_proto_v1_state_proto_init() {
215 > if File_temporal_server_chasm_lib_workflow_proto_v1_state_proto != nil {
216 return
217 }
218 > type x struct{} state.pb.go
219 > out := protoimpl.TypeBuilder{
220 > File: protoimpl.DescBuilder{
221 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
222 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_workflow_proto_v1_state_proto_rawDesc), len(file_temporal_server_chasm_lib_workflow_proto_v1_state_proto_rawDesc)),
223 > NumEnums: 0,
224 > NumMessages: 3,
225 > NumExtensions: 0,
226 > NumServices: 0,
227 > },
228 > GoTypes: file_temporal_server_chasm_lib_workflow_proto_v1_state_proto_goTypes,
229 > DependencyIndexes: file_temporal_server_chasm_lib_workflow_proto_v1_state_proto_depIdxs,
230 > MessageInfos: file_temporal_server_chasm_lib_workflow_proto_v1_state_proto_msgTypes,
231 > }.Build()
232 > File_temporal_server_chasm_lib_workflow_proto_v1_state_proto = out.File
233 > file_temporal_server_chasm_lib_workflow_proto_v1_state_proto_goTypes = nil
234 > file_temporal_server_chasm_lib_workflow_proto_v1_state_proto_depIdxs = nil
235 }
go.temporal.io/server/chasm/lib/workflow/gen/workflowpb/v1/update_state.pb.go 20 covered LOC · 2 ranges

Open complete file

113 }
114
115 > func init() { file_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto_init() } update_state.pb.go
116 > func file_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto_init() {
117 > if File_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto != nil {
118 return
119 }
120 > type x struct{} update_state.pb.go
121 > out := protoimpl.TypeBuilder{
122 > File: protoimpl.DescBuilder{
123 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
124 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto_rawDesc), len(file_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto_rawDesc)),
125 > NumEnums: 0,
126 > NumMessages: 1,
127 > NumExtensions: 0,
128 > NumServices: 0,
129 > },
130 > GoTypes: file_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto_goTypes,
131 > DependencyIndexes: file_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto_depIdxs,
132 > MessageInfos: file_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto_msgTypes,
133 > }.Build()
134 > File_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto = out.File
135 > file_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto_goTypes = nil
136 > file_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto_depIdxs = nil
137 }
go.temporal.io/server/common/util/wildcard.go 20 covered LOC · 7 ranges

Open complete file

18 // WildCardStringToRegexps converts a given slices of string patterns to a slice of regular expressions matching
19 // wildcards (*) with any substring.
20 > func WildCardStringsToRegexp(patterns []string) (*regexp.Regexp, error) { wildcard.go
21 > var result strings.Builder
22 > result.WriteRune('^')
23 > for i, pattern := range patterns {
24 > result.WriteRune('(')
25 > first := true
26 > for literal := range strings.SplitSeq(pattern, "*") {
27 > if !first {
28 // Replace * with .*
29 result.WriteString(".*")
30 }
31 > result.WriteString(regexp.QuoteMeta(literal)) wildcard.go
32 > first = false
33 }
34 > result.WriteRune(')') wildcard.go
35 > if i < len(patterns)-1 {
36 > result.WriteRune('|') wildcard.go
37 > }
38 }
39 > result.WriteRune('$') wildcard.go
40 > return regexp.Compile(result.String())
41 }
42
43 // MustWildCardStringsToRegexp is like WildCardStringsToRegexp but panics on error.
44 > func MustWildCardStringsToRegexp(patterns []string) *regexp.Regexp { wildcard.go
45 > re, err := WildCardStringsToRegexp(patterns)
46 > if err != nil {
47 panic(err) //nolint:forbidigo // Must* functions conventionally panic on error.
48 }
49 > return re wildcard.go
50 }
go.temporal.io/server/service/history/tasks/key.go 20 covered LOC · 7 ranges

Open complete file

28 )
29
30 > func NewImmediateKey(taskID int64) Key { key.go
31 > return Key{
32 > FireTime: DefaultFireTime,
33 > TaskID: taskID,
34 > }
35 > }
36
37 > func NewKey(fireTime time.Time, taskID int64) Key { key.go
38 > return Key{
39 > FireTime: fireTime,
40 > TaskID: taskID,
41 > }
42 > }
43
44 func ValidateKey(key Key) error {
54 }
55
56 > func (left Key) CompareTo(right Key) int { key.go
57 > if left.FireTime.Before(right.FireTime) {
58 return -1
59 > } else if left.FireTime.After(right.FireTime) { key.go
60 > return 1 key.go
61 > }
62
63 if left.TaskID < right.TaskID {
109 }
110
111 > func MinKey(this Key, that Key) Key { key.go
112 > if this.CompareTo(that) < 0 {
113 return this
114 }
115 > return that key.go
116 }
117
go.temporal.io/server/common/finalizer/finalizer.go 19 covered LOC · 5 ranges

Open complete file

31 logger log.Logger,
32 metricsHandler metrics.Handler,
33 > ) *Finalizer { finalizer.go
34 > return &Finalizer{
35 > logger: logger,
36 > metricsHandler: metricsHandler,
37 > callbacks: make(map[string]func(context.Context) error),
38 > }
39 > }
40
41 // Register adds a callback to the finalizer.
85 func (f *Finalizer) Run(
86 timeout time.Duration,
87 > ) int { finalizer.go
88 > if timeout == 0 {
89 f.logger.Debug("finalizer skipped: zero timeout")
90 return 0
91 }
92
93 > f.mu.Lock() finalizer.go
94 > if f.finalized {
95 f.logger.Warn("finalizer skipped: called more than once")
96 f.mu.Unlock()
97 return 0
98 }
99 > f.finalized = true finalizer.go
100 > f.mu.Unlock() // unlocking immediately to unblock any calls to Register/Deregister
101 >
102 > totalCount := len(f.callbacks)
103 > if totalCount == 0 {
104 > f.logger.Debug("finalizer skipped: no callbacks") finalizer.go
105 > return 0
106 > }
107
108 f.logger.Debug("finalizer starting",
go.temporal.io/server/common/headers/headers.go 18 covered LOC · 7 ranges

Open complete file

45 // GetValues returns header values for passed header names.
46 // It always returns slice of the same size as number of passed header names.
47 > func GetValues(ctx context.Context, headerNames ...string) []string { headers.go
48 > headerValues := make([]string, len(headerNames))
49 >
50 > for i, headerName := range headerNames {
51 > if values := metadata.ValueFromIncomingContext(ctx, headerName); len(values) > 0 {
52 > headerValues[i] = values[0] headers.go
53 > }
54 }
55
56 > return headerValues headers.go
57 }
58
154 // setIncomingMD sets the key-value pairs in the incoming metadata.
155 // Empty values are ignored.
156 > func setIncomingMD(ctx context.Context, kv map[string]string) context.Context { headers.go
157 > mdIncoming, ok := metadata.FromIncomingContext(ctx)
158 > if !ok {
159 > mdIncoming = metadata.MD{} headers.go
160 > }
161 > for k, v := range kv { headers.go
162 > if v != "" {
163 > mdIncoming.Set(k, v)
164 > }
165 }
166 > return metadata.NewIncomingContext(ctx, mdIncoming) headers.go
167 }
go.temporal.io/server/common/metrics/registry.go 18 covered LOC · 5 ranges

Open complete file

43
44 // register adds a metric definition to the list of pending metric definitions. This method is thread-safe.
45 > func (c *registry) register(d metricDefinition) { registry.go
46 > c.Lock()
47 > defer c.Unlock()
48 > c.definitions = append(c.definitions, d)
49 > }
50
51 // buildCatalog builds a catalog from the list of pending metric definitions. It is safe to call this method multiple
52 // times. This method is thread-safe.
53 > func (c *registry) buildCatalog() (catalog, error) { registry.go
54 > c.Lock()
55 > defer c.Unlock()
56 >
57 > r := make(catalog, len(c.definitions))
58 > for _, d := range c.definitions {
59 > if original, ok := r[d.name]; ok {
60 return nil, fmt.Errorf(
61 "%w: metric %q already defined with %+v. Cannot redefine with %+v",
64 }
65
66 > r[d.name] = d registry.go
67 }
68
69 > return r, nil registry.go
70 }
71
72 > func (c catalog) getMetric(name string) (metricDefinition, bool) { registry.go
73 > def, ok := c[name]
74 > return def, ok
75 > }
go.temporal.io/server/service/history/shard/engine_factory_mock.go 18 covered LOC · 4 ranges

Open complete file

30
31 // NewMockEngineFactory creates a new mock instance.
32 > func NewMockEngineFactory(ctrl *gomock.Controller) *MockEngineFactory { engine_factory_mock.go
33 > mock := &MockEngineFactory{ctrl: ctrl}
34 > mock.recorder = &MockEngineFactoryMockRecorder{mock}
35 > return mock
36 > }
37
38 // EXPECT returns an object that allows the caller to indicate expected use.
39 > func (m *MockEngineFactory) EXPECT() *MockEngineFactoryMockRecorder { engine_factory_mock.go
40 > return m.recorder
41 > }
42
43 // CreateEngine mocks base method.
44 > func (m *MockEngineFactory) CreateEngine(context interfaces.ShardContext) interfaces.Engine { engine_factory_mock.go
45 > m.ctrl.T.Helper()
46 > ret := m.ctrl.Call(m, "CreateEngine", context)
47 > ret0, _ := ret[0].(interfaces.Engine)
48 > return ret0
49 > }
50
51 // CreateEngine indicates an expected call of CreateEngine.
52 > func (mr *MockEngineFactoryMockRecorder) CreateEngine(context any) *gomock.Call { engine_factory_mock.go
53 > mr.mock.ctrl.T.Helper()
54 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateEngine", reflect.TypeOf((*MockEngineFactory)(nil).CreateEngine), context)
55 > }
go.temporal.io/server/common/backoff/retry.go 17 covered LOC · 5 ranges

Open complete file

39 // ThrottleRetry is a resource aware version of Retry.
40 // Resource exhausted error will be retried using a different throttle retry policy, instead of the specified one.
41 > func ThrottleRetry(operation Operation, policy RetryPolicy, isRetryable IsRetryable) error { retry.go
42 > ctxOp := func(context.Context) error { return operation() }
43 > return ThrottleRetryContext(context.Background(), ctxOp, policy, isRetryable)
44 }
45
53 policy RetryPolicy,
54 isRetryable IsRetryable,
55 > ) error { retry.go
56 > var err error
57 > var next time.Duration
58 >
59 > if isRetryable == nil {
60 isRetryable = func(error) bool { return true }
61 }
62
63 > deadline, hasDeadline := ctx.Deadline() retry.go
64 >
65 > timeSrc := clock.NewRealTimeSource()
66 > r := NewRetrier(policy, timeSrc)
67 > t := NewRetrier(throttleRetryPolicy, timeSrc)
68 > for ctx.Err() == nil {
69 > if err = operation(ctx); err == nil { retry.go
70 > return nil retry.go
71 > }
72
73 if next = r.NextBackOff(err); next == done {
go.temporal.io/server/service/history/events/cache.go 16 covered LOC · 2 ranges

Open complete file

70 logger log.Logger,
71 disabled bool,
72 > ) Cache { cache.go
73 > return newEventsCache(executionManager, handler, logger, config.EventsShardLevelCacheMaxSizeBytes(), config.EventsCacheTTL(), disabled)
74 > }
75
76 func newEventsCache(
81 ttl time.Duration,
82 disabled bool,
83 > ) *CacheImpl { cache.go
84 > opts := &cache.Options{}
85 > opts.TTL = ttl
86 >
87 > taggedMetricHandler := metricsHandler.WithTags(metrics.CacheTypeTag(metrics.EventsCacheTypeTagValue))
88 > return &CacheImpl{
89 > Cache: cache.NewWithMetrics(maxSize, opts, taggedMetricHandler),
90 > executionManager: executionManager,
91 > metricsHandler: taggedMetricHandler,
92 > logger: logger,
93 > disabled: disabled,
94 > }
95 > }
96
97 func (e *CacheImpl) validateKey(key EventKey) bool {
go.temporal.io/server/common/headers/caller_info.go 15 covered LOC · 2 ranges

Open complete file

117 ctx context.Context,
118 info CallerInfo,
119 > ) context.Context { caller_info.go
120 > return setIncomingMD(ctx, map[string]string{
121 > CallerNameHeaderName: info.CallerName,
122 > CallerTypeHeaderName: info.CallerType,
123 > CallOriginHeaderName: info.CallOrigin,
124 > })
125 > }
126
127 // SetCallerName set caller name in the context.
156 func GetCallerInfo(
157 ctx context.Context,
158 > ) CallerInfo { caller_info.go
159 > values := GetValues(ctx, CallerNameHeaderName, CallerTypeHeaderName, CallOriginHeaderName)
160 > return CallerInfo{
161 > CallerName: values[0],
162 > CallerType: values[1],
163 > CallOrigin: values[2],
164 > }
165 > }
go.temporal.io/server/common/metrics/tags.go 15 covered LOC · 5 ranges

Open complete file

447 }
448
449 > func ServiceNameTag(value primitives.ServiceName) Tag { tags.go
450 > return Tag{Key: serviceName, Value: string(value)}
451 > }
452
453 func ActionType(value string) Tag {
455 }
456
457 > func OperationTag(value string) Tag { tags.go
458 > return Tag{Key: OperationTagName, Value: value}
459 > }
460
461 > func StringTag(key string, value string) Tag { tags.go
462 > return Tag{Key: key, Value: value}
463 > }
464
465 > func CacheTypeTag(value string) Tag { tags.go
466 > return Tag{Key: CacheTypeTagName, Value: value}
467 > }
468
469 > func PriorityTag(value locks.Priority) Tag { tags.go
470 > return Tag{Key: PriorityTagName, Value: strconv.Itoa(int(value))}
471 > }
472
473 // ReasonString is just a string but the special type is defined here to remind callers of ReasonTag to limit the
go.temporal.io/server/common/namespace/replication_resolver.go 15 covered LOC · 2 ranges

Open complete file

49 }
50
51 > func NewDefaultReplicationResolverFactory() ReplicationResolverFactory { replication_resolver.go
52 > return func(detail *persistencespb.NamespaceDetail) ReplicationResolver {
53 > // By convention, a namespace with non-zero failover version is a global namespace
54 > // This can be overridden by WithGlobalFlag mutation if needed
55 > isGlobal := detail.FailoverVersion != 0
56 > return &defaultReplicationResolver{
57 > replicationConfig: detail.ReplicationConfig,
58 > isGlobalNamespace: isGlobal,
59 > failoverVersion: detail.FailoverVersion,
60 > failoverNotificationVersion: detail.FailoverNotificationVersion,
61 > }
62 > }
63 }
64
112 }
113
114 > func (r *defaultReplicationResolver) SetGlobalFlag(isGlobal bool) { replication_resolver.go
115 > r.isGlobalNamespace = isGlobal
116 > }
117
118 func (r *defaultReplicationResolver) SetActiveCluster(clusterName string) {
go.temporal.io/server/common/persistence/visibility/store/sql/query_converter_util_legacy.go 15 covered LOC · 3 ranges

Open complete file

68 }
69
70 > func newColName(name string) *colName { query_converter_util_legacy.go
71 > return &colName{Name: name}
72 > }
73
74 func newSAColName(
77 fieldName string,
78 valueType enumspb.IndexedValueType,
79 > ) *saColName { query_converter_util_legacy.go
80 > return &saColName{
81 > dbColName: newColName(dbColName),
82 > alias: alias,
83 > fieldName: fieldName,
84 > valueType: valueType,
85 > }
86 > }
87
88 func newFuncExpr(name string, exprs ...sqlparser.Expr) *sqlparser.FuncExpr {
105 }
106
107 > func getMaxDatetimeValue() time.Time { query_converter_util_legacy.go
108 > t, _ := time.Parse(time.RFC3339, "9999-12-31T23:59:59Z")
109 > return t
110 > }
111
112 // formatComparisonExprStringForError formats comparison expression after
go.temporal.io/server/service/history/tasks/task_category_registry.go 15 covered LOC · 2 ranges

Open complete file

26 // each entry point that uses it. Essentially, get it from the dependency graph instead of calling this method, unless
27 // you're in a test.
28 > func NewDefaultTaskCategoryRegistry() *MutableTaskCategoryRegistry { task_category_registry.go
29 > return &MutableTaskCategoryRegistry{
30 > categories: map[int]Category{
31 > CategoryTransfer.ID(): CategoryTransfer,
32 > CategoryTimer.ID(): CategoryTimer,
33 > CategoryVisibility.ID(): CategoryVisibility,
34 > CategoryReplication.ID(): CategoryReplication,
35 > CategoryMemoryTimer.ID(): CategoryMemoryTimer,
36 > CategoryOutbound.ID(): CategoryOutbound,
37 > },
38 > }
39 > }
40
41 // AddCategory register a Category with the registry or panics if a Category with the same ID has already been
61
62 // GetCategories returns a deep copy of all registered Category objects from the registry.
63 > func (r *MutableTaskCategoryRegistry) GetCategories() map[int]Category { task_category_registry.go
64 > return maps.Clone(r.categories)
65 > }
go.temporal.io/server/common/build/build.go 14 covered LOC · 2 ranges

Open complete file

27 )
28
29 > func init() { build.go
30 > buildInfo, ok := debug.ReadBuildInfo()
31 > if !ok {
32 return
33 }
34
35 > InfoData.Available = true build.go
36 > InfoData.GoVersion = buildInfo.GoVersion
37 >
38 > for _, setting := range buildInfo.Settings {
39 > switch setting.Key {
40 > case "GOARCH":
41 > InfoData.GoArch = setting.Value
42 > case "GOOS":
43 > InfoData.GoOs = setting.Value
44 > case "CGO_ENABLED":
45 > InfoData.CgoEnabled = setting.Value == "1"
46 case "vcs.revision":
47 InfoData.GitRevision = setting.Value
go.temporal.io/server/common/dynamicconfig/gradual_change.go 14 covered LOC · 3 ranges

Open complete file

25 // StaticGradualChange returns a GradualChange whose Value always returns def and whose When
26 // always returns a time in the past.
27 > func StaticGradualChange[T any](def T) GradualChange[T] { gradual_change.go
28 > return GradualChange[T]{New: def}
29 > }
30
31 // Value returns the value for the given key at the given time.
56 // of type GradualChange into a GradualChange.
57 // nolint:revive // cognitive-complexity // this looks complicated but each case is fairly simple
58 > func ConvertGradualChange[T any](def T) func(v any) (GradualChange[T], error) { gradual_change.go
59 > changeConverter := ConvertStructure(StaticGradualChange(def))
60 >
61 > // Call this once so that if it's going to panic, it panics at static init time.
62 > _, _ = changeConverter(nil)
63 >
64 > switch reflect.TypeFor[T]() {
65 > case reflect.TypeFor[bool]():
66 > return func(v any) (GradualChange[T], error) {
67 if b, err := convertBool(v); err == nil {
68 var change GradualChange[T]
72 return changeConverter(v)
73 }
74 > case reflect.TypeFor[int](): gradual_change.go
75 > return func(v any) (GradualChange[T], error) {
76 if i, err := convertInt(v); err == nil {
77 var change GradualChange[T]
go.temporal.io/server/common/metrics/defs_base.go 13 covered LOC · 2 ranges

Open complete file

10 }
11
12 > func newMetricDefinition(name string, opts ...Option) metricDefinition { defs_base.go
13 > d := metricDefinition{
14 > name: name,
15 > description: "",
16 > unit: "",
17 > }
18 > for _, opt := range opts {
19 > opt.apply(&d)
20 > }
21 > return d
22 }
23
24 > func (md metricDefinition) Name() string { defs_base.go
25 > return md.name
26 > }
27
28 func (md metricDefinition) Unit() MetricUnit {
go.temporal.io/server/service/history/shard/handover_tracker.go 13 covered LOC · 3 ranges

Open complete file

63
64 // NewDefaultHandoverTrackerFactory returns a factory that creates the default OSS HandoverTracker.
65 > func NewDefaultHandoverTrackerFactory() HandoverTrackerFactory { handover_tracker.go
66 > return func(params HandoverTrackerParams) HandoverTracker {
67 > return &defaultHandoverTracker{ handover_tracker.go
68 > handoverNamespaces: make(map[namespace.Name]*namespaceHandOverInfo),
69 > clusterMetadata: params.ClusterMetadata,
70 > getMaxReplicationTaskID: params.GetMaxReplicationTaskID,
71 > errorByStateFn: params.ErrorByStateFn,
72 > notifyReplicationFn: params.NotifyReplicationFn,
73 > logger: params.Logger,
74 > }
75 > }
76 }
77
128 }
129
130 > func (t *defaultHandoverTracker) ResolvePendingTaskIDs(maxReplicationTaskID int64) { handover_tracker.go
131 > for _, handoverInfo := range t.handoverNamespaces {
132 if handoverInfo.MaxReplicationTaskID == PendingMaxReplicationTaskID {
133 handoverInfo.MaxReplicationTaskID = maxReplicationTaskID
go.temporal.io/server/common/persistence/visibility/store/elasticsearch/visibility_store.go 12 covered LOC · 3 ranges

Open complete file

101 }
102
103 > defaultSorter = func() []elastic.Sorter { visibility_store.go
104 > ret := make([]elastic.Sorter, 0, len(defaultSorterFields))
105 > for _, item := range defaultSorterFields {
106 > fs := elastic.NewFieldSort(item.name)
107 > if item.desc {
108 > fs.Desc()
109 > }
110 > if item.missing_first {
111 > fs.Missing("_first")
112 > } else {
113 fs.Missing("_last")
114 }
115 > ret = append(ret, fs) visibility_store.go
116 }
117 > return ret visibility_store.go
118 }()
119
go.temporal.io/server/service/history/tasks/fake_task.go 12 covered LOC · 2 ranges

Open complete file

23 category Category,
24 visibilityTimestamp time.Time,
25 > ) Task { fake_task.go
26 > return &FakeTask{
27 > WorkflowKey: workflowKey,
28 > TaskID: common.EmptyEventTaskID,
29 > Version: common.EmptyVersion,
30 > VisibilityTimestamp: visibilityTimestamp,
31 > Category: category,
32 > }
33 > }
34
35 func (f *FakeTask) GetKey() Key {
52 }
53
54 > func (f *FakeTask) SetTaskID(id int64) { fake_task.go
55 > f.TaskID = id
56 > }
57
58 func (f *FakeTask) GetVisibilityTime() time.Time {
go.temporal.io/server/common/util/util.go 11 covered LOC · 4 ranges

Open complete file

20
21 // MaxTime returns the latest of the given time.Time values.
22 > func MaxTime(first time.Time, rest ...time.Time) time.Time { util.go
23 > latest := first
24 > for _, t := range rest {
25 > if t.After(latest) {
26 > latest = t util.go
27 > }
28 }
29 > return latest util.go
30 }
31
68
69 // InverseMap creates the inverse map, ie., for a key-value map, it builds the value-key map.
70 > func InverseMap[M ~map[K]V, K, V comparable](m M) map[V]K { util.go
71 > if m == nil {
72 > return nil
73 > }
74 invm := make(map[V]K, len(m))
75 for k, v := range m {
go.temporal.io/server/service/history/tests/vars.go 11 covered LOC · 1 range

Open complete file

158 )
159
160 > func NewDynamicConfig() *configs.Config { vars.go
161 > dc := dynamicconfig.NewNoopCollection()
162 > config := configs.NewConfig(dc, 1)
163 > config.EnableActivityEagerExecution = dynamicconfig.GetBoolPropertyFnFilteredByNamespace(true)
164 > config.NamespaceCacheRefreshInterval = dynamicconfig.GetDurationPropertyFn(time.Second)
165 > config.ReplicationEnableUpdateWithNewTaskMerge = dynamicconfig.GetBoolPropertyFn(true)
166 > config.EnableWorkflowIdReuseStartTimeValidation = dynamicconfig.GetBoolPropertyFnFilteredByNamespace(true)
167 > config.EnableTransitionHistory = dynamicconfig.GetBoolPropertyFnFilteredByNamespace(true)
168 > config.EnableChasm = dynamicconfig.GetBoolPropertyFnFilteredByNamespace(false)
169 > return config
170 > }
go.temporal.io/server/common/persistence/serialization/serializer.go 10 covered LOC · 3 ranges

Open complete file

139 )
140
141 > func NewSerializer() Serializer { serializer.go
142 > return &serializerImpl{encodingType: encodingTypeFromEnv()}
143 > }
144
145 func (t *serializerImpl) EncodingType() enumspb.EncodingType {
669 }
670
671 > func (t *serializerImpl) QueueStateToBlob(info *persistencespb.QueueState) (*commonpb.DataBlob, error) { serializer.go
672 > return encodeBlob(info, t.encodingType)
673 > }
674
675 > func (t *serializerImpl) QueueStateFromBlob(data *commonpb.DataBlob) (*persistencespb.QueueState, error) { serializer.go
676 > result := &persistencespb.QueueState{}
677 > return result, Decode(data, result)
678 > }
679
680 // ReencodeEventBlobsAsProto3 re-encodes event blobs as proto3 if the serializer uses a different encoding.
go.temporal.io/server/common/persistence/sql/sqlplugin/postgresql/plugin.go 10 covered LOC · 1 range

Open complete file

36 var _ sqlplugin.Plugin = (*plugin)(nil)
37
38 > func init() { plugin.go
39 > sql.RegisterPlugin(PluginName, &plugin{
40 > driver: &driver.PQDriver{},
41 > queryConverter: &queryConverter{},
42 > })
43 > sql.RegisterPlugin(PluginNamePGX, &plugin{
44 > driver: &driver.PGXDriver{},
45 > queryConverter: &queryConverter{},
46 > })
47 > }
48
49 func (p *plugin) GetVisibilityQueryConverter() sqlplugin.VisibilityQueryConverter {
go.temporal.io/server/common/persistence/sql/sqlplugin/postgresql/visibility.go 10 covered LOC · 1 range

Open complete file

40 )
41
42 > func buildOnDuplicateKeyUpdate(fields ...string) string { visibility.go
43 > items := make([]string, len(fields))
44 > for i, field := range fields {
45 > items[i] = fmt.Sprintf("%s = excluded.%s", field, field)
46 > }
47 > return fmt.Sprintf(
48 > // The WHERE clause ensures that no update occurs if the version is behind the saved version.
49 > "ON CONFLICT (namespace_id, run_id) DO UPDATE SET %s WHERE executions_visibility.%s < EXCLUDED.%s",
50 > strings.Join(items, ", "), sqlplugin.VersionColumnName, sqlplugin.VersionColumnName,
51 > )
52 }
53
go.temporal.io/server/common/persistence/sql/sqlplugin/sqlite/visibility.go 10 covered LOC · 1 range

Open complete file

42 )
43
44 > func buildOnDuplicateKeyUpdate(fields ...string) string { visibility.go
45 > items := make([]string, len(fields))
46 > for i, field := range fields {
47 > items[i] = fmt.Sprintf("%s = excluded.%s", field, field)
48 > }
49 > return fmt.Sprintf(
50 > // The WHERE clause ensures that no update occurs if the version is behind the saved version.
51 > "ON CONFLICT (namespace_id, run_id) DO UPDATE SET %s WHERE executions_visibility.%s < EXCLUDED.%s",
52 > strings.Join(items, ", "), sqlplugin.VersionColumnName, sqlplugin.VersionColumnName,
53 > )
54 }
55
go.temporal.io/server/common/persistence/sql/sqlplugin/visibility.go 10 covered LOC · 2 ranges

Open complete file

219 }
220
221 > func getDbFields() []string { visibility.go
222 > t := reflect.TypeFor[VisibilityRow]()
223 > dbFields := make([]string, t.NumField())
224 > for i := 0; i < t.NumField(); i++ {
225 > f := t.Field(i)
226 > dbFields[i] = f.Tag.Get("db")
227 > if dbFields[i] == "" {
228 > dbFields[i] = strcase.ToSnake(f.Name)
229 > }
230 }
231 > return dbFields visibility.go
232 }
233
go.temporal.io/server/common/persistence/visibility/store/query/util.go 10 covered LOC · 2 ranges

Open complete file

70 }
71
72 > func NewUnsafeSQLString(val string) *UnsafeSQLString { util.go
73 > return &UnsafeSQLString{Val: val}
74 > }
75
76 func NewColName(name string) *ColumnName {
78 }
79
80 > func NewSAColumn(alias string, fieldName string, valueType enumspb.IndexedValueType) *SAColumn { util.go
81 > return &SAColumn{
82 > Alias: alias,
83 > FieldName: fieldName,
84 > ValueType: valueType,
85 > }
86 > }
87
88 func NamespaceDivisionSAColumn() *SAColumn {
go.temporal.io/server/common/rpc/context.go 10 covered LOC · 3 ranges

Open complete file

16 )
17
18 > func (c *valueCopyCtx) Value(key any) any { context.go
19 > if value := c.Context.Value(key); value != nil {
20 > return value context.go
21 > }
22
23 return c.valueCtx.Value(key)
25
26 // CopyContextValues copies values in source Context to destination Context.
27 > func CopyContextValues(dst context.Context, src context.Context) context.Context { context.go
28 > return &valueCopyCtx{
29 > Context: dst,
30 > valueCtx: src,
31 > }
32 > }
33
34 // ResetContextTimeout creates new context with specified timeout and copies values from source Context.
go.temporal.io/server/common/searchattribute/search_attribute_mock.go 10 covered LOC · 2 ranges

Open complete file

31
32 // NewMockProvider creates a new mock instance.
33 > func NewMockProvider(ctrl *gomock.Controller) *MockProvider { search_attribute_mock.go
34 > mock := &MockProvider{ctrl: ctrl}
35 > mock.recorder = &MockProviderMockRecorder{mock}
36 > return mock
37 > }
38
39 // EXPECT returns an object that allows the caller to indicate expected use.
70
71 // NewMockManager creates a new mock instance.
72 > func NewMockManager(ctrl *gomock.Controller) *MockManager { search_attribute_mock.go
73 > mock := &MockManager{ctrl: ctrl}
74 > mock.recorder = &MockManagerMockRecorder{mock}
75 > return mock
76 > }
77
78 // EXPECT returns an object that allows the caller to indicate expected use.
go.temporal.io/server/common/archiver/archival_metadata.go 9 covered LOC · 1 range

Open complete file

127
128 // NewDisabledArchvialConfig returns an ArchivalConfig where archival is disabled for both the cluster and the namespace
129 > func NewDisabledArchvialConfig() ArchivalConfig { archival_metadata.go
130 > return &archivalConfig{
131 > staticClusterState: ArchivalDisabled,
132 > dynamicClusterState: nil,
133 > enableRead: nil,
134 > namespaceDefaultState: enumspb.ARCHIVAL_STATE_DISABLED,
135 > namespaceDefaultURI: "",
136 > }
137 > }
138
139 // NewEnabledArchivalConfig returns an ArchivalConfig where archival is enabled for both the cluster and the namespace
go.temporal.io/server/common/dynamicconfig/static_client.go 9 covered LOC · 4 ranges

Open complete file

10 )
11
12 > func (s StaticClient) GetValue(key Key) []ConstrainedValue { static_client.go
13 > if v, ok := s[key]; ok {
14 if cvs, ok := v.([]ConstrainedValue); ok {
15 return cvs
17 return []ConstrainedValue{{Value: v}}
18 }
19 > return nil static_client.go
20 }
21
22 // NewNoopClient returns a Client that has no keys (a Collection using it will always return
23 // default values).
24 > func NewNoopClient() Client { static_client.go
25 > return StaticClient(nil)
26 > }
27
28 // NewNoopCollection creates a new noop collection.
29 > func NewNoopCollection() *Collection { static_client.go
30 > return NewCollection(NewNoopClient(), log.NewNoopLogger())
31 > }
go.temporal.io/server/common/membership/hostinfo.go 9 covered LOC · 3 ranges

Open complete file

12
13 // NewHostInfoFromAddress creates a new HostInfo instance from a socket address.
14 > func NewHostInfoFromAddress(address string) HostInfo { hostinfo.go
15 > return hostAddress(address)
16 > }
17
18 // hostAddress is a HostInfo implementation that uses a string as the address and identity.
20
21 // GetAddress returns the value of the hostAddress.
22 > func (a hostAddress) GetAddress() string { hostinfo.go
23 > return string(a)
24 > }
25
26 // Identity returns the value of the hostAddress.
27 > func (a hostAddress) Identity() string { hostinfo.go
28 > return string(a)
29 > }
go.temporal.io/server/common/metrics/noop_impl.go 9 covered LOC · 5 ranges

Open complete file

15 )
16
17 > func newNoopMetricsHandler() *noopMetricsHandler { return &noopMetricsHandler{} } noop_impl.go
18
19 // WithTags creates a new MetricProvder with provided []Tag
29
30 // Gauge obtains a gauge for the given name.
31 > func (*noopMetricsHandler) Gauge(string) GaugeIface { noop_impl.go
32 > return NoopGaugeMetricFunc
33 > }
34
35 // Timer obtains a timer for the given name.
36 > func (*noopMetricsHandler) Timer(string) TimerIface { noop_impl.go
37 > return NoopTimerMetricFunc
38 > }
39
40 // Histogram obtains a histogram for the given name.
54
55 var NoopCounterMetricFunc = CounterFunc(func(i int64, t ...Tag) {})
56 > var NoopGaugeMetricFunc = GaugeFunc(func(f float64, t ...Tag) {}) noop_impl.go
57 > var NoopTimerMetricFunc = TimerFunc(func(d time.Duration, t ...Tag) {}) noop_impl.go
58 var NoopHistogramMetricFunc = HistogramFunc(func(i int64, t ...Tag) {})
go.temporal.io/server/common/persistence/sql/sqlplugin/util.go 9 covered LOC · 2 ranges

Open complete file

5 )
6
7 > func appendPrefix(prefix string, fields []string) []string { util.go
8 > out := make([]string, len(fields))
9 > for i, field := range fields {
10 > out[i] = prefix + field
11 > }
12 > return out
13 }
14
15 > func BuildNamedPlaceholder(fields ...string) string { util.go
16 > return strings.Join(appendPrefix(":", fields), ", ")
17 > }
go.temporal.io/server/common/primitives/timestamp/duration.go 9 covered LOC · 3 ranges

Open complete file

26 }
27
28 > func DurationPtr(td time.Duration) *durationpb.Duration { duration.go
29 > return durationpb.New(td)
30 > }
31
32 func MinDurationPtr(d1 *durationpb.Duration, d2 *durationpb.Duration) *durationpb.Duration {
47 }
48
49 > func DurationFromDays(d int32) *durationpb.Duration { duration.go
50 > return durationMultipleOf(int64(d), time.Hour*24)
51 > }
52
53 > func durationMultipleOf(amt int64, mult time.Duration) *durationpb.Duration { duration.go
54 > return DurationPtr(time.Duration(amt) * mult)
55 > }
56
57 // ValidateAndCapProtoDuration validates protobuf durations for two conditions:
go.temporal.io/server/common/primitives/timestamp/time.go 9 covered LOC · 4 ranges

Open complete file

7 )
8
9 > func TimePtr(t time.Time) *timestamppb.Timestamp { time.go
10 > return timestamppb.New(t)
11 > }
12
13 > func TimeValue(t *timestamppb.Timestamp) time.Time { time.go
14 > if t == nil {
15 return time.Time{}
16 }
17 > return t.AsTime() time.go
18 }
19
46 }
47
48 > func TimeNowPtrUtc() *timestamppb.Timestamp { time.go
49 > return TimePtr(time.Now().UTC())
50 > }
go.temporal.io/server/common/testing/testhooks/test_impl.go 9 covered LOC · 2 ranges

Open complete file

89 var keyCounter atomic.Int64
90
91 > func newKey[T any, S any]() Key[T, S] { test_impl.go
92 > var zero S
93 > var s ScopeType
94 > switch any(zero).(type) {
95 > case namespace.ID, namespace.Name:
96 > s = ScopeNamespace
97 > case global:
98 > s = ScopeGlobal
99 default:
100 panic("testhooks: unknown scope type")
101 }
102 > return Key[T, S]{id: keyCounter.Add(1), scopeType: s} test_impl.go
103 }
go.temporal.io/server/service/history/tasks/category.go 9 covered LOC · 3 ranges

Open complete file

96 }
97
98 > func (c Category) ID() int { category.go
99 > return c.id
100 > }
101
102 > func (c Category) Name() string { category.go
103 > return c.name
104 > }
105
106 > func (c Category) Type() CategoryType { category.go
107 > return c.cType
108 > }
109
110 func (c Category) MarshalText() (text []byte, err error) {
go.temporal.io/server/common/archiver/metadata_mock.go 8 covered LOC · 1 range

Open complete file

20 // NewMetadataMock returns a new MetadataMock which uses the provided controller to create a MockArchivalMetadata
21 // instance.
22 > func NewMetadataMock(controller *gomock.Controller) MetadataMock { metadata_mock.go
23 > m := &metadataMock{
24 > MockArchivalMetadata: NewMockArchivalMetadata(controller),
25 > defaultHistoryConfig: NewDisabledArchvialConfig(),
26 > defaultVisibilityConfig: NewDisabledArchvialConfig(),
27 > }
28 > return m
29 > }
30
31 // MetadataMockRecorder is a wrapper around a ArchivalMetadata mock recorder.
go.temporal.io/server/common/namespace/mutate.go 8 covered LOC · 2 ranges

Open complete file

8 type mutationFunc func(*Namespace)
9
10 > func (f mutationFunc) apply(ns *Namespace) { mutate.go
11 > f(ns)
12 > }
13
14 // WithActiveCluster assigns the active cluster to a Namespace during a Clone
43
44 // WithGlobalFlag sets whether or not this Namespace is global.
45 > func WithGlobalFlag(b bool) Mutation { mutate.go
46 > return mutationFunc(
47 > func(ns *Namespace) {
48 > ns.replicationResolver.SetGlobalFlag(b)
49 > })
50 }
51
go.temporal.io/server/common/persistence/sql/sqlplugin/mysql/visibility.go 8 covered LOC · 1 range

Open complete file

73 )
74
75 > func buildOnDuplicateKeyUpdate(fields ...string) string { visibility.go
76 > items := make([]string, len(fields))
77 > for i, field := range fields {
78 > // This line is to ensure that no update occurs (for any column) if the version is behind the saved version.
79 > items[i] = fmt.Sprintf("%v = IF(%v < VALUES(%v), VALUES(%v), %v)",
80 > field, sqlplugin.VersionColumnName, sqlplugin.VersionColumnName, field, field)
81 > }
82 > return fmt.Sprintf("ON DUPLICATE KEY UPDATE %s", strings.Join(items, ", "))
83 }
84
go.temporal.io/server/common/tasks/priority.go 8 covered LOC · 2 ranges

Open complete file

59 )
60
61 > func (p Priority) String() string { priority.go
62 > s, ok := PriorityName[p]
63 > if ok {
64 > return s
65 > }
66 return strconv.Itoa(int(p))
67 }
77 func getPriority(
78 class, subClass Priority,
79 > ) Priority { priority.go
80 > return class | subClass
81 > }
go.temporal.io/server/chasm/statemachine.go 7 covered LOC · 1 range

Open complete file

34 // The apply function is called after verifying the transition is possible but before setting the destination state,
35 // so it can inspect the current (source) state.
36 > func NewTransition[S comparable, SM StateMachine[S], E any](src []S, dst S, apply func(SM, MutableContext, E) error) Transition[S, SM, E] { statemachine.go
37 > return Transition[S, SM, E]{
38 > Sources: src,
39 > Destination: dst,
40 > apply: apply,
41 > }
42 > }
43
44 // Possible returns a boolean indicating whether the transition is possible for the current state.
go.temporal.io/server/common/definition/workflow_key.go 7 covered LOC · 1 range

Open complete file

19 workflowID string,
20 runID string,
21 > ) WorkflowKey { workflow_key.go
22 > return WorkflowKey{
23 > NamespaceID: namespaceID,
24 > WorkflowID: workflowID,
25 > RunID: runID,
26 > }
27 > }
28
29 func (k *WorkflowKey) GetNamespaceID() string {
go.temporal.io/server/common/dynamicconfig/registry.go 7 covered LOC · 3 ranges

Open complete file

17 )
18
19 > func register(s GenericSetting) { registry.go
20 > if globalRegistry.queried.Load() {
21 panic("dynamicconfig.New*Setting must only be called from static initializers")
22 }
23 > if globalRegistry.settings == nil { registry.go
24 > globalRegistry.settings = make(map[Key]GenericSetting)
25 > }
26 > if globalRegistry.settings[s.Key()] != nil {
27 // nolint:forbidigo // only called during static initialization
28 panic(fmt.Sprintf("duplicate registration of dynamic config key: %q", s.Key().String()))
29 }
30 > globalRegistry.settings[s.Key()] = s registry.go
31 }
32
go.temporal.io/server/common/membership/grpc_resolver.go 7 covered LOC · 2 ranges

Open complete file

53 )
54
55 > func init() { grpc_resolver.go
56 > // This must be called in init to avoid race conditions.
57 > resolver.Register(&globalGrpcBuilder)
58 > }
59
60 // Most code should not use this, this is only exposed for code that has to recognize and use a
80 }
81
82 > func (m *grpcBuilder) Scheme() string { grpc_resolver.go
83 > return grpcResolverScheme
84 > }
85
86 func (m *grpcBuilder) getServiceResolver(u *url.URL) (ServiceResolver, error) {
go.temporal.io/server/common/serviceerror/shard_ownership_lost.go 7 covered LOC · 1 range

Open complete file

20
21 // NewShardOwnershipLost returns new ShardOwnershipLost error.
22 > func NewShardOwnershipLost(ownerHost string, currentHost string) error { shard_ownership_lost.go
23 > return &ShardOwnershipLost{
24 > Message: fmt.Sprintf("Shard is owned by:%v but not by %v", ownerHost, currentHost),
25 > OwnerHost: ownerHost,
26 > CurrentHost: currentHost,
27 > }
28 > }
29
30 // Error returns string message.
go.temporal.io/server/common/clock/time_source.go 6 covered LOC · 2 ranges

Open complete file

31
32 // NewRealTimeSource returns a timeSource that uses the real wall timeSource time.
33 > func NewRealTimeSource() RealTimeSource { time_source.go
34 > return RealTimeSource{}
35 > }
36
37 // Now returns the current time, with the location set to UTC.
38 > func (ts RealTimeSource) Now() time.Time { time_source.go
39 > return time.Now().UTC()
40 > }
41
42 // Since returns the time elapsed since t
go.temporal.io/server/common/convert/convert.go 6 covered LOC · 2 ranges

Open complete file

24 }
25
26 > func Int64ToString(v int64) string { convert.go
27 > return strconv.FormatInt(v, 10)
28 > }
29
30 > func Int32ToString(v int32) string { convert.go
31 > return Int64ToString(int64(v))
32 > }
33
34 func Uint16ToString(v uint16) string {
go.temporal.io/server/common/metrics/option.go 6 covered LOC · 2 ranges

Open complete file

10 type WithDescription string
11
12 > func (h WithDescription) apply(m *metricDefinition) { option.go
13 > m.description = string(h)
14 > }
15
16 // WithUnit sets the unit of a metric. See NewBytesHistogramDef for an example.
17 type WithUnit MetricUnit
18
19 > func (h WithUnit) apply(m *metricDefinition) { option.go
20 > m.unit = MetricUnit(h)
21 > }
go.temporal.io/server/common/metrics/otel_options.go 6 covered LOC · 4 ranges

Open complete file

21 )
22
23 > func addOptions[T optionSet[T]](omp *otelMetricsHandler, opts T, metricName string) T { otel_options.go
24 > metricDef, ok := omp.catalog.getMetric(metricName)
25 > if !ok {
26 return opts
27 }
28
29 > if description := metricDef.description; description != "" { otel_options.go
30 opts = opts.addOption(metric.WithDescription(description))
31 }
32
33 > if unit := metricDef.unit; unit != "" { otel_options.go
34 opts = opts.addOption(metric.WithUnit(string(unit)))
35 }
36
37 > return opts otel_options.go
38 }
39
go.temporal.io/server/common/persistence/data_interfaces.go 6 covered LOC · 3 ranges

Open complete file

1408 // UnixMilliseconds returns t as a Unix time, the number of milliseconds elapsed since January 1, 1970 UTC.
1409 // It should be used for all CQL timestamp.
1410 > func UnixMilliseconds(t time.Time) int64 { data_interfaces.go
1411 > // Handling zero time separately because UnixNano is undefined for zero times.
1412 > if t.IsZero() {
1413 return 0
1414 }
1415
1416 > unixNano := t.UnixNano() data_interfaces.go
1417 > if unixNano < 0 {
1418 // Time is before January 1, 1970 UTC
1419 return 0
1420 }
1421 > return unixNano / int64(time.Millisecond) data_interfaces.go
1422 }
1423
go.temporal.io/server/common/persistence/nosql/nosqlplugin/cassandra/translator/fixed_address_translator.go 6 covered LOC · 2 ranges

Open complete file

15 )
16
17 > func init() { fixed_address_translator.go
18 > RegisterTranslator(fixedTranslatorName, NewFixedAddressTranslatorPlugin())
19 > }
20
21 type FixedAddressTranslatorPlugin struct {
22 }
23
24 > func NewFixedAddressTranslatorPlugin() TranslatorPlugin { fixed_address_translator.go
25 > return &FixedAddressTranslatorPlugin{}
26 > }
27
28 // GetTranslator What gocql driver does is that it will connect to the first node in the list in configuration
go.temporal.io/server/common/persistence/sql/sqlplugin/sqlite/plugin.go 6 covered LOC · 1 range

Open complete file

43 }
44
45 > func init() { plugin.go
46 > sql.RegisterPlugin(PluginName, &plugin{
47 > queryConverter: &queryConverter{},
48 > connPool: newConnPool(),
49 > })
50 > }
51
52 func (p *plugin) GetVisibilityQueryConverter() sqlplugin.VisibilityQueryConverter {
go.temporal.io/server/service/history/configs/task.go 6 covered LOC · 1 range

Open complete file

26 func ConvertWeightsToDynamicConfigValue(
27 weights map[tasks.Priority]int,
28 > ) map[string]any { task.go
29 > weightsForDC := make(map[string]any)
30 > for priority, weight := range weights {
31 > weightsForDC[priority.String()] = weight
32 > }
33 > return weightsForDC
34 }
35
go.temporal.io/server/api/adminservicemock/v1/service_grpc.pb.mock.go 5 covered LOC · 1 range

Open complete file

33
34 // NewMockAdminServiceClient creates a new mock instance.
35 > func NewMockAdminServiceClient(ctrl *gomock.Controller) *MockAdminServiceClient { service_grpc.pb.mock.go
36 > mock := &MockAdminServiceClient{ctrl: ctrl}
37 > mock.recorder = &MockAdminServiceClientMockRecorder{mock}
38 > return mock
39 > }
40
41 // EXPECT returns an object that allows the caller to indicate expected use.
go.temporal.io/server/api/historyservicemock/v1/service_grpc.pb.mock.go 5 covered LOC · 1 range

Open complete file

33
34 // NewMockHistoryServiceClient creates a new mock instance.
35 > func NewMockHistoryServiceClient(ctrl *gomock.Controller) *MockHistoryServiceClient { service_grpc.pb.mock.go
36 > mock := &MockHistoryServiceClient{ctrl: ctrl}
37 > mock.recorder = &MockHistoryServiceClientMockRecorder{mock}
38 > return mock
39 > }
40
41 // EXPECT returns an object that allows the caller to indicate expected use.
go.temporal.io/server/api/matchingservicemock/v1/service_grpc.pb.mock.go 5 covered LOC · 1 range

Open complete file

32
33 // NewMockMatchingServiceClient creates a new mock instance.
34 > func NewMockMatchingServiceClient(ctrl *gomock.Controller) *MockMatchingServiceClient { service_grpc.pb.mock.go
35 > mock := &MockMatchingServiceClient{ctrl: ctrl}
36 > mock.recorder = &MockMatchingServiceClientMockRecorder{mock}
37 > return mock
38 > }
39
40 // EXPECT returns an object that allows the caller to indicate expected use.
go.temporal.io/server/chasm/lib/nexusoperation/config.go 5 covered LOC · 1 range

Open complete file

160 }
161
162 > func (cfg RetryPolicyConfig) build() backoff.RetryPolicy { config.go
163 > return backoff.NewExponentialRetryPolicy(cfg.InitialInterval).
164 > WithMaximumInterval(cfg.MaxInterval).
165 > WithExpirationInterval(backoff.NoInterval)
166 > }
167
168 var defaultRetryPolicyConfig = RetryPolicyConfig{
go.temporal.io/server/client/client_factory_mock.go 5 covered LOC · 1 range

Open complete file

41
42 // NewMockFactory creates a new mock instance.
43 > func NewMockFactory(ctrl *gomock.Controller) *MockFactory { client_factory_mock.go
44 > mock := &MockFactory{ctrl: ctrl}
45 > mock.recorder = &MockFactoryMockRecorder{mock}
46 > return mock
47 > }
48
49 // EXPECT returns an object that allows the caller to indicate expected use.
go.temporal.io/server/common/archiver/archival_metadata_mock.go 5 covered LOC · 1 range

Open complete file

30
31 // NewMockArchivalMetadata creates a new mock instance.
32 > func NewMockArchivalMetadata(ctrl *gomock.Controller) *MockArchivalMetadata { archival_metadata_mock.go
33 > mock := &MockArchivalMetadata{ctrl: ctrl}
34 > mock.recorder = &MockArchivalMetadataMockRecorder{mock}
35 > return mock
36 > }
37
38 // EXPECT returns an object that allows the caller to indicate expected use.
go.temporal.io/server/common/archiver/provider/provider_mock.go 5 covered LOC · 1 range

Open complete file

30
31 // NewMockArchiverProvider creates a new mock instance.
32 > func NewMockArchiverProvider(ctrl *gomock.Controller) *MockArchiverProvider { provider_mock.go
33 > mock := &MockArchiverProvider{ctrl: ctrl}
34 > mock.recorder = &MockArchiverProviderMockRecorder{mock}
35 > return mock
36 > }
37
38 // EXPECT returns an object that allows the caller to indicate expected use.
go.temporal.io/server/common/namespace/registry_mock.go 5 covered LOC · 1 range

Open complete file

30
31 // NewMockRegistry creates a new mock instance.
32 > func NewMockRegistry(ctrl *gomock.Controller) *MockRegistry { registry_mock.go
33 > mock := &MockRegistry{ctrl: ctrl}
34 > mock.recorder = &MockRegistryMockRecorder{mock}
35 > return mock
36 > }
37
38 // EXPECT returns an object that allows the caller to indicate expected use.
go.temporal.io/server/common/persistence/history_branch_util.go 5 covered LOC · 1 range

Open complete file

41 )
42
43 > func NewHistoryBranchUtil(serializer serialization.Serializer) *HistoryBranchUtilImpl { history_branch_util.go
44 > return &HistoryBranchUtilImpl{
45 > serializer: serializer,
46 > }
47 > }
48
49 func (u *HistoryBranchUtilImpl) NewHistoryBranch(
go.temporal.io/server/common/persistence/namespace_replication_queue_mock.go 5 covered LOC · 1 range

Open complete file

31
32 // NewMockNamespaceReplicationQueue creates a new mock instance.
33 > func NewMockNamespaceReplicationQueue(ctrl *gomock.Controller) *MockNamespaceReplicationQueue { namespace_replication_queue_mock.go
34 > mock := &MockNamespaceReplicationQueue{ctrl: ctrl}
35 > mock.recorder = &MockNamespaceReplicationQueueMockRecorder{mock}
36 > return mock
37 > }
38
39 // EXPECT returns an object that allows the caller to indicate expected use.
go.temporal.io/server/common/persistence/sql/sqlplugin/mysql/plugin.go 5 covered LOC · 1 range

Open complete file

24 var _ sqlplugin.Plugin = (*plugin)(nil)
25
26 > func init() { plugin.go
27 > sql.RegisterPlugin(PluginName, &plugin{
28 > queryConverter: &queryConverter{},
29 > })
30 > }
31
32 func (p *plugin) GetVisibilityQueryConverter() sqlplugin.VisibilityQueryConverter {
go.temporal.io/server/common/persistence/sql/sqlplugin/sqlite/conn_pool.go 5 covered LOC · 1 range

Open complete file

23 }
24
25 > func newConnPool() *connPool { conn_pool.go
26 > return &connPool{
27 > pool: make(map[string]entry),
28 > }
29 > }
30
31 // Allocate allocates the shared database in the pool or returns already exists instance with the same DSN. If instance
go.temporal.io/server/common/persistence/visibility/manager/visibility_manager_mock.go 5 covered LOC · 1 range

Open complete file

32
33 // NewMockVisibilityManager creates a new mock instance.
34 > func NewMockVisibilityManager(ctrl *gomock.Controller) *MockVisibilityManager { visibility_manager_mock.go
35 > mock := &MockVisibilityManager{ctrl: ctrl}
36 > mock.recorder = &MockVisibilityManagerMockRecorder{mock}
37 > return mock
38 > }
39
40 // EXPECT returns an object that allows the caller to indicate expected use.
go.temporal.io/server/common/persistence/visibility/store/elasticsearch/client/client_mock.go 5 covered LOC · 1 range

Open complete file

32
33 // NewMockClient creates a new mock instance.
34 > func NewMockClient(ctrl *gomock.Controller) *MockClient { client_mock.go
35 > mock := &MockClient{ctrl: ctrl}
36 > mock.recorder = &MockClientMockRecorder{mock}
37 > return mock
38 > }
39
40 // EXPECT returns an object that allows the caller to indicate expected use.
go.temporal.io/server/common/sdk/factory_mock.go 5 covered LOC · 1 range

Open complete file

31
32 // NewMockClientFactory creates a new mock instance.
33 > func NewMockClientFactory(ctrl *gomock.Controller) *MockClientFactory { factory_mock.go
34 > mock := &MockClientFactory{ctrl: ctrl}
35 > mock.recorder = &MockClientFactoryMockRecorder{mock}
36 > return mock
37 > }
38
39 // EXPECT returns an object that allows the caller to indicate expected use.
go.temporal.io/server/common/searchattribute/mapper_mock.go 5 covered LOC · 1 range

Open complete file

84
85 // NewMockMapperProvider creates a new mock instance.
86 > func NewMockMapperProvider(ctrl *gomock.Controller) *MockMapperProvider { mapper_mock.go
87 > mock := &MockMapperProvider{ctrl: ctrl}
88 > mock.recorder = &MockMapperProviderMockRecorder{mock}
89 > return mock
90 > }
91
92 // EXPECT returns an object that allows the caller to indicate expected use.
go.temporal.io/server/common/testing/mockapi/workflowservicemock/v1/service_grpc.pb.mock.go 5 covered LOC · 1 range

Open complete file

32
33 // NewMockWorkflowServiceClient creates a new mock instance.
34 > func NewMockWorkflowServiceClient(ctrl *gomock.Controller) *MockWorkflowServiceClient { service_grpc.pb.mock.go
35 > mock := &MockWorkflowServiceClient{ctrl: ctrl}
36 > mock.recorder = &MockWorkflowServiceClientMockRecorder{mock}
37 > return mock
38 > }
39
40 // EXPECT returns an object that allows the caller to indicate expected use.
go.temporal.io/server/common/log/with_logger.go 4 covered LOC · 2 ranges

Open complete file

14 // With returns Logger instance that prepend every log entry with tags. If logger implements
15 // WithLogger it is used, otherwise every log call will be intercepted.
16 > func With(logger Logger, tags ...tag.Tag) Logger { with_logger.go
17 > if wl, ok := logger.(WithLogger); ok {
18 > return wl.With(tags...) with_logger.go
19 > }
20 return newWithLogger(logger, tags...)
21 }
go.temporal.io/server/common/metrics/config.go 4 covered LOC · 2 ranges

Open complete file

493 }
494
495 > func configExcludeTags(cfg ClientConfig) map[string]map[string]struct{} { config.go
496 > tagsToFilter := make(map[string]map[string]struct{})
497 > for key, val := range cfg.ExcludeTags {
498 exclusions := make(map[string]struct{})
499 for _, val := range val {
502 tagsToFilter[key] = exclusions
503 }
504 > return tagsToFilter config.go
505 }
506
go.temporal.io/server/common/persistence/sql/sqlplugin/mysql/typeconv.go 4 covered LOC · 2 ranges

Open complete file

33 }
34
35 > func getMinMySQLDateTime() time.Time { typeconv.go
36 > t, err := time.Parse(time.RFC3339, "1000-01-01T00:00:00Z")
37 > if err != nil {
38 return time.Unix(0, 0).UTC()
39 }
40 > return t.UTC() typeconv.go
41 }
go.temporal.io/server/common/persistence/sql/sqlplugin/postgresql/typeconv.go 4 covered LOC · 2 ranges

Open complete file

35 }
36
37 > func getMinPostgreSQLDateTime() time.Time { typeconv.go
38 > t, err := time.Parse(time.RFC3339, "1000-01-01T00:00:00Z")
39 > if err != nil {
40 return time.Unix(0, 0).UTC()
41 }
42 > return t.UTC() typeconv.go
43 }
go.temporal.io/server/common/persistence/sql/sqlplugin/sqlite/typeconv.go 4 covered LOC · 2 ranges

Open complete file

33 }
34
35 > func getMinSQLiteDateTime() time.Time { typeconv.go
36 > t, err := time.Parse(time.RFC3339, "1000-01-01T00:00:00Z")
37 > if err != nil {
38 return time.Unix(0, 0).UTC()
39 }
40 > return t.UTC() typeconv.go
41 }
go.temporal.io/server/common/util.go 4 covered LOC · 1 range

Open complete file

161
162 // CreatePersistenceClientRetryPolicy creates a retry policy for calls to persistence
163 > func CreatePersistenceClientRetryPolicy() backoff.RetryPolicy { util.go
164 > return backoff.NewExponentialRetryPolicy(persistenceClientRetryInitialInterval).
165 > WithMaximumAttempts(persistenceClientRetryMaxAttempts)
166 > }
167
168 // CreateFrontendClientRetryPolicy creates a retry policy for calls to frontend service
go.temporal.io/server/api/persistence/v1/predicates.go-helpers.pb.go 3 covered LOC · 1 range

Open complete file

17
18 // Size returns the size of the object, in bytes, once serialized
19 > func (val *Predicate) Size() int { predicates.go-helpers.pb.go
20 > return proto.Size(val)
21 > }
22
23 // Equal returns whether two Predicate values are equivalent by recursively
go.temporal.io/server/chasm/library.go 3 covered LOC · 1 range

Open complete file

56 // tasks within the CHASM framework.
57 // The format of the returned FQN is: "libName.name"
58 > func FullyQualifiedName(libName, name string) string { library.go
59 > return libName + "." + name
60 > }
go.temporal.io/server/chasm/registrable_component.go 3 covered LOC · 1 range

Open complete file

203 // The generated ID is used to uniquely identify components and tasks within the CHASM framework. The same FQN will
204 // always produce the same ID.
205 > func GenerateTypeID(fqn string) uint32 { registrable_component.go
206 > return farm.Fingerprint32([]byte(fqn))
207 > }
208
209 // hasBusinessIDAlias returns true if the component has a businessID alias configured
go.temporal.io/server/common/dynamicconfig/key.go 3 covered LOC · 1 range

Open complete file

13 )
14
15 > func MakeKey(s string) Key { key.go
16 > return Key{handle: unique.Make(strings.ToLower(s))}
17 > }
18
19 func (k Key) String() string {
go.temporal.io/server/common/log/noop_logger.go 3 covered LOC · 1 range

Open complete file

10
11 // NewNoopLogger return a noopLogger
12 > func NewNoopLogger() *noopLogger { noop_logger.go
13 > return &noopLogger{}
14 > }
15
16 func (n *noopLogger) Debug(string, ...tag.Tag) {}
go.temporal.io/server/common/metrics/metrics.go 3 covered LOC · 3 ranges

Open complete file

80 )
81
82 > func (c CounterFunc) Record(v int64, tags ...Tag) { c(v, tags...) } metrics.go
83 > func (c GaugeFunc) Record(v float64, tags ...Tag) { c(v, tags...) } metrics.go
84 > func (c TimerFunc) Record(v time.Duration, tags ...Tag) { c(v, tags...) } metrics.go
85 func (c HistogramFunc) Record(v int64, tags ...Tag) { c(v, tags...) }
go.temporal.io/server/common/payload/payload.go 3 covered LOC · 1 range

Open complete file

30 }
31
32 > func Encode(value any) (*commonpb.Payload, error) { payload.go
33 > return defaultDataConverter.ToPayload(value)
34 > }
35
36 func Decode(p *commonpb.Payload, valuePtr any) error {
go.temporal.io/server/common/persistence/nosql/nosqlplugin/cassandra/translator/translator_plugin.go 3 covered LOC · 1 range

Open complete file

22 // RegisterPlugin adds an auth plugin to the plugin registry
23 // it is only safe to use from a package init function
24 > func RegisterTranslator(name string, plugin TranslatorPlugin) { translator_plugin.go
25 > translators[name] = plugin
26 > }
27
28 func LookupTranslator(name string) (TranslatorPlugin, error) {
go.temporal.io/server/common/persistence/persistence_rate_limited_clients.go 3 covered LOC · 1 range

Open complete file

go.temporal.io/server/common/persistence/sql/store.go 3 covered LOC · 2 ranges

Open complete file

19
20 // RegisterPlugin will register a SQL plugin
21 > func RegisterPlugin(pluginName string, plugin sqlplugin.Plugin) { store.go
22 > if _, ok := supportedPlugins[pluginName]; ok {
23 panic("plugin " + pluginName + " already registered")
24 }
25 > supportedPlugins[pluginName] = plugin store.go
26 }
27
go.temporal.io/server/service/history/shard/context_util.go 3 covered LOC · 1 range

Open complete file

62 func ReplicationReaderIDToClusterShardID(
63 readerID int64,
64 > ) (int64, int32) { context_util.go
65 > return readerID >> 32, int32(readerID & 0xffffffff)
66 > }
67
68 func getMinTaskKey(
go.temporal.io/server/common/persistence/client/fx.go 2 covered LOC · 1 range

Open complete file

224 }
225
226 > func managerProvider[T persistence.Closeable](newManagerFn func(Factory) (T, error)) func(Factory, fx.Lifecycle) (T, error) { fx.go
227 > return func(f Factory, lc fx.Lifecycle) (T, error) {
228 manager, err := newManagerFn(f) // passing receiver (Factory) as first argument.
229 if err != nil {
go.temporal.io/server/common/aggregate/noop_moving_window_average.go 1 covered LOC · 1 range

Open complete file

7 )
8
9 > func newNoopMovingWindowAverage() *noopMovingWindowAverage { return &noopMovingWindowAverage{} } noop_moving_window_average.go
10
11 func (a *noopMovingWindowAverage) Record(_ int64) {}
go.temporal.io/server/common/persistence/noop_health_signal_aggregator.go 1 covered LOC · 1 range

Open complete file

11 )
12
13 > func newNoopSignalAggregator() *noopSignalAggregator { return &noopSignalAggregator{} } noop_health_signal_aggregator.go
14
15 func (a *noopSignalAggregator) Start() {}