Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Consume opamp-spec as a submodule and use protos from it #1

Closed
tigrannajaryan opened this issue Sep 22, 2022 · 11 comments · Fixed by #4
Closed

Consume opamp-spec as a submodule and use protos from it #1

tigrannajaryan opened this issue Sep 22, 2022 · 11 comments · Fixed by #4
Assignees

Comments

@tigrannajaryan
Copy link
Member

tigrannajaryan commented Sep 22, 2022

Depends on open-telemetry/opamp-go#133

This is similar to what we do with OTLP protos in https://github.com/open-telemetry/opentelemetry-proto-go

We need a makefile to re-generate the files every time protos are updated. Generated files should be stored in this repo.

Ideally also a github action that verifies that protos match the generated file.

@tigrannajaryan
Copy link
Member Author

@jlegoff can you help with this?

@jlegoff
Copy link
Contributor

jlegoff commented Sep 22, 2022

@tigrannajaryan yes, I can take it when the protos are moved to opamp-spec

@tigrannajaryan
Copy link
Member Author

tigrannajaryan commented Sep 22, 2022

Sounds good, assigned to you.

In the meantime if you want to start with #3 it would be great.

@tigrannajaryan
Copy link
Member Author

Protos are in the spec now: open-telemetry/opamp-spec#126

If you need anything to be changed in proto files for Java (e.g. java_ options) please create a PR against the spec repo.

@jlegoff
Copy link
Contributor

jlegoff commented Sep 23, 2022

I have started to work on this issue here - I'm struggling with a few build issues but I'm getting help from @jack-berg

@tigrannajaryan
Copy link
Member Author

I have started to work on this issue here - I'm struggling with a few build issues but I'm getting help from @jack-berg

Sounds good. Please move incrementally, keep the PRs small so that they are easy to review.

@jlegoff jlegoff mentioned this issue Sep 26, 2022
@jlegoff
Copy link
Contributor

jlegoff commented Sep 26, 2022

Please move incrementally, keep the PRs small so that they are easy to review

I've made a first PR and kept is as small as I could, even though there's a lot of boiler plate code with the gradle scripts 😅

@jack-berg
Copy link
Member

Generated files should be stored in this repo.

@tigrannajaryan why store the files in the repo?

We need a makefile to re-generate the files every time protos are updated.

Why use a makefile instead of standard java tooling with gradle?

I think the opentelemetry-proto-java and opentelemetry-java gets this right:

  • Its published artifacts contain the classes generated from the protos, but the classes are not checked into source code. If desired, test code could be written that asserts their presence along with any other behavioral invariants we want to guarantee.
  • The current version of the referenced protos can live in source code. Updating to the latest only requires bumping one number in source code, like we do with the otlp protos in opentelemetry-java.

@tigrannajaryan
Copy link
Member Author

@tigrannajaryan why store the files in the repo?

I find it helpful to look at diffs in generated file in PRs. For example if we change generation options diffs are very important to see the effect of the change. If the files are not stored in the repo there is no way to do it. Also if generated files are not stored in the repo ensuring reproducing build is more difficult - you have to ensure you generation process is also reproducible, which is doable but adds one more thing to worry about.

Why use a makefile instead of standard java tooling with gradle?

Ignore that. Use whatever tool makes sense for java.

@jack-berg
Copy link
Member

I find it helpful to look at diffs in generated file in PRs. For example if we change generation options diffs are very important to see the effect of the change. If the files are not stored in the repo there is no way to do it.

I don't disagree with that. However, it does break convention with opentelemetry-java. In my experience, the tooling we use to generate proto classes is very reliable. Having modules that depend on the generated classes like the eventual opamp client / server and corresponding test files improves confidence.

I'm neutral overall, given that there will be no change in experience for someone consuming the artifact whether or not the generated classes are checked into source code.

@tigrannajaryan
Copy link
Member Author

If you don't see the need to have the diffs of generated files in PRs then go with whatever you prefer. It should be long-term maintainers' decision and I am only a temporary maintainer here. It is also possible to change this decision later and start storing generated files in the repo, so no big deal, start with what you prefer now.

tigrannajaryan pushed a commit that referenced this issue Oct 11, 2022
This is a first attempt at setting up the build files and generating the protos.

Since the generated protos are part of the repo, the generation itself is not part of the build pipeline and is set up as an standalone project in the `generateProtos` directory. Regenerating them can be done manually as explained in the README.

While the issue mentions a makefile for proto generation, I took inspiration from [opentelemetry-proto-java](https://github.com/open-telemetry/opentelemetry-proto-java) and used a gradle script instead. I can change that if needed.

Note also that the generated code is not published as a library. I suggest doing this in a separate PR.

Resolves #1
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants