Skip to content
This repository was archived by the owner on Nov 17, 2025. It is now read-only.

RFC for Removing and replacing SpanData#8

Merged
bogdandrutu merged 18 commits intoopen-telemetry:masterfrom
bg451:bg/remove_spandata
Aug 9, 2019
Merged

RFC for Removing and replacing SpanData#8
bogdandrutu merged 18 commits intoopen-telemetry:masterfrom
bg451:bg/remove_spandata

Conversation

@bg451
Copy link
Copy Markdown
Member

@bg451 bg451 commented Jul 12, 2019

No description provided.


SpanData's primary use case comes from the need to construct and report out of band spans, meaning that you're creating "custom" spans for an operation you don't own. A good example of this is a program that takes in structured logs that contain correlation IDs and a duration (e.g. from splunk) and [converts them](https://github.com/lightstep/splunktospan/blob/master/splunktospan/span.py#L43) to spans for your tracing system. [Another example](https://github.com/lightstep/haproxy_log2span/blob/master/lib/lib.go#L292) is running a sidecar on an HAProxy machine, tailing the request logs, and creating spans. SpanData supports the out of band reporting case, whereas you can’t with the current Span API as you cannot set the start and end timestamp, or add any tags at span creation that the sampler might need.

I'd like to propose getting rid of SpanData and `tracer.recordSpanData()` and replacing it by allowing `tracer.startSpan()` and `span.finish()` to accept start and end timestamp options. This reduces the API surface, consolidating on a single span type. Options would meet the requirements for out of band reporting.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe it was my misunderstanding, I thought SpanData was targeting consumers (e.g. exporters) where immutable is desired.
Span was targeting producers, where different components can grab the "current active span" from the context/tracer and append extra information.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

SpanData in the API has the motivation explained by the RFC. In the SDK may have a different usage, but if we need something in the SDK then we can define it there.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There has been additional confusion because the exporters declare a SpanData type, but it's not the same thing that's been discussed as a way to handle "out of band" spans. This RFC is about removing SpanData from the API, not the observer.

Copy link
Copy Markdown
Member

@bogdandrutu bogdandrutu left a comment

Choose a reason for hiding this comment

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

Overall LG with some minor comments. But I am happy to approve this if they are solved.


SpanData's primary use case comes from the need to construct and report out of band spans, meaning that you're creating "custom" spans for an operation you don't own. A good example of this is a program that takes in structured logs that contain correlation IDs and a duration (e.g. from splunk) and [converts them](https://github.com/lightstep/splunktospan/blob/master/splunktospan/span.py#L43) to spans for your tracing system. [Another example](https://github.com/lightstep/haproxy_log2span/blob/master/lib/lib.go#L292) is running a sidecar on an HAProxy machine, tailing the request logs, and creating spans. SpanData supports the out of band reporting case, whereas you can’t with the current Span API as you cannot set the start and end timestamp, or add any tags at span creation that the sampler might need.

I'd like to propose getting rid of SpanData and `tracer.recordSpanData()` and replacing it by allowing `tracer.startSpan()` and `span.finish()` to accept start and end timestamp options. This reduces the API surface, consolidating on a single span type. Options would meet the requirements for out of band reporting.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

SpanData in the API has the motivation explained by the RFC. In the SDK may have a different usage, but if we need something in the SDK then we can define it there.

@tsloughter
Copy link
Copy Markdown
Member

I reread this and now I'm back to reading it as saying there is no way to add to a span during its life and only when it starts or finishes?

If that is the case one worry I have is exception handling. If you can only add events/logs/status when starting or finishing a span it removes the possibility to add those attributes during the life of the span and finishing the span in the handling of a thrown exception.

@bg451
Copy link
Copy Markdown
Member Author

bg451 commented Jul 17, 2019

as saying there is no way to add to a span during its life and only when it starts or finishes?

@tsloughter This wouldn't be the case, just talking about the concept of bulk logging when a span finishes, which is something opentracing allows.

@tsloughter
Copy link
Copy Markdown
Member

@bg451 ah, ok. The phrasing, "getting rid of SpanData and tracer.recordSpanData() and replacing it by allowing tracer.startSpan() and span.finish() to accept start and end timestamp options", threw me off.

Is this also around being able to create spans after the fact from log data? This is important to me for support of an Erlang/Elixir library that outputs events like database query times after the db call that we'd like to generate spans from and attach as children to the process that makes the db request.

@bg451
Copy link
Copy Markdown
Member Author

bg451 commented Jul 17, 2019

Is this also around being able to create spans after the fact from log data?

If I'm understanding the question correctly, yes this is one of the supported use cases. If you can extract a trace context/identifier from your log, you'd be able to make it a child span in that trace. For example (with opentracing start options), this is a sidecar program that would tail HAProxy logs, look for a span context to become a child of, then create/finish the span with the timestamp and tags coming from the parsed log line: https://github.com/lightstep/haproxy_log2span/blob/master/lib/lib.go#L290

@tsloughter
Copy link
Copy Markdown
Member

@bg451 yup, exactly that, thanks.

@bogdandrutu
Copy link
Copy Markdown
Member

This is currently blocked on the author side to respond to all the comments. Waiting for that before another review.

@bogdandrutu
Copy link
Copy Markdown
Member

@carlosalberto one small issue that can be resolved in the specification is time correlation (ensuring monotonic time is used). We do want to ensure inside a span or a sub-trace (spans generated by the same process) that the timestamp is correctly (monotonic) calculated.

I would suggest just a small item in the future work for the moment.

@pavolloffay
Copy link
Copy Markdown
Member

There are benefits of defining it in the SDK. For instance sdk-processors spec can reference it.

@bogdandrutu
Copy link
Copy Markdown
Member

@bg451 please fix the last two comments and I will merge this.

@bg451
Copy link
Copy Markdown
Member Author

bg451 commented Aug 8, 2019

There are benefits of defining it in the SDK.

Just to clarify, it being spandata here right? If so I agree, there still needs to be some sort of concrete type that SDK exporters can read from.

@bogdandrutu
Copy link
Copy Markdown
Member

@bg451 please also respond to my comments in this post #8 (comment)

@bg451
Copy link
Copy Markdown
Member Author

bg451 commented Aug 9, 2019

Oh huh I thought I pushed my changes yesterday morn, looks like I didn't.

@bogdandrutu 375c397#diff-f62a07a10e742d00e2ef6471e1d80d13R39 re your comment

@bogdandrutu
Copy link
Copy Markdown
Member

@tedsuo @carlosalberto @AloisReitbauer @yurishkuro @SergeyKanzhelev @c24t any more comments on this? I would like to merge it but I am looking to have at least one or ideally two more approvers.

Copy link
Copy Markdown
Member

@c24t c24t left a comment

Choose a reason for hiding this comment

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

LGTM

@bogdandrutu bogdandrutu merged commit 8625418 into open-telemetry:master Aug 9, 2019
carlosalberto pushed a commit to carlosalberto/oteps that referenced this pull request Oct 23, 2024
* RFC: Remove SpanData

* formatting

* respond to comments, add related issues

* finishing touches

* rename file

* respond to comments

* edit withOption wording

* Update 0004-remove-spandata.md

Co-Authored-By: Yang Song <songy23@users.noreply.github.com>

* fix typo/github links

* Adds language for including span ID, removes it from open questions

* respond to comments

* Rename 0004-remove-spandata.md to text/0002-remove-spandata.md

* Change finish to end

* Clarify where the isOutOfBand option passed.
carlosalberto pushed a commit to carlosalberto/oteps that referenced this pull request Oct 23, 2024
* RFC: Remove SpanData

* formatting

* respond to comments, add related issues

* finishing touches

* rename file

* respond to comments

* edit withOption wording

* Update 0004-remove-spandata.md

Co-Authored-By: Yang Song <songy23@users.noreply.github.com>

* fix typo/github links

* Adds language for including span ID, removes it from open questions

* respond to comments

* Rename 0004-remove-spandata.md to text/0002-remove-spandata.md

* Change finish to end

* Clarify where the isOutOfBand option passed.
carlosalberto pushed a commit to carlosalberto/oteps that referenced this pull request Oct 30, 2024
* RFC: Remove SpanData

* formatting

* respond to comments, add related issues

* finishing touches

* rename file

* respond to comments

* edit withOption wording

* Update 0004-remove-spandata.md

Co-Authored-By: Yang Song <songy23@users.noreply.github.com>

* fix typo/github links

* Adds language for including span ID, removes it from open questions

* respond to comments

* Rename 0004-remove-spandata.md to text/0002-remove-spandata.md

* Change finish to end

* Clarify where the isOutOfBand option passed.
carlosalberto pushed a commit to open-telemetry/opentelemetry-specification that referenced this pull request Nov 8, 2024
* RFC: Remove SpanData

* formatting

* respond to comments, add related issues

* finishing touches

* rename file

* respond to comments

* edit withOption wording

* Update 0004-remove-spandata.md

Co-Authored-By: Yang Song <songy23@users.noreply.github.com>

* fix typo/github links

* Adds language for including span ID, removes it from open questions

* respond to comments

* Rename 0004-remove-spandata.md to text/0002-remove-spandata.md

* Change finish to end

* Clarify where the isOutOfBand option passed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.