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

fix!: rename SpanContext to SpanReference #440

Closed
wants to merge 3 commits into from

Conversation

fbogsany
Copy link
Contributor

Copy link
Contributor

@robertlaurin robertlaurin left a comment

Choose a reason for hiding this comment

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

Kind of too bad this one made it into the spec :/

@fbogsany
Copy link
Contributor Author

Kind of too bad this one made it into the spec :/

Yeah - "someone" expressed the same sentiment to me privately 😄 . Let's hold off on merging this until next week? I don't think it's truly final yet.

@mwear
Copy link
Member

mwear commented Oct 16, 2020

Kind of too bad this one made it into the spec :/

Yeah - "someone" expressed the same sentiment to me privately 😄 . Let's hold off on merging this until next week? I don't think it's truly final yet.

I echo these sentiments and know there are some ongoing conversations about this. It's probably a good idea to hold off merging until the dust settles.

@codeboten
Copy link
Contributor

There's a spec issue to revert this: open-telemetry/opentelemetry-specification#1126

@codeboten
Copy link
Contributor

The change was reverted in the spec, this PR can be closed

@@ -254,34 +254,34 @@

it 'uses the context from parent if supplied' do
parent = tracer.start_root_span('root')
parent_ctx = OpenTelemetry::Trace.with_span(parent) { |_, ctx| ctx }
parent_ctx = OpenTelemetry::Trace.context_with_span(parent)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change should be made regardless (in another PR).

@@ -227,7 +227,7 @@
end

it 'creates a span with all supplied parameters' do
links = [OpenTelemetry::Trace::Link.new(context)]
links = [OpenTelemetry::Trace::Link.new(span_reference)]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we need to change this too - argument should be span_context instead of context.

parent_span_reference = nil unless parent_span_reference.valid?
parent_span_id = parent_span_reference&.span_id
tracestate = parent_span_reference&.tracestate
trace_id = parent_span_reference&.trace_id
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This logic should be cleaned up - I suspect the obvious change would be more efficient than the repeated "lonely operator".

#
# @return [SpanContext]
attr_reader :context
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I feel like this should be span_context, although we avoid that name in Span due to stuttering (but perhaps we shouldn't?).

private_constant :INVALID_TRACE_ID, :INVALID_SPAN_ID

class << self
# Creates a new {TraceParent} from a supplied {Trace::SpanContext}
# @param [SpanContext] ctx The context
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should read span context

# @return [TraceParent] a trace parent
def from_context(ctx)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps rename this from_span_context


carrier
end

private

def span_context_from(context)
OpenTelemetry::Trace.current_span(context)&.context
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe we can get rid of the lonely operator here.

@fbogsany
Copy link
Contributor Author

I'll close this, however I've identified a bunch of changes we should make regardless (in another PR).

@fbogsany fbogsany closed this Oct 26, 2020
@fbogsany fbogsany deleted the span_context->span_reference branch October 26, 2020 23:42
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