Skip to content

Add Span API.#35

Merged
g-easy merged 6 commits into
open-telemetry:masterfrom
g-easy:span
Feb 25, 2020
Merged

Add Span API.#35
g-easy merged 6 commits into
open-telemetry:masterfrom
g-easy:span

Conversation

@g-easy
Copy link
Copy Markdown
Contributor

@g-easy g-easy commented Feb 3, 2020

No description provided.

@g-easy
Copy link
Copy Markdown
Contributor Author

g-easy commented Feb 3, 2020

Comment thread api/include/opentelemetry/trace/span.h Outdated
Comment thread api/include/opentelemetry/trace/span.h Outdated
Comment thread api/include/opentelemetry/trace/span.h Outdated

// Mark the end of the Span. Only the timing of the first end call for a given {@code Span} will
// be recorded, and implementations are free to ignore all further calls.
virtual void End() = 0;
Copy link
Copy Markdown
Contributor

@rnburn rnburn Feb 3, 2020

Choose a reason for hiding this comment

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

Can we make these noexcept, especially something like End which is likely to be called from a destructor?

If any of these fail, I'd expect a tracer to turn them into noops.

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.

Done.

Considering "API can be used without exceptions", should every function in the API be marked noexcept explicitly?

Comment thread api/include/opentelemetry/trace/span.h Outdated
Comment thread api/include/opentelemetry/trace/noop.h Outdated

/**
* Noop implementation of Tracer
* No-op implementation of Tracer. This class should not be used directly.
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.

Why shouldn't we use a no-op tracer directly?

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.

I assumed a binary using otel wouldn't explicitly create or set or use the NoopTracer. What's the use-case for it? (I removed the comment either way)

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.

I could imagine users wanting to use a different ownership model than the TracerProvider that creates one tracer per named component and ties lifetime to a global.

Envoy, for example, uses one tracer per thread
https://github.com/envoyproxy/envoy/blob/master/source/extensions/tracers/lightstep/lightstep_tracer_impl.cc#L156

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.

That makes sense.

What I was trying to do is steer users away from the NoopTracer specifically, and encouraging them to use the TracerProvider to get a tracer.

Comment thread api/include/opentelemetry/trace/span.h Outdated
@g-easy
Copy link
Copy Markdown
Contributor Author

g-easy commented Feb 19, 2020

What else needs to be done here?

{
namespace trace
{
enum class SpanKind
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.

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.

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.

// Adds an event to the Span, with a custom timestamp, and attributes.
// virtual void AddEvent(nostd::string_view name, core::SteadyTimestamp
// timestamp, nostd::span<std::pair<nostd::string_view name, AttributeValue
// value>> attributes) noexcept = 0;
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.

This should be nostd::span<const std::pair<nostd::string_view, AttributeValue>> since it doesn't modify the std::pair's (and otherwise it won't work with const containers)

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.

Done.

Is std::pair allowed, ABI-wise, or do we need to add a nostd::pair class?

@g-easy g-easy merged commit 3cc2c69 into open-telemetry:master Feb 25, 2020
@g-easy g-easy deleted the span branch February 25, 2020 00:25
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