Skip to content

[WIP] Add TraceState.#42

Closed
g-easy wants to merge 3 commits into
open-telemetry:masterfrom
g-easy:tracestate
Closed

[WIP] Add TraceState.#42
g-easy wants to merge 3 commits into
open-telemetry:masterfrom
g-easy:tracestate

Conversation

@g-easy
Copy link
Copy Markdown
Contributor

@g-easy g-easy commented Mar 2, 2020

No description provided.

@g-easy
Copy link
Copy Markdown
Contributor Author

g-easy commented Mar 2, 2020

It's not clear to me what this should look like in C++.

In the Java API, it's abstract: TraceState and SpanContext

for (int i = 0; i < n; ++i)
{
char c = key[i];
if (!IsNumberOrDigit(c) && c != '_' && c != '-' && c != '@' && c != '*' && c != '/')
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.

Vendor name has a size limitation of 13 characters according to the spec.

// TODO: IsValidValue

private:
static bool IsNumberOrDigit(char c) { return (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9'); }
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.

IsLowerCaseAlphaOrDigit?

@reyang
Copy link
Copy Markdown
Member

reyang commented Mar 10, 2020

I checked the OT Python code:

  1. TraceState implementation is in the API package here.
  2. HTTP implementation (parser and serializer) of TraceContext is in the API package here.

virtual ~TraceState() = default;

// Returns false if no such key, otherwise returns true and populates value.
virtual bool Get(nostd::string_view key, nostd::string_view *value) const noexcept
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 why it has to be a raw pointer and not a reference?

virtual bool empty() const noexcept { return true; }

// Returns a span of all the entries. The TraceState object must outlive the span.
virtual nostd::span<Entry *> entries() const noexcept { return {}; }
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.

Does it have to contain raw pointers?

@Tianlin-Zhao
Copy link
Copy Markdown
Contributor

I am currently working on context propagation and realized that I need methods from trace states to construct default trace states as well as inserting values for new trace states. Could you implement those as well?


// TODO
//
// static SpanContext Create(TraceId traceId, SpanId spanId, TraceFlags traceFlags, TraceState
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.

Are these definitions going to be up eventually? I need these for my HttpTraceConotext implementation. Thanks

virtual ~TraceState() = default;

// Returns false if no such key, otherwise returns true and populates value.
virtual bool Get(nostd::string_view key, nostd::string_view *value) const noexcept
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.

Do we have set functions for Trace State any where? Could you have that functionality implemented? Thank you

@reyang
Copy link
Copy Markdown
Member

reyang commented Aug 4, 2020

Superseded by #234.

@reyang reyang closed this Aug 4, 2020
GerHobbelt pushed a commit to GerHobbelt/opentelemetry-cpp that referenced this pull request Jun 21, 2024
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.

4 participants