-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
otlp*http modules import grpc #2579
Comments
I dug into this and I don't think we can avoid this. This is because the opentelemetry-proto-go only defines the services and the request message with the grpc service. So for us to make HTTP separate from GRPC the service request message would need to be moved. |
Should this issue be closed? |
I would close this if either we don't think we will ever change how the grpc is generated, or if we decide that this isn't a goal. If the former, we should put an issue into proto-go to address this. |
I will move what I have written on the Slack here. Thanks to Damien who has informed me about this. grpc/protobuf dependency is bringing in lots of packages and increasing the size tremendously for a simple hello world application. Due to this, SDK becomes unreasonable for constraint environments. I have a helloworld application instrumented with the API layer. When I link it with the SDK layer, the size is going off the charts. I compiled the application with
It is almost 8MB difference. I profiled both applications with
I don’t understand why grpc/protobuf dependencies need to be linked in. Am I missing a configuration or is there a bug in bringing in dependencies. Let me know if you want to see the helloworld application. Exporters are
|
@utezduyar protobuf dependencies are needed as EDIT: TBH I am shocked that |
@pellared I am a bit confused. I WireSharked my application and it posted the trace data as JSON to /v1/traces of my local collector. Where is the protobuf then? |
@utezduyar The payload send via HTTP is serialized using protobuf . |
I figured it out. It is the resource information that is posted as json but you are right, I saw the posts as application/x-protobuf on WireShark. Thanks for clarifying. |
@MadVikingGod Are your findings from 1 year ago still valid? If so, is it a complex task to move the service request message? |
Moving the service request is almost certainly not something the proto team want to do, but ultimately it is question for them. |
I am not really understanding the problem or the discussion of moving or not due to my lack of decent understanding of the internals (yet at least). |
@MrAlias I looked at it a bit more and I think I understand it better. I still think my questions are valid regarding for example how C++ can handle it but not go. Anyways. |
@MadVikingGod (CC: @paivagustavo as the author of I investigated this more and I don't believe it is due to the service message request. I think this is something we can solve it in the opentelemetry-go repo. otlptracehttp exporter is not using the grpc. I don't know if go mod why is listing all the dependencies but what is written here is a culprit.
The config data types
|
There have been prior attempts to separate |
grpc dependency is in |
I wanted to see what more things are dependent on grpc and experimented. otlpconfig and proto modules as we discussed before are the only dependencies. otlpconfig split: go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig/options.go: Removed all the mentions of grpc (for the sake of moving foward). proto files: go.opentelemetry.io/proto/otlp/otlp/collector/trace/v1: I deleted both the service and the gateway files (trace_service.pb.gw.go and trace_service_grpc.pb.go). This way, grpc dependency was dropped and my binary size was down 20%. I would like to discuss the possibility of splitting service and gateway files in a separate module to get around go compiler downside. Some contributors in this issue are also committers in opentelemetry-proto-go. What is the best way to discuss this topic with opentelemetry-proto-go? |
Can you provide a proposal for how |
I think the protobuf definition is already good enough and the code generator is doing it's best at splitting code based on different use cases. Therefore I do NOT believe we need a change from the go.opentelemetry.io/proto/otlp repo. The My propose is to have grpc client and grpc server into it's own module in the opentelemetry-proto-go repo. Again, if the go linker could have been able to figure out that it does not need to link the grpc libraries because the code is not used, we wouldn't need to break the generated go files. |
Your proposal is to duplicate the code in |
Not duplicate but split the files in the Let's take the tracing as example: |
How do you plan to split If you move something out of |
I see your point. If we cannot break backwards compatibility, then not sure what options we have left but to duplicate |
Does this have a known performance impact, or is it about disk space? |
Unfortunately, it is not possible (without making a breaking change) to remove the dependency on The fix would require creating v2 modules. For More: #5221 |
Fixed for metrics. For tracing we need v2 modules (tracked as separate issues). |
FYI. it looks like its no longer possible to have both otelmetrichttp and otelmetricgrpc in the same binary. I'm not sure how common this is, but go.opentelemetry.io/contrib/exporters/autoexport is an example.
|
He had to revert the changes because of the comment above. More on the issue:
We would need to use the same packages for HTTP and gRPC OTLP exporters. For me it looks like hard to fix (it would require changes in Unfortunately, I am leaning towards |
Could this be fixed with a v2 of proto-go where the protobufs wouldn't be in a slim package, but always in separate packages from the grpc service? |
AFAIU it won't help as as they will still have the same "file descriptors". |
Removing this out of the |
We need to separate the output folder for the grpc method struct and the grpc server, as the HTTP uses the grpc method. Not sure it is feasible for |
To fix it we would need a fix in https://github.com/golang/protobuf and probably in protoc generation as well. |
Description
This was surfaced in the discussion:#2509
The otlptracehttp client and otlptrace depend on grpc. This is a transitive dependency from internal/otlpconfig. This is counter to why we split these packages into separate mods in the first place.
Environment
Steps To Reproduce
cd exporters/otlp/otlptrace/otlptracehttp
go mod graph | grep grpc
this should be emptygo mod why google.golang.org/grpc
this should report that module does not need grpc.Expected behavior
The HTTP client should not depend on grpc.
Aditional information
otlpconfig
has a config struct that is shared between HTTP client and grpc. This has logic around extracting the variables from the environment. Because the config has settings for grpc this means importingotlpconfig
will import grpc (even if they are later pruned).The text was updated successfully, but these errors were encountered: