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

OpenTelemetry导出至New Relic失败问题求助

问题排查:OpenTelemetry Collector导出到New Relic超时及连接重置错误

出现的错误信息

  1. 导出超时错误:

exporterhelper/queued_retry.go:215 Exporting failed. Will retry the request after interval.
{
"kind": "exporter",
"name": "otlp",
"error": "rpc error: code = DeadlineExceeded desc = context deadline exceeded",
"interval": "7.202545441s"
}

  1. gRPC连接重置警告:

warn zapgrpc/zapgrpc.go:191 [transport] transport: http2Server.HandleStreams failed to read frame: read tcp 127.0.0.1:4317->127.0.0.1:33316: read: connection reset by peer {
"grpc_log": true
}

排查与解决步骤

1. 验证基础配置正确性

  • 确认NEW_RELIC_OPENTELEMETRY_ENDPOINT值是否正确:
    New Relic官方OTLP端点:
    • gRPC协议:otlp.nr-data.net:4317
    • HTTP协议:otlp.nr-data.net:4318
  • 确认NEW_RELIC_LICENSE_KEY有效,无过期、权限不足问题。

2. 调整OTLP导出器的超时与重试策略

默认超时时间(5s)过短,容易触发超时错误,修改collector.yaml中的otlp导出器配置:

exporters:
  otlp:
    endpoint: ${NEW_RELIC_OPENTELEMETRY_ENDPOINT}
    headers:
      api-key: ${NEW_RELIC_LICENSE_KEY}
    timeout: 30s  # 延长超时时间
    retry_on_failure:
      enabled: true
      initial_interval: 5s
      max_interval: 30s
      max_elapsed_time: 300s  # 最长重试时长

3. 检查网络连通性

  • 测试Collector到New Relic端点的连通性:
    # gRPC端点测试
    telnet otlp.nr-data.net 4317
    # HTTP端点测试
    curl -v https://otlp.nr-data.net:4318/v1/metrics
    
  • 排查防火墙、网络策略是否允许Collector出站访问4317/4318端口;若在容器/K8s环境,需确认网络插件、Service Mesh是否拦截流量。

4. 匹配导出器协议与端点类型

确保OTLP导出器的协议与使用的端点一致:

  • 若使用gRPC端点(4317),无需额外配置协议(默认gRPC);
  • 若使用HTTP端点(4318),需显式指定协议:
    exporters:
      otlp:
        endpoint: otlp.nr-data.net:4318
        protocol: http/protobuf
        headers:
          api-key: ${NEW_RELIC_LICENSE_KEY}
    

5. 启用日志导出器排查数据问题

将logging导出器加入管道,查看Collector接收的数据是否存在格式异常,导致New Relic处理缓慢:

service:
  pipelines:
    traces:
      receivers: [otlp]
      exporters: [logging, otlp]
    metrics:
      receivers: [otlp]
      exporters: [logging, otlp]
    logs:
      receivers: [otlp]
      exporters: [logging, otlp]

查看debug日志,确认数据结构是否符合OpenTelemetry规范。

6. 升级OpenTelemetry Collector版本

旧版本可能存在gRPC连接、导出逻辑的已知问题,升级到最新稳定版可解决部分兼容性问题。


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.15 02:25:21