opentelemetry-ruby icon indicating copy to clipboard operation
opentelemetry-ruby copied to clipboard

Add `OnEnding` callback to allow processors to mutate spans on the end

Open kaylareopelle opened this issue 1 year ago • 3 comments

OnEnding Status: Development

OnEnding is called during the span End() operation, after the end timestamp has been set. The Span object is still mutable (i.e., SetAttribute, AddLink, AddEvent can be called) while OnEnding is called. This method MUST be called synchronously within the Span.End() API, therefore it should not block or throw an exception. If multiple SpanProcessors are registered, their OnEnding callbacks are invoked in the order they have been registered. The SDK MUST guarantee that the span can no longer be modified by any other thread before invoking OnEnding of the first SpanProcessor. From that point on, modifications are only allowed synchronously from within the invoked OnEnding callbacks. All registered SpanProcessor OnEnding callbacks are executed before any SpanProcessor's OnEnd callback is invoked.

Parameters:

span - a read/write span object for the span which is about to be ended. Returns: Void

Spec: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk.md#onending PR describing the Spec: https://github.com/open-telemetry/opentelemetry-specification/pull/4024

kaylareopelle avatar Aug 28 '24 17:08 kaylareopelle

Hi, @kaylareopelle . I would love to try adding this feature.

pantuza avatar Aug 28 '24 19:08 pantuza

Thanks @pantuza! You're assigned 🎉

kaylareopelle avatar Aug 28 '24 20:08 kaylareopelle

👋 This issue has been marked as stale because it has been open with no activity. You can: comment on the issue or remove the stale label to hold stale off for a while, add the keep label to hold stale off permanently, or do nothing. If you do nothing this issue will be closed eventually by the stale bot.

github-actions[bot] avatar Sep 28 '24 01:09 github-actions[bot]