Skip to content

Set span start and end timestamps#98

Merged
reyang merged 2 commits intoopen-telemetry:masterfrom
pyohannes:span-timing
Jun 9, 2020
Merged

Set span start and end timestamps#98
reyang merged 2 commits intoopen-telemetry:masterfrom
pyohannes:span-timing

Conversation

@pyohannes
Copy link
Copy Markdown
Contributor

This adds SDK support for setting start and end timestamps on spans.

  1. The API is extended to allow for specifying end timestamps manually.
  2. Comparison operators to SystemTimestamp and SteadyTimestamp are added.
  3. The Span implementation in the SDK is updated to use given timestamps or calculate timestamps based on the current time.

Copy link
Copy Markdown
Member

@reyang reyang left a comment

Choose a reason for hiding this comment

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

LGTM.

void UpdateName(nostd::string_view name) noexcept override { span_->UpdateName(name); }

void End() noexcept override { span_->End(); }
void End(const trace::EndSpanOptions &options = {}) noexcept override { span_->End(options); }
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.

Is there a reason we have different structures for StartSpanOptions and EndSpanOptions?

Would it make sense to have one common options class, such as SpanOptions ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The intent behind this design is to make it very clear to the API user which option can be set at which time (at start and end).

This also reflects the OpenTracing API, which provides FinishSpanOptions and StartSpanOptions.

@reyang
Copy link
Copy Markdown
Member

reyang commented Jun 8, 2020

@pyohannes please rebase, thanks.

Johannes Tax added 2 commits June 8, 2020 17:00
@pyohannes
Copy link
Copy Markdown
Contributor Author

@reyang This is rebased now.

@reyang reyang merged commit 58736f0 into open-telemetry:master Jun 9, 2020
GerHobbelt pushed a commit to GerHobbelt/opentelemetry-cpp that referenced this pull request Jun 17, 2025
[PROMETHEUS_EXPORTER] Fix default for emitting otel_scope attributes …
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants