question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tidy Up (and/or Document) `.proto` Files

See original GitHub issue

Describe request or inquiry

I have created this issue to request tidy up of (and/or documentation for) these two issues:

  1. .proto File Duplication - We might be able to tidy this up.
  2. Inconsistent use of .protos - Most — if not, all — of this inconsistency is inevitable (because gRPC code generation works differently for the various programming languages used by the Online Boutique microservices).

1. .proto File Duplication

2. Inconsistent Use of .protos

The way in which a microservice uses the .proto files and generates its gRPC code depends on the programming language of that microservice. Ideally, gRPC (and .proto file) usage would be better documented for each microservice. Here’s some info about the overall issue, for now:

Microservice Language How are .protos used? Generated gRPC Code .proto file used
adservice Java /src/adservice/src/release/v0.3.6/proto/demo.proto
cartservice C# /src/protos/Cart.proto
checkoutservice Go See /src/checkoutservice/genproto.sh /src/checkoutservice/genproto/demo.pb.go /pb/demo.proto
currencyservice JavaScript gRPC code is generated during runtime, so we just need to feed the .proto file(s) into the gRPC library when we run the Node.js server. /src/currencyservice/proto/demo.proto
emailservice Python See /src/emailservice/genproto.sh /src/emailservice/demo_pb2.py & /src/emailservice/demo_pb2_grpc.py /pb/demo.proto
frontend Go See /src/frontend/genproto.sh /src/frontend/genproto/demo.pb.go /pb/demo.proto
loadgenerator Python The loadgenerator just makes HTTP requests to the frontend service. No gRPC is used.
recommendationservice Python See /src/recommendationservice/genproto.sh /src/recommendationservice/demo_pb2.py & /src/recommendationservice/demo_pb2_grpc.py /pb/demo.proto
shippingservice Go See /src/shippingservice/genproto.sh /src/shippingservice/genproto/demo.pb.go /pb/demo.proto
paymentservice JavaScript gRPC code is generated during runtime, so we just need to feed the .proto file(s) into the gRPC library when we run the Node.js server. /src/paymentservice/proto/demo.proto
productcatalogservice Go See /src/productcatalogservice/genproto.sh /src/productcatalogservice/genproto/demo.pb.go /pb/demo.proto

What purpose/environment will this feature serve?

  • Tidying up the .protos will help reduce the learning curve of this repo, and make it easier for new developers to contribute and use Online Boutique.

What inspired this issue?

  • A team at Google is using Online Boutique to showcase the Retail API. The team faced some friction while trying to refactor the .protos for the Python microservices and the frontend service.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
mic-maxcommented, Jun 7, 2022

In OpenTelemetry we started a fork and have some work done to remove these duplicate .proto files as part of the following PRs:

Each service’s Dockerfile copies from /pb/demo.proto and runs protoc to generate the language files at build time rather than checking them in. Just FYI 😃

1reaction
NimJaycommented, Jun 7, 2022

Wow, @mic-max, thank you so much for sharing your work!

I realized that the pull-requests (PRs) you shared contain changes (e.g., changes specific to the timestamp.proto that’s not found in our* repo) that are outside the scope of this GitHub issue (#814), so we might have to do some careful sifting to leverage the PRs. But we’ll definitely take inspiration from them (and I’m sure we’ll find them useful). And, of course, feel free to create PRs into our* repo (containing just the .proto file relocations).

our* repo” = github.com/GoogleCloudPlatform/microservices-demo

Read more comments on GitHub >

github_iconTop Results From Across the Web

Language Guide (proto3) | Protocol Buffers - Google Developers
This guide describes how to use the protocol buffer language to structure your protocol buffer data, including .proto file syntax and how to...
Read more >
Using Protocol Buffers in Angular | by Justin Holiday - Medium
Use protocol buffers in angular applications. 1. Define Your Service. Create a proto/hello.proto file and define a HelloWorld service as follows: ...
Read more >
prost-build - prost_build - Rust
prost-build` compiles `.proto` files into Rust. ... then you may need to clean up the documentation in order that cargo test --doc will...
Read more >
Error using import in .proto file - Stack Overflow
You have to use the --proto_path command-line flag (aka -I ) to tell protoc where to look for .proto files. If you don't...
Read more >
Introducing buf format - Buf.build
To see it in action, take this very poorly formatted .proto file: ... can clean up any syntactically valid Protobuf, no matter how...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found