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

feat(grpc): adds support for grpc parsing. #177

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

jcchavezs
Copy link
Contributor

@jcchavezs jcchavezs commented Sep 9, 2020

This is a very early start of a change that does two things:

  1. Adds support for accessing request/response elements like payload, trailer and header in GRPC
  2. Adds support for span customizer to avoid customizations when the span is noop.

Depends on #181

Ping @basvanbeek @anuraaga @adriancole @fho

@coveralls
Copy link

coveralls commented Sep 10, 2020

Coverage Status

Coverage increased (+0.5%) to 74.88% when pulling 92e7337 on grpc_parsers into b98d756 on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.0%) to 73.411% when pulling a5b3b7b on grpc_parsers into f2e3397 on master.

@@ -27,6 +27,24 @@ import (
"github.com/openzipkin/zipkin-go/model"
)

type handleRPCParser struct {
inPayload func(*stats.InPayload, zipkin.SpanCustomizer)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This functions might become func(*stats.InPayload, model.SpanContext, zipkin.SpanCustomizer) because SpanCustomizer does not expose access to the context.

Copy link
Member

Choose a reason for hiding this comment

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

I would expect RPC parser to be slightly more abstract.. It is a bit easier though possibly easier to see this later, when there's a request and response type instead of matching exact grpc lifecycle. I mean it would be easier to see if another RPC model was in use. ex https://github.com/openzipkin/brave/blob/master/instrumentation/grpc/src/main/java/brave/grpc/GrpcRequest.java

@@ -39,3 +39,5 @@ func (*noopSpan) Finish() {}
func (*noopSpan) FinishedWithDuration(duration time.Duration) {}

func (*noopSpan) Flush() {}

func (*noopSpan) IsNoop() bool { return true }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

IsNoop is a convenient function to verify whether a span is noop or not and don't run expensive parsing when the span is noop.


// SpanCustomizer allows to safely customize a span without accesing its lifecycle
// methods
type SpanCustomizer interface {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

🖐️

Copy link
Member

Choose a reason for hiding this comment

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

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.

note: in brave we used to have more direct mapping to grpc hooks, but later changed that to match how we parse other things (deprecated the approach that looks more like this). It might be worth having a look as one outcome that could be nice from this is being able to adapt data similarly.

@@ -27,6 +27,24 @@ import (
"github.com/openzipkin/zipkin-go/model"
)

type handleRPCParser struct {
inPayload func(*stats.InPayload, zipkin.SpanCustomizer)
Copy link
Member

Choose a reason for hiding this comment

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

I would expect RPC parser to be slightly more abstract.. It is a bit easier though possibly easier to see this later, when there's a request and response type instead of matching exact grpc lifecycle. I mean it would be easier to see if another RPC model was in use. ex https://github.com/openzipkin/brave/blob/master/instrumentation/grpc/src/main/java/brave/grpc/GrpcRequest.java


// SpanCustomizer allows to safely customize a span without accesing its lifecycle
// methods
type SpanCustomizer interface {
Copy link
Member

Choose a reason for hiding this comment

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

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.

3 participants