-
Notifications
You must be signed in to change notification settings - Fork 113
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
Implement gRPC server zipkin handler. #96
Conversation
Going to look at the CI failures (not happening locally for some reason) |
Ok should be ready for a look |
1 similar comment
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.
one small question! otherwise LG from non-go person pov
middleware/grpc/client.go
Outdated
return func(c *clientHandler) { | ||
c.rpcHandlers = append(c.rpcHandlers, handler) | ||
} | ||
} | ||
|
||
// WithClientRemoteServiceName will set the value for the remote endpoint's service name on | ||
// all spans. | ||
func WithClientRemoteServiceName(name string) ClientOption { |
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.
if this is in client.go do we need client prefix? not sure of go idioms. In the text I would say something that this is the name of the server :P (or withServerName might work)
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.
It's in the same package as the server so can't have the same function appear twice.
That said I'm not happy with it from an API usage / naming point either. Will have to inspect some more..
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.
Since we don't have a WithServerRemoteServiceName (which would make much less sense) I think there is nothing wrong with naming it WithRemoteServiceName as it's return value is a ClientOption making it clear what the scope is...
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.
Yeah I think server remote name is inconceivable, just erred on the side of consistency. But will remove it.
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.
some points to address.
@jcchavezs how do you feel about ginkgo and gomega dependencies?
middleware/grpc/client.go
Outdated
return func(c *clientHandler) { | ||
c.rpcHandlers = append(c.rpcHandlers, handler) | ||
} | ||
} | ||
|
||
// WithClientRemoteServiceName will set the value for the remote endpoint's service name on | ||
// all spans. | ||
func WithClientRemoteServiceName(name string) ClientOption { |
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.
Since we don't have a WithServerRemoteServiceName (which would make much less sense) I think there is nothing wrong with naming it WithRemoteServiceName as it's return value is a ClientOption making it clear what the scope is...
gomega.Expect(spans[0].Tags).To(gomega.BeEmpty()) | ||
|
||
span := spans[0] | ||
gomega.Expect(span.Kind).To(gomega.Equal(model.Client)) |
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.
Didn't mention this earlier but after some thought I'm still not happy about all of a sudden having introduced a new testing framework while there is a perfectly reasonable standard library testing framework available.
Having a new testing framework in our repo raises the barrier to the community to contribute.
I would have appreciated this first being discussed.
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.
I had meant the previous PR to allow for that discussion and am sorry if it wasn't clear enough from the PR description. It's a bit disheartening hearing about it now though.
"perfectly reasonable standard library testing framework" is quite subjective and more objective is that the http middleware has very poor test coverage - IMO that is due to the lack of a reasonable testing framework.
Let me know what you'd like - I personally would not be able to contribute a PR at all without adding a test framework so none of this would have happened but it might just be me.
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.
To set one thing straight, the state of testing in the http middleware has nothing to do with the quality of the standard library testing framework and everything with the person who wrote the http middleware in the first place. For those interested who I blame I say git blame it ;)
Given that standard library itself is heavily tested and scrutinized by using no external dependencies as well as a lot of very large projects including grpc-go you just added this middleware for, it just shows that the choice for a testing framework is very subjective and usability of frameworks is largely a matter of opinion.
I know you are eager to get grpc middleware added to this lib and I'm grateful for your work on this, don't get me wrong, but ginkgo is your personal or company choice for testing. That doesn't automatically mean it is this projects' favorite. We have a larger scope than individual contributors preferences. Unfortunately due to me not having a lot of time I let this detail slip from sinking in with me and now as initial author (and still) major contributor I'm not happy with having allowed this dependency to be added after it did.
Unless the rest of @openzipkin/core is adamant on continuing the use of ginkgo I will probably revert this to standard testing in the future.
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.
Although we don't have official contributing
guidelines I believe it is common to keep consistency with the rest of the library, introducing a new testing library should include not only the necessity for it (which is important) but also an agreement among contributors. In this specific case I think we are not doing anything we could achieve with std library so I would go for keeping it simple and less dependencies. As @basvanbeek mentioned, using ginkgo more a particular preference and I don't think we need it at this point, tho everybody is encouraged to open an issue to discuss introducing a new library for testing if there is a real need (although using std has the advantage that is is widely adopted, idiomatic and requires no previous knowledge more than some experience with go).
I really love your work @anuraaga!
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.
I guess it was revealed that I'm a Java guy writing Go and need my abstractions :)
I was just hoping to hear in the previous PR but no worries now. Should I leave the tests as is for now or convert to standard lib now?
Will be getting back to this PR tomorrow just want to confirm to get a fast start then.
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.
Leave the tests as is for now... We will convert them in a next PR.
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.
Thanks
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.
Updated
gomega.Expect(spans[0].Tags).To(gomega.BeEmpty()) | ||
|
||
span := spans[0] | ||
gomega.Expect(span.Kind).To(gomega.Equal(model.Client)) |
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.
Thanks
Thanks for the contribution @anuraaga! |
Also removes leftover build tags from previously reverting 1.8 support and implements client's remote service name option.
I ended up making a backwards incompatible change vs the previous commit (
WithRPCHandler
->WithClientRPCHandler
). Let me know if this needs to be preserved across commits and can revert it.