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

Adds a custom MarshalJSON method for trace.Link #1852

Closed
wants to merge 10 commits into from

Conversation

IrisTuntun
Copy link
Contributor

Adds a custom MarshalJSON method for trace.Link to marshal all fields.
Should resolve #1820

@codecov
Copy link

codecov bot commented Apr 27, 2021

Codecov Report

Merging #1852 (992c273) into main (392a44f) will increase coverage by 0.1%.
The diff coverage is 100.0%.

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #1852     +/-   ##
=======================================
+ Coverage   78.6%   78.8%   +0.1%     
=======================================
  Files        137     137             
  Lines       7298    7307      +9     
=======================================
+ Hits        5737    5758     +21     
+ Misses      1316    1304     -12     
  Partials     245     245             
Impacted Files Coverage Δ
trace/trace.go 93.7% <100.0%> (+6.9%) ⬆️
exporters/trace/jaeger/jaeger.go 92.8% <0.0%> (+0.5%) ⬆️

Copy link
Contributor

@MrAlias MrAlias left a comment

Choose a reason for hiding this comment

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

Should we just not embed the SpanContext in a Link? Instead make it a field?

CHANGELOG.md Outdated Show resolved Hide resolved
trace/trace.go Outdated Show resolved Hide resolved
@IrisTuntun
Copy link
Contributor Author

Should we just not embed the SpanContext in a Link? Instead make it a field?

Then it will be another issue. I wonder if I should make the change in this PR.

@MrAlias
Copy link
Contributor

MrAlias commented Apr 27, 2021

Then it will be another issue. I wonder if I should make the change in this PR.

I would get the opinion of another approver/maintainer before restarting.

CHANGELOG.md Outdated Show resolved Hide resolved
@Aneurysm9
Copy link
Member

Should we just not embed the SpanContext in a Link? Instead make it a field?

That would also work. I don't have any context for why SpanContext was embedded rather than included as a field, but I'd presume that it was to avoid the need to write passthrough methods to get at the linked trace and span IDs. That said, it doesn't look like the spec provides for any sort of interface for interacting with Links and API Spans are write-only, so once they're added there's no way to access their properties through the API.

As I was reviewing #1846 I was wondering whether the Link type should be moved as well. It would be slightly more complicated since the API does have a Span#AddLink() method, but the spec certainly contemplates that taking separate SpanContext and Attributes arguments, so we could restructure.

@Aneurysm9
Copy link
Member

I see I didn't look closely enough at the issue #1846 was addressing and this topic is discussed there. Added some thoughts: #1845 (comment).

@MrAlias
Copy link
Contributor

MrAlias commented Apr 29, 2021

Closing as the decision outlined in #1845 (comment) is to remove the Link type from the API. We can recreate the type in the SDK without embedding the SpanContext.

@MrAlias MrAlias closed this Apr 29, 2021
@MrAlias
Copy link
Contributor

MrAlias commented Apr 30, 2021

@IrisTuntun we realized that we cannot remove the link and we should instead go with the un-embed solution: #1845 (comment)

Is this something you would like to open a PR for?

@IrisTuntun
Copy link
Contributor Author

@IrisTuntun we realized that we cannot remove the link and we should instead go with the un-embed solution: #1845 (comment)

Is this something you would like to open a PR for?

Sure, I can take this. Will open a PR for it.

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.

trace.Link omits its Attributes field when marshalled to JSON
3 participants