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

Implement gRPC server zipkin handler. #96

Merged
merged 10 commits into from
Jan 2, 2019

Conversation

anuraaga
Copy link
Contributor

@anuraaga anuraaga commented Dec 1, 2018

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.

@anuraaga anuraaga changed the title Implement gRPC server zipkin handler. [WIP] Implement gRPC server zipkin handler. Dec 1, 2018
@anuraaga
Copy link
Contributor Author

anuraaga commented Dec 1, 2018

Going to look at the CI failures (not happening locally for some reason)

@anuraaga anuraaga changed the title [WIP] Implement gRPC server zipkin handler. Implement gRPC server zipkin handler. Dec 1, 2018
@anuraaga
Copy link
Contributor Author

anuraaga commented Dec 1, 2018

Ok should be ready for a look

@coveralls
Copy link

Coverage Status

Coverage remained the same at 66.714% when pulling 619dc76 on anuraaga:grpc_server into 006f66d on openzipkin:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage remained the same at 66.714% when pulling 619dc76 on anuraaga:grpc_server into 006f66d on openzipkin:master.

@coveralls
Copy link

coveralls commented Dec 1, 2018

Coverage Status

Coverage increased (+6.3%) to 73.044% when pulling edfc0b4 on anuraaga:grpc_server into 006f66d on openzipkin:master.

Copy link
Member

@codefromthecrypt codefromthecrypt left a 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

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 {
Copy link
Member

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)

Copy link
Member

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..

Copy link
Member

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...

Copy link
Contributor Author

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.

Copy link
Member

@basvanbeek basvanbeek left a 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 Show resolved Hide resolved
middleware/grpc/client.go Outdated Show resolved Hide resolved
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 {
Copy link
Member

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))
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor

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!

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

middleware/grpc/shared.go Outdated Show resolved Hide resolved
Copy link
Contributor Author

@anuraaga anuraaga left a 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))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@basvanbeek basvanbeek merged commit b7a66d0 into openzipkin:master Jan 2, 2019
@basvanbeek
Copy link
Member

Thanks for the contribution @anuraaga!

@anuraaga anuraaga mentioned this pull request Jan 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants