GRPC Exporter sends messages bigger than gRPC protocol allows

未关闭
#5,394 14 条评论 4 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
grpc, java
领域
api, observability

调研方向

从 OkHttpGrpcExporter 和报告中描述的 PeriodicMetricReaderBuilder#setInterval 复现开始。根据 4 MB gRPC 限制和指标过大的情况验证行为;完成标准是请求会被拆分或限制大小,并且导出失败时提供更清晰的响应详情。

由索引模型根据 Issue 内容生成。

描述

Bug

Describe the bug
I started getting the following error from OkHttpGrpcExporter in my logs:

Failed to export metrics. The request could not be executed. Full error message: stream was reset: NO_ERROR

Turned out, this happens because the exporter sends messages too big (default limit is 4mb). This is what I see on receiving side:

Header: grpc-message: grpc: received message larger than max (6117815 vs. 4194304)
    Name Length: 12
    Name: grpc-message
    Value Length: 60
    Value: grpc: received message larger than max (6117815 vs. 4194304)
    [Unescaped: grpc: received message larger than max (6117815 vs. 4194304)]
    Representation: Literal Header Field with Incremental Indexing - New Name

Steps to reproduce
I suppose I'm just sending a large number of metrics.

However, it might be reproducible by increasing the publishing interval (io.opentelemetry.sdk.metrics.export.PeriodicMetricReaderBuilder#setInterval(java.time.Duration)).
This will make the meter accumulate more data before sending.

What did you expect to see?

  1. I would expect the exporter to respect 4mb gRPC message limit and send more than one message in this case
  2. I would like to have a clearer error message about it. In this particular case, it would be useful to print response details (including headers)

What did you see instead?
The error message mentioned above, and it was not particularly helpful.

What version and what artifacts are you using?

io.opentelemetry:opentelemetry-api:1.18.0
io.opentelemetry:opentelemetry-context:1.18.0
io.opentelemetry:opentelemetry-exporter-common:1.18.0
io.opentelemetry:opentelemetry-exporter-otlp:1.18.0
io.opentelemetry:opentelemetry-exporter-otlp-common:1.18.0
io.opentelemetry:opentelemetry-sdk:1.18.0
io.opentelemetry:opentelemetry-sdk-common:1.18.0
io.opentelemetry:opentelemetry-sdk-logs:1.18.0-alpha
io.opentelemetry:opentelemetry-sdk-metrics:1.18.0
io.opentelemetry:opentelemetry-sdk-trace:1.18.0
主要语言
Java
星标
2.5k
派生
1.1k
平均合并
5 天 11 小时
30 天内合并 PR
41

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

open-telemetry/opentelemetry-java 的其他 Issue

查看 open-telemetry/opentelemetry-java 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。