You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Grafana Tempo搜索结果偶现缺失及相关报错排查求助

Grafana + Tempo 搜索功能异常及相关报错排查

搜索功能异常现象

  • 搜索功能间歇性失效:查询13:00-13:05的trace数据无结果,但扩大时间范围到12:00-14:00时,能看到该时段的相关数据。

Tempo日志间歇性报错

1. 索引轮询/创建报错

level=error ts=2024-03-22T06:36:01.37975115Z caller=poller.go:156 msg="failed to poll or create index for tenant" tenant=single-tenant err="open /tmp/tempo/blocks/single-tenant/5c1805c7-1fa1-462a-b5fb-b21c896f206b: no such file or directory"
  • 部署方式:Docker部署,报错路径对应挂载卷,暂未明确影响因素。

2. 请求处理报错

level=error ts=2024-03-22T12:42:48.49124478Z caller=frontend_processor.go:71 msg="error processing requests" address=127.0.0.1:9095 err="rpc error: code = Canceled desc = context canceled"
  • 触发时机:每次通过Grafana Explore搜索时都会触发,需明确Tempo此时的执行逻辑。

3. Trace数据消费报错

level=error ts=2024-03-22T13:56:10.910465446Z caller=rate_limited_logger.go:27 msg="pusher failed to consume trace data" err="DoBatch: InstancesCount <= 0"

当前Tempo配置

server:
  http_listen_port: 3200

distributor:
  receivers:
    otlp:
      protocols:
        http:
        grpc:

ingester:
  max_block_duration: 5m

compactor:
  compaction:
    block_retention: 168h

metrics_generator:
  registry:
    external_labels:
      source: tempo
  storage:
    path: /tmp/tempo/generator/wal
    remote_write:
      - url: http://prometheus:9090/api/v1/write
        send_exemplars: true

storage:
  trace:
    backend: local
    wal:
      path: /tmp/tempo/wal 
    local:
      path: /tmp/tempo/blocks

overrides:
  metrics_generator_processors: [service-graphs, span-metrics]

另一环境无报错但搜索异常情况

日志显示搜索未执行,无请求发起:

level=info ts=2024-03-27T11:55:51.692768615Z caller=handler.go:134 tenant=single-tenant method=GET traceID=45edd2e653a8fd1d url="/api/search?q=%7Bresource.service.name%3D%22app%22%7D&amp;limit=20&amp;spss=3&amp;start=1711533240&amp;end=1711533539" duration=203.805µs response_size=26 status=200
level=info ts=2024-03-27T11:55:52.613606631Z caller=searchsharding.go:253 msg="sharded search query request stats and SearchMetrics" tenant=single-tenant query="q={resource.service.name=\"app\"}&amp;limit=20&amp;spss=3&amp;start=1711533240&amp;end=1711533539" duration_seconds=49.501µs request_throughput=0 total_requests=0 started_requests=0 cancelled_requests=0 finished_requests=0 totalBlocks=0 inspectedBytes=0 inspectedTraces=0 totalBlockBytes=0

排查建议

针对索引轮询/创建报错

  • 检查Docker挂载卷权限:确认容器对/tmp/tempo/blocks目录有读写权限,避免因权限不足导致无法访问索引文件。
  • 验证挂载卷稳定性:若为本地卷,检查宿主机磁盘是否存在满盘、IO错误;若为远程卷,确认网络连接及卷服务状态。
  • 检查compactor状态:compactor负责块合并,若异常终止可能导致块目录被移除但索引未更新,查看compactor日志确认是否有异常。

针对请求处理上下文取消报错

  • 该报错是Grafana搜索请求超时或被取消导致的Tempo端上下文终止:
    1. 调整Grafana超时设置:检查explore.default_time_range、explore.max_time_range配置,或单独调整Tempo数据源的超时参数。
    2. 分析Tempo查询性能:小时间范围搜索耗时过长可能触发超时,通过tempo_query_frontend_request_duration_seconds指标查看查询耗时分布。
    3. 检查GRPC连接:若部署多组件,确认frontend与querier之间的GRPC连接稳定性,调整GRPC超时参数。

针对Trace数据消费报错

  • 该报错是pusher接收到的trace数据实例数为0,排查方向:
    1. 检查客户端数据格式:确认OTLP客户端发送的trace包含有效实例(spans/traces)。
    2. 排查distributor过滤规则:查看distributor日志,确认是否有数据被采样或过滤。

针对无报错但搜索无执行的情况

  • 匹配块时间边界:Tempo块按max_block_duration=5m对齐,若查询时间范围未覆盖完整块区间,可能无法匹配到块,尝试调整查询范围为完整5分钟区间测试。
  • 检查索引与块目录:手动查看/tmp/tempo/blocks下是否存在对应时间的块,以及索引文件是否生成。
  • 验证单租户配置:确认single-tenant配置正确,数据是否写入对应租户路径。

内容的提问来源于stack exchange,提问作者Ilya Afinogentov

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.27 09:34:54