-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Auto-detect compact vs. binary Thrift formats in jaeger-agent UDP servers #1596
Comments
@yurishkuro could you please help me out here where to start? |
The bytes received from udp are decoded here: https://github.com/jaegertracing/jaeger/blob/master/cmd/agent/app/processors/thrift_processor.go This processor is designed to work with a single thrift format (TProtocol), so will require some creative refactoring. But before that it would be good to just experiment with sending compact and binary payloads (eg using go and Node clients) and see if it's possible to tell which is which from the packet header. |
It was very difficult for me to find out protocol from binary payload in binary protocol.
@yurishkuro what's your suggestion? |
we need to know how the first byte is interpreted in the binary protocol, i.e. is there a chance that it may be also equal to 82 |
We can figure out Protocols by reading bytes. Below is the code.
|
Did you check if we're using "strict writes" in binary? because in non-strict mode binary writes struct name without any prefix. If strict write is confirmed, then the check seems to be even simpler, binary starts with 0x80 (first byte of |
Yes, Jaeger binary protocol uses builder.go L64
|
@yurishkuro Could you suggest a way for going forward? We can use the above logic to run it on 1 port. We can deduce the protocol type if run it in single port (e.g. 6831). What do you think? |
Yes, it looks like we can do that. Do you want to create a pull request? We already integration-test clients with the backend: jaeger/crossdock/docker-compose.yml Lines 8 to 12 in 6cb3570
|
I just had a look at the agent code, the refactoring to support multiple Thrift protocols on the same port is going to be pretty invasive. It might look like this:
|
I think this brings little value for the complexity it brings. |
UDP servers are deprecated |
Requirement - what kind of business use case are you trying to solve?
Only open one UDP port on jaeger-agent, to minimize attack surface.
Problem - what in Jaeger blocks you from solving the requirement?
Agent currently uses distinct ports (jaegertracing/documentation#262) for different Thrift formats:
compact
Thrift protocol used by most current Jaeger clientsbinary
Thrift protocol used by Node.js Jaeger client (because thriftrw npm package does not supportcompact
protocol)Proposal - what do you suggest to solve the problem or improve the existing situation?
Perhaps it's possible to detect the format by inspecting a few bytes in the header of the message.
The text was updated successfully, but these errors were encountered: