Skip to content

Commit

Permalink
Merge branch 'main' into log-clone
Browse files Browse the repository at this point in the history
  • Loading branch information
pellared committed Jul 25, 2024
2 parents 132bf81 + c55650e commit b80e89d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ release.

- Remove restriction that sampler description is immutable.
([#4137](https://github.com/open-telemetry/opentelemetry-specification/pull/4137))
- Add in-development `OnEnding` callback to SDK `SpanProcessor` interface.
([#4024](https://github.com/open-telemetry/opentelemetry-specification/pull/4024))

### Metrics

Expand Down
1 change: 1 addition & 0 deletions spec-compliance-matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ formats is required. Implementing more than one format is optional.
| events collection size limit | | + | + | + | + | + | + | + | + | - | - | + |
| attribute collection size limit | | + | + | + | + | + | + | + | + | - | - | + |
| links collection size limit | | + | + | + | + | + | + | + | + | - | - | + |
| [SpanProcessor.OnEnding](specification/trace/sdk.md#onending) | X | - | - | - | - | - | - | - | - | - | - | - |
| [Span attributes](specification/trace/api.md#set-attributes) | Optional | Go | Java | JS | Python | Ruby | Erlang | PHP | Rust | C++ | .NET | Swift |
| SetAttribute | | + | + | + | + | + | + | + | + | + | + | + |
| Set order preserved | X | + | - | + | + | + | + | + | + | + | + | + |
Expand Down
34 changes: 33 additions & 1 deletion specification/trace/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ linkTitle: SDK
- [Span processor](#span-processor)
* [Interface definition](#interface-definition)
+ [OnStart](#onstart)
+ [OnEnding](#onending)
+ [OnEnd(Span)](#onendspan)
+ [Shutdown()](#shutdown)
+ [ForceFlush()](#forceflush)
Expand Down Expand Up @@ -571,11 +572,23 @@ in the SDK:

### Interface definition

The `SpanProcessor` interface MUST declare the following methods:

* [OnStart](#onstart)
* [OnEnd](#onendspan)
* [Shutdown](#shutdown-1)
* [ForceFlush](#forceflush-1)

The `SpanProcessor` interface SHOULD declare the following methods:

* [OnEnding](#onending) method.

#### OnStart

`OnStart` is called when a span is started. This method is called synchronously
on the thread that started the span, therefore it should not block or throw
exceptions.
exceptions. If multiple `SpanProcessors` are registered, their `OnStart` callbacks
are invoked in the order they have been registered.

**Parameters:**

Expand All @@ -590,6 +603,25 @@ exceptions.

**Returns:** `Void`

#### OnEnding

**Status**: [Development](../document-status.md)

`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](api.md#end),
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](#additional-span-interfaces) for the span which is about to be ended.

**Returns:** `Void`

#### OnEnd(Span)

`OnEnd` is called after a span is ended (i.e., the end timestamp is already set).
Expand Down

0 comments on commit b80e89d

Please sign in to comment.