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

Open Beginner friendly
#9,011 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

@goutamadwant is already working on this.

Since Nov 7, 2026.

  • #9016 by @goutamadwant — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
java
Domain
observability

Research direction

Read exporters/otlp/common/src/main/java/io/opentelemetry/exporter/internal/otlp/metrics/MetricReusableDataMarshaler.java, especially export(Collection<MetricData>) and its doExport calls. Trace how the OTLP gRPC and HTTP exporters record the item count, then find or add coverage for metrics with multiple points and zero points. Done means both exporter metrics count the total points across all exported MetricData.

Written by the indexing model from the issue text.

Description

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>.

Dominant language
Java
Stars
2.5k
Forks
1k
Avg merge
4d 3h
Merged PRs (30d)
49

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from open-telemetry/opentelemetry-java

All issues in open-telemetry/opentelemetry-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.