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

Panic in marshalling ResourceSpans #1985

Closed
pkositsyn opened this issue Oct 20, 2020 · 10 comments
Closed

Panic in marshalling ResourceSpans #1985

pkositsyn opened this issue Oct 20, 2020 · 10 comments
Labels
bug Something isn't working priority:p2 Medium

Comments

@pkositsyn
Copy link
Contributor

Describe the bug
Marshalling otlpcollectortrace.ExportTraceServiceRequest panics if there are nil components in ResourceSpans (e.g. nil InstrumetationLibrarySpans). Can we fix that somehow?

@pkositsyn pkositsyn added the bug Something isn't working label Oct 20, 2020
@bogdandrutu
Copy link
Member

Yes, can you provide a test that proves this?

@pkositsyn
Copy link
Contributor Author

pkositsyn commented Oct 21, 2020

Created PR with test that panics

@tigrannajaryan
Copy link
Member

@Vemmy124 thanks a lot for the repro. Since you went this far are you perhaps also able provide the fix for the bug?

@bogdandrutu
Copy link
Member

@tigrannajaryan I would like to discuss the solution here, because I think it implies a lot of work. Already started to think about this.

@bogdandrutu
Copy link
Member

One option that I have in mind and looking to do is actually to change all fields to be not-nullable, which will avoid this case.

@pkositsyn
Copy link
Contributor Author

BTW, what was the purpose of nullable fields? I don't really understand. There are comments everywhere like "panics on non-initialized structure" and it's very hard to understand semantical difference between nil and zero-initialized structure

@bogdandrutu
Copy link
Member

That is how protobuf by default generates repeated fields (slices), as a slice to pointer of objects. I think this is historical because iterating with range over a slice of objects (not pointers) was slow (it may still be, not sure if it was fixed) because for _, obj := range slice{} will copy the object.

Here is a proposal that includes your test: #2002

@bogdandrutu
Copy link
Member

We modeled a bit too much on the proto generated code to avoid allocating nil objects. But I think we can make all the objects not nullable and remove that confusion

@pkositsyn
Copy link
Contributor Author

pkositsyn commented Oct 26, 2020

@bogdandrutu @tigrannajaryan SGTM, would you like me to provide PR for that or we're still trying to agree on the idea?

@pkositsyn
Copy link
Contributor Author

As long as there are no nil objects now, we can close the issue

MovieStoreGuy pushed a commit to atlassian-forks/opentelemetry-collector that referenced this issue Nov 11, 2021
* Remove InstallNewPipeline/NewExportPipeline funcs

* Rename stdout NewExporter to New

* Rename prometheus NewExporter func to New

* Rename Jaeger exporter NewRawExporter func to New

* Rename zipkin exporter NewRawExporter func to New

* Rename otlp exporter creation funcs

* Rename processortest exporter creation funcs

* Update PR number in changelog

* Fix spelling error

* Rename remaining NewUnstartedExporter in otlp

* Remove unused testing file
Troels51 pushed a commit to Troels51/opentelemetry-collector that referenced this issue Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority:p2 Medium
Projects
None yet
Development

No branches or pull requests

4 participants