菜单
开源

轮询

轮询周期由此处详述的多个配置选项控制。

storage:
    trace:
        # How often to repoll the backend for new blocks. Default is 5m
        [blocklist_poll: <duration>]

        # Number of blocks to process in parallel during polling. Default is 50.
        [blocklist_poll_concurrency: <int>]

        # By default components will pull the blocklist from the tenant index. If that fails the component can
        # fallback to scanning the entire bucket. Set to false to disable this behavior. Default is true.
        [blocklist_poll_fallback: <bool>]

        # Maximum number of compactors that should build the tenant index. All other components will download
        # the index. Default 2.
        [blocklist_poll_tenant_index_builders: <int>]

        # The oldest allowable tenant index. If an index is pulled that is older than this duration,
        # the polling will consider this an error. Note that `blocklist_poll_fallback` applies here.
        # If fallback is true and a tenant index exceeds this duration, it will fall back to listing
        # the bucket contents.
        # Default 0 (disabled).
        [blocklist_poll_stale_tenant_index: <duration>]

由于租户索引的机制,块列表最多会过时配置的 blocklist_poll 时长的 2 倍。有两个配置选项需要与 blocklist_poll 进行权衡以处理此问题

ingester complete_block_timeout 用于在块被刷新后将其在 ingester 中保留一段时间。这允许 ingester 在 queriers 仍未感知到新刷新块时向其返回追踪。

ingester:
  # How long to hold a complete block in the ingester after it has been flushed to the backend. Default is 15m
  [complete_block_timeout: <duration>]

compactor compacted_block_retention 用于在块被压缩且数据不再需要后将其在后端保留一段时间。这允许块列表过时的 queriers 成功访问这些块,直到它们完成轮询周期并拥有最新的块列表。与 complete_block_timeout 类似,此值应至少为配置的 blocklist_poll 时长的 2 倍。

compactor:
  compaction:
    # How long to leave a block in the backend after it has been compacted successfully. Default is 1h
    [compacted_block_retention: <duration>]

此外,querier blocklist_poll 的时长需要大于或等于 compactor blocklist_poll 的时长。否则,querier 可能无法正确检查所有分配的块,并错误地返回 404。建议简单地将两个组件设置为使用相同的轮询时长。