Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDK Trace: Adding span collection limits #942

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ New:
([#697](https://github.com/open-telemetry/opentelemetry-specification/pull/697))
* API was extended to allow adding arbitrary event attributes ([#874](https://github.com/open-telemetry/opentelemetry-specification/pull/874))
* `exception.escaped` was added ([#784](https://github.com/open-telemetry/opentelemetry-specification/pull/784))
- Add default limits to the number of events in SDK Spans
([#942](https://github.com/open-telemetry/opentelemetry-specification/pull/942))

Updates:

Expand Down
4 changes: 4 additions & 0 deletions spec-compliance-matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ status of the feature is not known.
|[TracerProvider](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/api.md#tracerprovider-operations)|
|Create TracerProvider | + | + | + | + | + | + | + | + | + | + |
|Get a Tracer | + | + | + | + | + | + | + | + | + | + |
|Set a collection limit | | | | | | | | | | |
|Get a collection limit | | | | | | | | | | |
|Safe for concurrent calls | + | + | + | | + | + | + | + | + | + |
|[Tracer](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/api.md#tracer-operations)|
|Create a new Span | + | + | + | + | + | + | + | + | + | + |
Expand All @@ -37,6 +39,8 @@ status of the feature is not known.
|IsRecording | + | + | + | + | + | + | + | | + | + |
|Set status | + | + | + | + | + | + | + | + | + | + |
|Safe for concurrent calls | + | + | + | | + | + | + | + | + | + |
|Set a collection limit | | | | | | | | | | |
|Discard events greater than collection limit | | | | | | | | | | |
toumorokoshi marked this conversation as resolved.
Show resolved Hide resolved
|[Span attributes](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/api.md#set-attributes)|
|SetAttribute | + | + | + | + | + | + | + | + | + | + |
|Set order preserved | + | - | + | + | + | + | + | + | + | + |
Expand Down
22 changes: 21 additions & 1 deletion specification/trace/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,27 @@ Thus, the SDK specification defines sets of possible requirements for
that the [span creation API](api.md#span-creation) returned (or will return) to the user
(for example, the `Span` could be one of the parameters passed to such a function,
or a getter could be provided).


## Span Event Limits

Erroneous code can add unintended events to a span. If these containers are
unbounded, they can quickly exhaust available memory, resulting in crashes that
are difficult to recover from safely.

To protect against such errors, SDK Spans MUST discard attributes, links, and
events that would increase the size of each collection beyond a limit configured
in the `TracerProvider`, or for the span specifically.

There MUST be a log message emitted by the SDK for each object discarded.
toumorokoshi marked this conversation as resolved.
Show resolved Hide resolved

The following interfaces MUST exist:

- `TracerProvider`: a method to set a maximum collection size
- `TracerProvider`: a method to retrieve the maximum collection size
toumorokoshi marked this conversation as resolved.
Show resolved Hide resolved
- `Span`: a method to set a maximum collection size for the span
toumorokoshi marked this conversation as resolved.
Show resolved Hide resolved

The default for this limit SHOULD be 1000. A value of 0 indicates no limit.
toumorokoshi marked this conversation as resolved.
Show resolved Hide resolved

## Span processor

Span processor is an interface which allows hooks for span start and end method
Expand Down