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

Shippingservice rust #179

Merged
merged 20 commits into from
Jul 13, 2022

Conversation

GaryPWhite
Copy link
Contributor

Fixes #35

Changes

remove golang implementation of shippingservice, written in rust now.

For significant contributions please make sure you have completed the following items:

@GaryPWhite GaryPWhite requested a review from a team as a code owner June 30, 2022 14:15
@GaryPWhite
Copy link
Contributor Author

@TommyCpp

@GaryPWhite
Copy link
Contributor Author

I'm aware that genproto.sh was removed from most projects in #94 -- I'm not sure if that's the right move here, since generating the files automatically with docker is not possible -- the build context required is not permitted by the fact the dockerfile sits two directories above where the original proto files live -- and generating them appropriately with build.rs necessitates the installation of cargo and mounting of a target folder (potentially from a different OS) into the container's build context. To build with docker, one would have to have cargo installed, which may defeat the purpose of using docker. Happy to discuss in detail as needed.

@GaryPWhite
Copy link
Contributor Author

tl;dr, it generates code in the same directory as the target executables -- and the filenames are pseudo-random. if we could generate protos to some directory instead, that would be great -- but as I understand that's functionally similar to what genproto is doing anyways.

@mic-max
Copy link
Contributor

mic-max commented Jun 30, 2022

I'm aware that genproto.sh was removed from most projects in #94 -- I'm not sure if that's the right move here, since generating the files automatically with docker is not possible -- the build context required is not permitted by the fact the dockerfile sits two directories above where the original proto files live -- and generating them appropriately with build.rs necessitates the installation of cargo and mounting of a target folder (potentially from a different OS) into the container's build context. To build with docker, one would have to have cargo installed, which may defeat the purpose of using docker. Happy to discuss in detail as needed.

To generate files in the Dockerfile as other services currently do, the build context .can be set in the docker-compose.yml file, check how the other services are setup in that file for examples. I'm not familiar with Rust so don't know what build.rs is. Seems like a multi-stage Dockerfile would be best for the build. First stage to get all the tools needed and compile the proto and code. Then the second (which would be published) is just the executable essentially.

Copy link
Contributor

@mic-max mic-max left a comment

Choose a reason for hiding this comment

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

LGTM overall, thanks for doing this!!

Did as thorough of a review as I could without knowing Rust, mostly just had some comments about the protocol buffers which I'd be happy to have addressed in a follow up PR

src/shippingservice/genproto.sh Outdated Show resolved Hide resolved
src/shippingservice/README.md Outdated Show resolved Hide resolved
src/shippingservice/proto/README.md Outdated Show resolved Hide resolved
src/shippingservice/proto/demo.proto Outdated Show resolved Hide resolved
src/shippingservice/proto/grpc/health/v1/health.proto Outdated Show resolved Hide resolved
src/shippingservice/src/health_service.rs Outdated Show resolved Hide resolved
src/shippingservice/src/main.rs Outdated Show resolved Hide resolved
src/shippingservice/src/main.rs Outdated Show resolved Hide resolved
src/shippingservice/src/shipping_service.rs Show resolved Hide resolved
Copy link
Member

@julianocosta89 julianocosta89 left a comment

Choose a reason for hiding this comment

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

Added some comments, but the main blocker for me is the Context Propagation.
When running this version I just got a single orphan span for the shipping service.

src/shippingservice/src/main.rs Outdated Show resolved Hide resolved
src/shippingservice/src/shipping_service.rs Outdated Show resolved Hide resolved
@GaryPWhite
Copy link
Contributor Author

GaryPWhite commented Jul 5, 2022

@mic-max Re: Docker and protos: I assumed that the dockerfile should work without the docker-compose -- but it seems like the genproto.sh removal/change prefers that we use docker-compose from the base to build dockerfiles -- almost all dockerfiles are copying ./pb/ and using context: ./ -- I hadn't considered it :) I'll switch it over now.

To generate files in the Dockerfile as other services currently do, the build context .can be set in the docker-compose.yml file, check how the other services are setup in that file for examples. I'm not familiar with Rust so don't know what build.rs is.

build.rs is what cargo (think maven, gradle, npm) would use pre-compilation, or to set parameters during compilation. As I was thinking about this over the long weekend I think there might be a (slightly gross) solution, so long as the pb directory doesn't go anywhere :)

Seems like a multi-stage Dockerfile would be best for the build. First stage to get all the tools needed and compile the proto and code. Then the second (which would be published) is just the executable essentially.

We are using a multi-stage dockerfile -- I think the main issue here is that editing the code and actually running it without the protos in a place was a brain block for me -- I can use a solution as stated above

@GaryPWhite
Copy link
Contributor Author

noting that I've included a change in the next commit that updates loadgenerator's dockerfile to use the not-slim image for python. M1's apparently don't like the slim version! #178 describes the issue, thanks for being patient @julianocosta89 !

@GaryPWhite
Copy link
Contributor Author

@TommyCpp I used your sample (thanks!) for context propagation, I think I'm still missing something sending events over.. would really appreciate a wise set of eyes on if I'm doing this right :)

@julianocosta89
Copy link
Member

@GaryPWhite I've played around a bit with and got the Context Propagation working:
image

I'm adding the changes that I've done in the code review.

Copy link
Member

@julianocosta89 julianocosta89 left a comment

Choose a reason for hiding this comment

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

Suggested changes on main .rs are for the Context Propagation.
Suggested changes on shipping_service.rs are to make the events to work.

src/shippingservice/README.md Outdated Show resolved Hide resolved
src/shippingservice/src/main.rs Outdated Show resolved Hide resolved
src/shippingservice/src/main.rs Show resolved Hide resolved
src/shippingservice/src/shipping_service.rs Outdated Show resolved Hide resolved
src/shippingservice/src/shipping_service.rs Outdated Show resolved Hide resolved
@TommyCpp
Copy link
Contributor

TommyCpp commented Jul 6, 2022

@TommyCpp I used your sample (thanks!) for context propagation, I think I'm still missing something sending events over.. would really appreciate a wise set of eyes on if I'm doing this right :)

Sorry didn't get a chance to take a look at it during the day. But I think @julianocosta89 is right on point 😃

parent_cx contains remote span so we want to use it as a parent of our local span

GaryPWhite and others added 2 commits July 6, 2022 10:28
Co-authored-by: Juliano Costa <julianocosta89@outlook.com>
thanks Julian!

Co-authored-by: Juliano Costa <julianocosta89@outlook.com>
GaryPWhite and others added 2 commits July 6, 2022 10:34
Co-authored-by: Juliano Costa <julianocosta89@outlook.com>
@julianocosta89
Copy link
Member

@GaryPWhite it seems that some files that were deleted previously got back in your last commit.
Was that expected, or they just sneaked in 😅 ?

@GaryPWhite
Copy link
Contributor Author

@julianocosta89 hey wait -- which files are we talking about here? I don't know which ones I put in 😅

@julianocosta89
Copy link
Member

julianocosta89 commented Jul 11, 2022

@julianocosta89 hey wait -- which files are we talking about here? I don't know which ones I put in 😅

src/shippingservice/proto/demo.proto
src/shippingservice/proto/grpc/health/v1/health.proto
src/shippingservice/src/health_service.rs

And I also saw that some items that you had resolved before were back.
Like the blank line at the end of the files:
src/shippingservice/src/shipping_service/tracking.rs
src/shippingservice/src/shipping_service/quote.rs

@julianocosta89
Copy link
Member

@julianocosta89 hey wait -- which files are we talking about here? I don't know which ones I put in 😅

src/shippingservice/proto/demo.proto src/shippingservice/proto/grpc/health/v1/health.proto src/shippingservice/src/health_service.rs

And I also saw that some items that you had resolved before were back. Like the blank line at the end of the files: src/shippingservice/src/shipping_service/tracking.rs src/shippingservice/src/shipping_service/quote.rs

Looks like I'm seeing stuff 👀

@julianocosta89
Copy link
Member

@GaryPWhite yeah...

The getQuote event is not showing up 😢

image

Copy link
Member

@julianocosta89 julianocosta89 left a comment

Choose a reason for hiding this comment

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

LGTM 🚀 !

src/shippingservice/src/shipping_service.rs Show resolved Hide resolved
@julianocosta89
Copy link
Member

julianocosta89 commented Jul 12, 2022

Thank you very much for the contribution @GaryPWhite !

And thanks @TommyCpp for helping us out 😍 in the troubleshooting!

@TommyCpp
Copy link
Contributor

Nice work and thanks for making this happens! @GaryPWhite

@GaryPWhite
Copy link
Contributor Author

woohoo! Just need someone with permission to merge and we're officially in rust! Thanks for all the help everyone :)

@cartersocha
Copy link
Contributor

woohoo! Just need someone with permission to merge and we're officially in rust! Thanks for all the help everyone :)

Could you update your branch? then I'll merge

@julianocosta89
Copy link
Member

@GaryPWhite looks like there are some merge conflicts there.
Would you mind taking a look?

I think after that we are good to merge it!

@GaryPWhite
Copy link
Contributor Author

agh -- sorry for the delay! Fixed the conflict, should be good to go now!

@cartersocha cartersocha merged commit e554195 into open-telemetry:main Jul 13, 2022
@GaryPWhite GaryPWhite deleted the shippingservice_rust branch July 13, 2022 17:31
jmichalak9 pushed a commit to jmichalak9/opentelemetry-demo that referenced this pull request Mar 22, 2024
* functional 0.0.1 rust shipping service 

Co-authored-by: Juliano Costa <julianocosta89@outlook.com>
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.

Reimplement 'shippingservice' in Rust
5 participants