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

Compliance Matrix Validation for rel1.0.0 -Span #717

Closed
28 of 37 tasks
lalitb opened this issue May 3, 2021 · 8 comments
Closed
28 of 37 tasks

Compliance Matrix Validation for rel1.0.0 -Span #717

lalitb opened this issue May 3, 2021 · 8 comments
Assignees
Labels
release:required-for-ga To be resolved before GA release spec-compliance Not compliant to OpenTelemetry specs
Milestone

Comments

@lalitb
Copy link
Member

lalitb commented May 3, 2021

This ticket is to validate the below attributes of Spec Compliance Matrix for Rel 1.0.0. While validation, if there is any ticket created for non-compliance, mention that next to the non-compliant point below in the description.

Link: https://github.com/open-telemetry/opentelemetry-specification/blob/v1.0.0/spec-compliance-matrix.md#traces

Span:

  • Create root span.
  • Create with default parent (active span)
  • Create with parent from Context -> ( supports parent from SpanContext )
  • No explicit parent Span/SpanContext allowed -> ( support explicit parent SpanContext )
  • SpanProcessor.OnStart receives parent Context -> ( receives parent SpanConext )
  • UpdateName
  • User-defined start timestamp
  • End
  • End with timestamp
  • IsRecording
  • IsRecording becomes false after End
  • Set status with StatusCode (Unset, Ok, Error
  • Safe for concurrent calls
  • events collection size limit Adding span collection limits #365
  • attribute collection size limit Adding span collection limits #365
  • links collection size limit Adding span collection limits #365

Span Attributes:

  • SetAttribute
  • Set order preserved
  • String type
  • Boolean type
  • Double floating-point type
  • Signed int64 type -> (reserved for future support - uint32, int32, uint64 )
  • Array of primitives (homogeneous) -> (reserved for future support - uint32[], int32[], uint64[]. uint8[] )
  • null values documented as invalid/undefined
  • Unicode support for keys and string values -> ( using nostd::string_view)

Span Linking:

  • Add Links
  • Safe for concurrent calls

Span Events:

  • Add Events
  • Add order preserved
  • Safe for concurrent calls

Span Exceptions:

Sampling:

  • Allow samplers to modify tracestate
  • ShouldSample gets full parent Context

Others:

@lalitb lalitb added bug Something isn't working release:required-for-ga To be resolved before GA release spec-compliance Not compliant to OpenTelemetry specs and removed bug Something isn't working labels May 3, 2021
@lalitb lalitb added this to the 1.0.0-rc.1 milestone May 3, 2021
@lalitb lalitb self-assigned this May 11, 2021
@lalitb
Copy link
Member Author

lalitb commented May 12, 2021

Span

Create root span

trace_id = tracer_->GetIdGenerator().GenerateTraceId();

Create with default parent (active span)

trace_api::SpanContext parent =
options.parent.IsValid() ? options.parent : GetCurrentSpan()->GetContext();

Create with parent from Context

This needs clarification as the API expects parent SpanContext, and not the Context object,

if (parent_span_context.IsValid())
{
trace_id = parent_span_context.trace_id();
parent_span_id = parent_span_context.span_id();
is_parent_span_valid = true;

No explicit parent Span/SpanContext allowed

This needs clarification as the API expects parent SpanContext, and not the full parent Context,

SpanContext parent = SpanContext::GetInvalid();

SpanProcessor.OnStart receives parent Context

This needs clarification as it receives parent span_context:

tracer_->GetProcessor().OnStart(*recordable_, parent_span_context);

UpdateName

void Span::UpdateName(nostd::string_view name) noexcept

User-defined start timestamp

recordable_->SetStartTime(NowOr(options.start_system_time));

End

void Span::End(const trace_api::EndSpanOptions &options) noexcept

End with timestamp

struct EndSpanOptions
{
// Optionally sets the end time of a Span.
common::SteadyTimestamp end_steady_time;
};

void Span::End(const trace_api::EndSpanOptions &options) noexcept

IsRecording

bool Span::IsRecording() const noexcept

** IsRecording becomes false after End**

recordable_.reset();

Set status with StatusCode (Unset, Ok, Error
https://github.com/open-telemetry/opentelemetry-cpp/blob/b4584adeaae259df89b33af884c641e70a60a7cf/api/include/opentelemetry/trace/span.h#L35-40

void Span::SetStatus(opentelemetry::trace::StatusCode code, nostd::string_view description) noexcept

Safe for concurrent calls
All the methods of sdk::trace::Span are guarder with a mutex.

mutable std::mutex mu_;

events collection size limit

Not supported, as Span Limits is optional #365

attribute collection size limit

Not supported, as Span Limits is optional #365

links collection size limit

Not supported, as Span Limits is optional #365

@lalitb
Copy link
Member Author

lalitb commented May 12, 2021

Span Attributes

SetAttribute

Attributes can be set as part of Span constructor, and through Span::SetAttribute() method:

void SetAttribute(nostd::string_view key,
const opentelemetry::common::AttributeValue &value) noexcept override;

Set order preserved

attributes are passed to the exporter in the same order as set through Span::SetAttribute() function.

String type

nostd::span<const nostd::string_view>,

Boolean type

Double floating-point type

Signed int64 type


(reserved for future support uint32, int32, uint64).

Array of primitives (homogeneous)

nostd::span<const bool>,
nostd::span<const int32_t>,
nostd::span<const int64_t>,
nostd::span<const uint32_t>,
nostd::span<const double>,
nostd::span<const nostd::string_view>,


(reserved for future support - uint32[], int32[], uint64[]. uint8[] )

null values documented as invalid/undefined

null values are not possible

Unicode support for keys and string values

Both key and value are passed as nostd::string_view, and it is possible to pass the unicode (UTF-8) character streams through it. Thoght it won't be possible to find the size of unicode string, or also not possible to work at code-point level. Exorter need to read the sequence of characters, and handle them accordingly.

@lalitb
Copy link
Member Author

lalitb commented May 12, 2021

Span Linking

Add Links

links.ForEachKeyValue([&](opentelemetry::trace::SpanContext span_context,
const opentelemetry::common::KeyValueIterable &attributes) {
recordable_->AddLink(span_context, attributes);
return true;
});

Safe for concurrent calls

Links are added as part of span creating, so it is safe for concurrent call

@lalitb
Copy link
Member Author

lalitb commented May 16, 2021

Span Events

Add Events

https://github.com/open-telemetry/opentelemetry-cpp/blob/v0.6.0/sdk/src/trace/span.cc#L142

Add order preserved

sdk::trace::SpanData preservers order by storing Events in std::vector:

std::vector<SpanDataEvent> events_;

Each exporter handles order separately.

Safe for concurrent calls

mutex guard.

void Span::AddEvent(nostd::string_view name,
SystemTimestamp timestamp,
const opentelemetry::common::KeyValueIterable &attributes) noexcept
{
std::lock_guard<std::mutex> lock_guard{mu_};

@lalitb
Copy link
Member Author

lalitb commented May 16, 2021

Record Exception

Not Supported ( #760 )

@lalitb
Copy link
Member Author

lalitb commented May 16, 2021

Sampling:

Allow samplers to modify tracestate

struct SamplingResult
{
Decision decision;
// A set of span Attributes that will also be added to the Span. Can be nullptr.
std::unique_ptr<const std::map<std::string, opentelemetry::common::AttributeValue>> attributes;
// The tracestate used by the span.
nostd::shared_ptr<opentelemetry::trace::TraceState> trace_state;
};

ShouldSample gets full parent Context

virtual SamplingResult ShouldSample(
const trace_api::SpanContext &parent_context,
trace_api::TraceId trace_id,

@lalitb
Copy link
Member Author

lalitb commented May 16, 2021

Others

New Span ID created also for non-recording Spans

if (sampling_result.decision == Decision::DROP)
{
// Don't allocate a no-op span for every DROP decision, but use a static
// singleton for this case.
static nostd::shared_ptr<trace_api::Span> noop_span(
new trace_api::NoopSpan{this->shared_from_this()});
return noop_span;

Id Generators

https://github.com/open-telemetry/opentelemetry-cpp/blob/v0.6.0/sdk/include/opentelemetry/sdk/trace/id_generator.h

Span Limits ( Optional )

Not planned. #365

@lalitb
Copy link
Member Author

lalitb commented May 24, 2021

Closing, as validation complete and created required tickets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:required-for-ga To be resolved before GA release spec-compliance Not compliant to OpenTelemetry specs
Projects
None yet
Development

No branches or pull requests

1 participant