open-telemetry / open-telemetry/opentelemetry-ruby

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

Open
#1,695 3 comments 0 reactions 1 assignee View on GitHub

@pantuza is already working on this.

Since Aug 28, 2024.

keep
Dominant language
Ruby
Stars
606
Forks
301
Avg merge
3d 19h
Merged PRs (30d)
42

Description

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

Contributor guide

Open the contributing guide

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.