Skip to content

Count otel.sdk.processor.{span,log}.processed at exporter-submit time - #5472

Merged
aabmass merged 8 commits into
open-telemetry:mainfrom
cijothomas:cijothomas/fix-processor-processed-boundary
Aug 4, 2026
Merged

Count otel.sdk.processor.{span,log}.processed at exporter-submit time#5472
aabmass merged 8 commits into
open-telemetry:mainfrom
cijothomas:cijothomas/fix-processor-processed-boundary

Conversation

@cijothomas

@cijothomas cijothomas commented Jul 29, 2026

Copy link
Copy Markdown
Member

Aligns Python with the processor processed boundary clarified in open-telemetry/semantic-conventions#3902.

The otel.sdk.processor.span.processed / otel.sdk.processor.log.processed counters are currently incremented after exporter.export() returns, and an exporter failure is stamped onto this metric as error.type (the raised exception's class name). That conflates exporter outcome with processor outcome and produces unbounded error.type cardinality.

This aligns Python with the boundary clarified in semantic-conventions#3902: the processor counts a record as processed when it submits the batch to the exporter, regardless of the export result. error.type on this metric is reserved for the processor's own drop reasons (queue_full, already_shutdown); exporter success/failure is reported separately by the otel.sdk.exporter.* metrics.

Changes:

  • finish_items(count) no longer takes an error and always records success.
  • Batch and simple span/log processors count at submit-time, before export.
  • Simple log processor no longer counts a record dropped by the shutdown early-return as processed.

@cijothomas
cijothomas force-pushed the cijothomas/fix-processor-processed-boundary branch from 7cda835 to 05b0a31 Compare July 31, 2026 21:18
@cijothomas
cijothomas marked this pull request as ready for review July 31, 2026 21:21
@cijothomas
cijothomas requested a review from a team as a code owner July 31, 2026 21:21

@lzchen lzchen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Let's wait until the spec is merged before merging this.

@github-project-automation github-project-automation Bot moved this to Approved PRs in Python PR digest Aug 3, 2026
@cijothomas

Copy link
Copy Markdown
Member Author

LGTM. Let's wait until the spec is merged before merging this.

open-telemetry/semantic-conventions#3902 is merged now!

@aabmass aabmass left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

Comment thread opentelemetry-sdk/src/opentelemetry/sdk/trace/export/__init__.py Outdated
Comment thread opentelemetry-sdk/tests/trace/export/test_export.py
Comment thread opentelemetry-sdk/tests/logs/test_export.py Outdated
Comment thread opentelemetry-sdk/tests/logs/test_export.py Outdated
@aabmass
aabmass added this pull request to the merge queue Aug 4, 2026
@aabmass aabmass moved this from Approved PRs to Ready for merge in Python PR digest Aug 4, 2026
Merged via the queue into open-telemetry:main with commit 91e49a5 Aug 4, 2026
578 checks passed
@github-project-automation github-project-automation Bot moved this from Ready for merge to Done in Python PR digest Aug 4, 2026
@github-project-automation github-project-automation Bot moved this from In progress to Done in OTel Clients Self Observability Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants