MetricReusableDataMarshaler passes MetricData count instead of data point count to otel.sdk.exporter.metric_data_point.{inflight,exported}

未关闭 适合新手
#9,011 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

@goutamadwant 已经在做这个了。

开始于 2026年11月7日。

  • #9016 来自 @goutamadwant —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
76/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
java
领域
observability

调研方向

阅读 exporters/otlp/common/src/main/java/io/opentelemetry/exporter/internal/otlp/metrics/MetricReusableDataMarshaler.java,重点查看 export(Collection<MetricData>) 及其对 doExport 的调用。跟踪 OTLP gRPC 和 HTTP exporter 如何记录项目数量,然后查找或补充对包含多个数据点和零个数据点的指标的测试覆盖。完成条件是两个 exporter 的指标都统计所有已导出 MetricData 中数据点的总数。

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

描述

Description

In MetricReusableDataMarshaler.export(Collection<MetricData> metrics), metrics.size() (the number of MetricData instruments) is passed as the item count to doExport:

https://github.com/open-telemetry/opentelemetry-java/blob/be7de06cd7d1c1154be14bfcae1f83d52503b8e9/exporters/otlp/common/src/main/java/io/opentelemetry/exporter/internal/otlp/metrics/MetricReusableDataMarshaler.java#L48

https://github.com/open-telemetry/opentelemetry-java/blob/be7de06cd7d1c1154be14bfcae1f83d52503b8e9/exporters/otlp/common/src/main/java/io/opentelemetry/exporter/internal/otlp/metrics/MetricReusableDataMarshaler.java#L57

In OtlpGrpcMetricExporter and OtlpHttpMetricExporter, doExport delegates to GrpcExporter.export(exportRequest, numItems) and HttpExporter.export(exportRequest, numItems), which pass numItems to ExporterInstrumentation.startRecordingExport(numItems) (SemConvExporterMetrics.startRecordingExport(numItems)), recording otel.sdk.exporter.metric_data_point.inflight and otel.sdk.exporter.metric_data_point.exported. When a MetricData contains multiple PointData entries (or 0 points), the recorded count reflects the number of metric instruments rather than the number of metric data points ({data_point}).

Expected behavior

otel.sdk.exporter.metric_data_point.inflight and otel.sdk.exporter.metric_data_point.exported should count the total number of metric data points (metricData.getData().getPoints().size()) across the exported Collection<MetricData>.

主要语言
Java
星标
2.5k
派生
1k
平均合并
4 天 3 小时
30 天内合并 PR
49

环境准备

  • 没有 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 摘要。