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: use gRPC to write spans to cloud trace #97

Merged
merged 36 commits into from
Aug 5, 2020

Conversation

reggiemcdonald
Copy link
Contributor

@reggiemcdonald reggiemcdonald commented Jun 16, 2020

Description

  • Adds a cloudtrace.v2.TraceService client to TraceExporter to be used to write span data to cloud trace
  • Updated tests to work with the new rpc client

Testing

  • Passes existing unit tests
  • Ran the following opentelemetry example found here modified to use the exporter in this PR, and it produced expected results
  • Tested on a live instance

Relevant Info

  • Docs for RPC service can be found here

Fixes #94

@reggiemcdonald reggiemcdonald changed the title #94: use gRPC to write spans to cloud trace refactor: use gRPC to write spans to cloud trace Jun 16, 2020
@reggiemcdonald reggiemcdonald changed the title refactor: use gRPC to write spans to cloud trace feat: use gRPC to write spans to cloud trace Jun 16, 2020
@reggiemcdonald
Copy link
Contributor Author

@nlehrer

@codecov
Copy link

codecov bot commented Jun 22, 2020

Codecov Report

Merging #97 into master will increase coverage by 0.12%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #97      +/-   ##
==========================================
+ Coverage   95.16%   95.29%   +0.12%     
==========================================
  Files          11       11              
  Lines         331      340       +9     
  Branches       69       68       -1     
==========================================
+ Hits          315      324       +9     
  Misses         16       16              
Impacted Files Coverage Δ
...es/opentelemetry-cloud-trace-exporter/src/types.ts 100.00% <ø> (ø)
...es/opentelemetry-cloud-trace-exporter/src/trace.ts 96.36% <100.00%> (+0.53%) ⬆️
...pentelemetry-cloud-trace-exporter/src/transform.ts 95.91% <100.00%> (+0.17%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 501ca1a...825c09c. Read the comment docs.

@aabmass
Copy link
Contributor

aabmass commented Jun 29, 2020

@reggiemcdonald I did a little more digging, protobufjs (which is already a transitive dependency so no additional overhead to add) includes the scripts pbts/pbjs which can generate either functional code (so you don't need proto-loader) or just a .d.ts stub file. Some tradeoffs listed here. As far as creating a bunch of files, I think you could actually do it without checking additional files in as a build step since google-proto-files gives you the protos like you mentioned.

Do you think it's doable?

@reggiemcdonald
Copy link
Contributor Author

reggiemcdonald commented Jun 30, 2020

@reggiemcdonald I did a little more digging, protobufjs (which is already a transitive dependency so no additional overhead to add) includes the scripts pbts/pbjs which can generate either functional code (so you don't need proto-loader) or just a .d.ts stub file. Some tradeoffs listed here. As far as creating a bunch of files, I think you could actually do it without checking additional files in as a build step since google-proto-files gives you the protos like you mentioned.

Do you think it's doable?

Yep! I think that its possible and would be happy to make the change. Just playing around with protobufjs right now, it appears that grpc cannot load protobufjs static files, so I just need to figure out how to work with the protobufjs rpcImpl
@mayurkale22 @dancalvert-google @kintel what do you think?

@kintel
Copy link

kintel commented Jun 30, 2020

I'm not familiar with gRPC, so I cannot really comment on this, but it sounds like your investigation is going in the right direction.

@reggiemcdonald
Copy link
Contributor Author

reggiemcdonald commented Jul 2, 2020

I've implemented the protobufjs solution and tested it on a live instance. You can see the code here.

The reasons that I like this implementation are:

  • Types are automatically generated
  • The protobufjs cli is an npm module and can be easily integrated into the build step without the need for external binaries

I left it off this branch for now in case this isn't the type of change that we want to make. Let me know what you think

@aabmass
Copy link
Contributor

aabmass commented Jul 7, 2020

I'm in favor but will defer to the folks who have been working in this repo longer :) This will also be useful for metrics

@dancalvert-google
Copy link

dancalvert-google commented Jul 7, 2020 via email

@mayurkale22
Copy link
Contributor

At quick glance proto-loader approach looks good to me. That's what we did in OpenTelemetry collector exporter and in OpenCensus agent exporter.

@aabmass
Copy link
Contributor

aabmass commented Jul 16, 2020

@reggiemcdonald IIUC this won't work with web, is that right?

See #114

@aabmass
Copy link
Contributor

aabmass commented Jul 28, 2020

@reggiemcdonald is this ready for another review (going ahead with proto-loader approach), or were you planning more updates?

@reggiemcdonald
Copy link
Contributor Author

reggiemcdonald commented Jul 28, 2020

@aabmass should be ready for re-review! 🙂

Copy link
Contributor

@aabmass aabmass left a comment

Choose a reason for hiding this comment

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

Awesome LGTM!

@reggiemcdonald can you mark any comments that are done as resolved?

@aabmass aabmass merged commit ddf130b into GoogleCloudPlatform:master Aug 5, 2020
@aabmass
Copy link
Contributor

aabmass commented Aug 5, 2020

Awesome, thanks Reggie!

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.

Use gRPC to write spans to cloudtrace
6 participants