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

Resolve #72 - gRPC Interceptor #621

Merged
merged 9 commits into from
Apr 23, 2020

Conversation

reicheltp
Copy link
Contributor

Resolves #72 by introducing client and server interceptors. It automatically creates spans and messages respecting the specification defined here: https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/data-rpc.md

The interceptors can simply be used during grpc.Dial and grpc.NewServer.

Client Interceptor

tracer := global.Tracer("client-tracer")

var conn *grpc.ClientConn
conn, err := grpc.Dial(":7777", grpc.WithInsecure(),
	grpc.WithUnaryInterceptor(grpctrace.UnaryClientInterceptor(tracer)),
	grpc.WithStreamInterceptor(grpctrace.StreamClientInterceptor(tracer)),
)

Server Interceptor

tracer := global.Tracer("server-tracer")

s := grpc.NewServer(
	grpc.UnaryInterceptor(grpctrace.UnaryServerInterceptor(tracer)),
	grpc.StreamInterceptor(grpctrace.StreamServerInterceptor(tracer)),
)

Known Issues

Currently the message.compressed_size is not logged as we found no way to gather this information from a proto.Message.

@krnowak
Copy link
Member

krnowak commented Apr 7, 2020

Please sign the CLA and please fix the CI issues (run make on your host and include the changes generated by linters and go mod tidy in the PR). Thanks!

@krnowak krnowak added the blocked:CLA Waiting on CLA to be signed before progress can be made label Apr 7, 2020
plugin/grpctrace/interceptor.go Outdated Show resolved Hide resolved
plugin/grpctrace/interceptor.go Outdated Show resolved Hide resolved
plugin/grpctrace/interceptor.go Outdated Show resolved Hide resolved
plugin/grpctrace/interceptor.go Outdated Show resolved Hide resolved
plugin/grpctrace/interceptor.go Outdated Show resolved Hide resolved
@lizthegrey
Copy link
Member

CLA still doesn't appear to be signed.

@reicheltp
Copy link
Contributor Author

@lizthegrey Sorry about the CLA. It's on the desk of my manager. I hope he gets this done during the next couple of days.

@rghetia
Copy link
Contributor

rghetia commented Apr 17, 2020

@reicheltp any update on the CLA?

@reicheltp
Copy link
Contributor Author

@rghetia I've got good news: The CCLA is signed.

@jmacd
Copy link
Contributor

jmacd commented Apr 23, 2020

We have a flaky test.

@lizthegrey
Copy link
Member

Forcing a test rerun.

@lizthegrey lizthegrey removed the blocked:CLA Waiting on CLA to be signed before progress can be made label Apr 23, 2020
@jmacd
Copy link
Contributor

jmacd commented Apr 23, 2020

For some reason I've lost the ability to update this branch. (Did a GH setting change?) Will you update this branch so I can merge it? Thanks.

@jmacd jmacd merged commit 6de3dab into open-telemetry:master Apr 23, 2020
@sudeep-ib sudeep-ib mentioned this pull request May 5, 2020
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.

SDK: Add grpc plugin
5 participants