Skip to content

Conversation

majanjua-amzn
Copy link

@majanjua-amzn majanjua-amzn commented Oct 15, 2025

Description

SpanProcessor.onEnding() Specification

This PR serves to implement the in-development feature onEnding() for the span processor. This will allow users to make modifications to the span before it becomes immutable when onEnd() is reached.

Loosely following implementation in Java repo: open-telemetry/opentelemetry-java#6367

Fixes: N/A

Type of change

New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Callout: Maintained previous unit test that validated span processor behaviour without onEnding
  • Added a unit test to ensure onEnding is called in the correct order (in between onStart and onEnd)
  • Added new unit tests to ensure onEnding is called appropriately (once per Span.End())

Does This PR Require a Contrib Repo Change?

No.

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@majanjua-amzn majanjua-amzn force-pushed the main branch 2 times, most recently from 95797e2 to 41c988d Compare October 15, 2025 19:57
@majanjua-amzn majanjua-amzn marked this pull request as ready for review October 15, 2025 20:31
@majanjua-amzn majanjua-amzn requested a review from a team as a code owner October 15, 2025 20:31
@xrmx xrmx moved this to Ready for review in @xrmx's Python PR digest Oct 16, 2025
parent_context: The parent context of the span that just started.
"""

def on_ending(self, span: "Span") -> None:
Copy link
Contributor

@xrmx xrmx Oct 16, 2025

Choose a reason for hiding this comment

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

Since this is still in development in the specs we don't want to make it a public symbol yet, so this can be _on_ending. The same applies to the other methods as well

Copy link
Author

Choose a reason for hiding this comment

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

Done, thanks

CHANGELOG.md Outdated
([#4755](https://github.com/open-telemetry/opentelemetry-python/pull/4755))
- logs: extend Logger.emit to accept separated keyword arguments
([#4737](https://github.com/open-telemetry/opentelemetry-python/pull/4737))
- feat: implement on ending in span processor
Copy link
Contributor

Choose a reason for hiding this comment

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

Needs to be moved to unreleased

Copy link
Author

Choose a reason for hiding this comment

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

Weird, in my local it was put properly then changed when I pushed. Might've been the pre-commit hook. In any case, fixed, thanks

@majanjua-amzn majanjua-amzn force-pushed the main branch 2 times, most recently from ed2fa0c to 708f178 Compare October 16, 2025 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready for review

Development

Successfully merging this pull request may close these issues.

2 participants