-
Notifications
You must be signed in to change notification settings - Fork 8
feat: Update span interface to add a new function which will return span id #245
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
Conversation
| } | ||
|
|
||
| func (s *Span) GetSpanId() string { | ||
| return s.Span.SpanContext().SpanID().String() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we expect this value to be not null everytime or do need to something like
if (s.Span.SpanContext().SpanID().HasSpanID()) {
s.Span.SpanContext().SpanID().String()
}
return ""
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idts, if a span doest exist, you should always be able to call this method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be fine. String's null value is empty string in golang. As long as it returns a string, we dont have to check here explicitly
| func TestGetSpanID(t *testing.T) { | ||
| _, s, _ := StartSpan(context.Background(), "test_span", &sdk.SpanOptions{}) | ||
| spanId := s.GetSpanId() | ||
| if len(spanId) == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use assertions instead. ex: assert.Equal(t, 8, SpanIDNoOfBytes)
|
Do we really need this change here in goagent? We can simply do this in TPA if this is the route you want to go Adding it here is not really required imo |
|
Yes, functionally we can get this done using |
Fair enough, but I'm not sure which is better |
|
your inputs here @ryanericson ? |
Ah I see what @varkey98 found which is kind of equivalent. But I agree with @thugrock7, just exposing it in our SDK is cleaner and I don't see any harm. |
varkey98
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #245 +/- ##
=======================================
Coverage ? 61.16%
=======================================
Files ? 59
Lines ? 2688
Branches ? 0
=======================================
Hits ? 1644
Misses ? 964
Partials ? 80 ☔ View full report in Codecov by Sentry. |
|
Merging this, as @stellarhuman needs to use these changes on TPA side PR and want this PR to be included in this month release. |
Description
Added a way to directly get the spanId, from the span that is created.