-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Handle ports > 32k in Zipkin JSON #488
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ type endpoint struct { | |
ServiceName string `json:"serviceName"` | ||
IPv4 string `json:"ipv4"` | ||
IPv6 string `json:"ipv6"` | ||
Port int16 `json:"port"` | ||
Port int32 `json:"port"` | ||
} | ||
type annotation struct { | ||
Endpoint endpoint `json:"endpoint"` | ||
|
@@ -147,10 +147,15 @@ func endpointToThrift(e endpoint) (*zipkincore.Endpoint, error) { | |
if err != nil { | ||
return nil, err | ||
} | ||
port := e.Port | ||
if port >= (1 << 15) { | ||
// Zipkin.thrift defines port as i16, so values between (2^16 and 2^16-1) must be encoded as negative | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2^15 and 2^16-1? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what's the question? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh, yeah |
||
port = port - (1 << 16) | ||
} | ||
|
||
return &zipkincore.Endpoint{ | ||
ServiceName: e.ServiceName, | ||
Port: e.Port, | ||
Port: int16(port), | ||
Ipv4: ipv4, | ||
Ipv6: []byte(e.IPv6), | ||
}, nil | ||
|
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.
is "want" necessary? just do
if have := ....; expected != have {