Skip to content

[exporter/exporterhelper] Add DroppedItemsErr to report intentionally dropped items#15028

Open
Krishnachaitanyakc wants to merge 1 commit intoopen-telemetry:mainfrom
Krishnachaitanyakc:fix/issue-13643
Open

[exporter/exporterhelper] Add DroppedItemsErr to report intentionally dropped items#15028
Krishnachaitanyakc wants to merge 1 commit intoopen-telemetry:mainfrom
Krishnachaitanyakc:fix/issue-13643

Conversation

@Krishnachaitanyakc
Copy link
Copy Markdown
Contributor

Description

Exporters that intentionally discard items (e.g. a Prometheus exporter dropping non-monotonic DELTA sums) previously had no way to signal this to the exporterhelper observation layer. Dropped items were silently counted as successfully sent via otelcol_exporter_sent_metric_points, making internal telemetry misleading and difficult to use for diagnosing data loss.

This PR adds a lightweight mechanism for exporters to report intentionally dropped items:

  • experr.DroppedItemsErr / NewDroppedItemsErr(count, reason): a non-failure sentinel that an exporter's push function can return to report how many items were intentionally dropped and why.
  • Four new telemetry counters (otelcol_exporter_dropped_{spans,metric_points,log_records,profile_samples}): emitted by obsReportSender when a DroppedItemsErr is received.
  • obsReportSender adjustments: dropped items are subtracted from the "sent" count, and DroppedItemsErr is not propagated as a pipeline error (the pipeline sees nil).

A follow-up to the prometheusexporter in opentelemetry-collector-contrib will be needed to actually return DroppedItemsErr for unsupported metric types (e.g. non-monotonic DELTA sums).

Resolves open-telemetry/opentelemetry-collector-contrib#48172

@Krishnachaitanyakc Krishnachaitanyakc marked this pull request as ready for review April 2, 2026 15:28
@mattclay
Copy link
Copy Markdown

@Krishnachaitanyakc Why did I get pinged on this? I'm not involved with this project.

@Krishnachaitanyakc
Copy link
Copy Markdown
Contributor Author

@Krishnachaitanyakc Why did I get pinged on this? I'm not involved with this project.

my bad, i was tagging you on a different PR and got it mixed up, apologies

@Krishnachaitanyakc
Copy link
Copy Markdown
Contributor Author

@bogdandrutu @dmitryax could you take a look at this change when you have a chance?

@codecov
Copy link
Copy Markdown

codecov Bot commented May 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.13%. Comparing base (346b065) to head (0d73dcb).

Additional details and impacted files
@@           Coverage Diff            @@
##             main   open-telemetry/opentelemetry-collector#15028    +/-   ##
========================================
  Coverage   91.13%   91.13%            
========================================
  Files         701      701            
  Lines       45798    45902   +104     
========================================
+ Hits        41739    41834    +95     
- Misses       2845     2851     +6     
- Partials     1214     1217     +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

… dropped items

Exporters that intentionally discard items (e.g. the Prometheus exporter
dropping non-monotonic DELTA sums) previously had no way to signal this to
the exporterhelper observation layer. Those items were silently counted as
successfully sent, making internal telemetry misleading.

This change adds:
- experr.DroppedItemsErr / NewDroppedItemsErr: a non-failure sentinel that
  an exporter's push function can return to report the number of
  intentionally dropped items and an optional reason.
- Four new telemetry counters (otelcol_exporter_dropped_{spans,metric_points,
  log_records,profile_samples}) emitted by the obsReportSender whenever a
  DroppedItemsErr is received.
- obsReportSender adjusts the sent count so that dropped items are excluded
  from "sent" and the DroppedItemsErr is not propagated as a pipeline error.

Also restore stdlib-before-third-party import ordering in
generated_package_test.go to satisfy the impi linter.

Resolves #13643

Signed-off-by: Kc Balusu <kcbalusu@meta.com>
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 2, 2026

Merging this PR will improve performance by 27.7%

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 2 improved benchmarks
✅ 5 untouched benchmarks
⏩ 76 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
BenchmarkPersistentQueue 181.7 µs 143.6 µs +26.57%
BenchmarkMemoryQueueWaitForResult 61.4 µs 48.1 µs +27.7%

Comparing Krishnachaitanyakc:fix/issue-13643 (0d73dcb) with main (346b065)

Open in CodSpeed

Footnotes

  1. 76 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@dmitryax
Copy link
Copy Markdown
Member

We need #15280 to land first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Internal telemetry of Prometheus exporter incorrectly reports dropped metrics as "Sent"

3 participants