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

ROX-27396: Collector configloader should not need to be modified when the protobuf is #1993

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

JoukoVirtanen
Copy link
Contributor

Description

A detailed explanation of the changes in your PR.

Feel free to remove this section if it is overkill for your PR, and the title of your PR is sufficiently descriptive.

Checklist

  • Investigated and inspected CI test results
  • Updated documentation accordingly

Automated testing

  • Added unit tests
  • Added integration tests
  • Added regression tests

If any of these don't apply, please comment below.

Testing Performed

TODO(replace-me)
Use this space to explain how you tested your PR, or, if you didn't test it, why you did not do so. (Valid reasons include "CI is sufficient" or "No testable changes")
In addition to reviewing your code, reviewers must also review your testing instructions, and make sure they are sufficient.

For more details, ref the Confluence page about this section.

@JoukoVirtanen JoukoVirtanen requested a review from a team as a code owner December 13, 2024 00:58
@JoukoVirtanen JoukoVirtanen marked this pull request as draft December 13, 2024 00:58
sensor::CollectorConfig runtimeConfig;
google::protobuf::util::JsonParseOptions parseOptions;
parseOptions.ignore_unknown_fields = true;
auto status = google::protobuf::util::JsonStringToMessage(jsonStr, &runtimeConfig, parseOptions);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems silly to first convert to json, then json string, and then to the protobuf class, instead of converting more directly, and it likely is silly. The reason I did this is that this way I don't have to worry as much about the types. E.g. when converting from yaml, in this case, the code assumes that all the values are strings. This is later fixed by JsonStringToMessage. However, if we tried to convert to the protobuf class directly or the json class used by protobuf, we would first have to figure out the type before doing the conversion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant