MCPcopy
hub / github.com/grafana/tempo / EnablePolling

Method EnablePolling

tempodb/tempodb.go:716–765  ·  tempodb/tempodb.go::readerWriter.EnablePolling

EnablePolling activates the polling loop. Pass nil if this component should never be a tenant index builder.

(ctx context.Context, sharder blocklist.JobSharder, skipNoCompactBlocks bool)

Source from the content-addressed store, hash-verified

714//
715// should never be a tenant index builder.
716func (rw *readerWriter) EnablePolling(ctx context.Context, sharder blocklist.JobSharder, skipNoCompactBlocks bool) {
717 if sharder == nil {
718 sharder = blocklist.OwnsNothingSharder
719 }
720
721 if rw.cfg.BlocklistPoll == 0 {
722 rw.cfg.BlocklistPoll = DefaultBlocklistPoll
723 }
724
725 if rw.cfg.BlocklistPollConcurrency == 0 {
726 rw.cfg.BlocklistPollConcurrency = DefaultBlocklistPollConcurrency
727 }
728
729 if rw.cfg.BlocklistPollTenantConcurrency == 0 {
730 rw.cfg.BlocklistPollTenantConcurrency = DefaultBlocklistPollTenantConcurrency
731 }
732
733 if rw.cfg.BlocklistPollTenantIndexBuilders <= 0 {
734 rw.cfg.BlocklistPollTenantIndexBuilders = DefaultTenantIndexBuilders
735 }
736
737 if rw.cfg.EmptyTenantDeletionAge <= 0 {
738 rw.cfg.EmptyTenantDeletionAge = DefaultEmptyTenantDeletionAge
739 }
740
741 level.Info(rw.logger).Log("msg", "polling enabled", "interval", rw.cfg.BlocklistPoll, "blocklist_concurrency", rw.cfg.BlocklistPollConcurrency)
742
743 blocklistPoller := blocklist.NewPoller(&blocklist.PollerConfig{
744 PollConcurrency: rw.cfg.BlocklistPollConcurrency,
745 PollFallback: rw.cfg.BlocklistPollFallback,
746 TenantIndexBuilders: rw.cfg.BlocklistPollTenantIndexBuilders,
747 StaleTenantIndex: rw.cfg.BlocklistPollStaleTenantIndex,
748 PollJitterMs: rw.cfg.BlocklistPollJitterMs,
749 TolerateConsecutiveErrors: rw.cfg.BlocklistPollTolerateConsecutiveErrors,
750 TolerateTenantFailures: rw.cfg.BlocklistPollTolerateTenantFailures,
751 TenantPollConcurrency: rw.cfg.BlocklistPollTenantConcurrency,
752 EmptyTenantDeletionAge: rw.cfg.EmptyTenantDeletionAge,
753 EmptyTenantDeletionEnabled: rw.cfg.EmptyTenantDeletionEnabled,
754 SkipNoCompactBlocks: skipNoCompactBlocks,
755 }, sharder, rw.r, rw.c, rw.w, rw.logger)
756
757 rw.blocklistPoller = blocklistPoller
758 rw.pollerShutdownCh = make(chan struct{})
759
760 // do the first poll cycle synchronously. this will allow the caller to know
761 // that when this method returns the block list is updated
762 rw.pollBlocklist(ctx)
763
764 go rw.pollingLoop(ctx)
765}
766
767func (rw *readerWriter) PollNow(ctx context.Context) {
768 rw.pollBlocklist(ctx)

Callers

nothing calls this directly

Calls 4

pollBlocklistMethod · 0.95
pollingLoopMethod · 0.95
NewPollerFunction · 0.92
LogMethod · 0.65

Tested by

no test coverage detected