-
Notifications
You must be signed in to change notification settings - Fork 6
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
Create local Marshaler struct that replicates protobuf/jsonpb #6
Conversation
Thanks @nleiva. I was thinking about this, this morning. Would it be a better idea in the output stages e.g. metrics_influx to try and type data according to the types instead of explicitly build in the deserialization and replace that existing functionality? This only effects self-describing correct? |
This affects all data encoded with protobuf (compact and self-describing) when generating a JSON representation of it. Therefore changes are required on codec_gpb.go and codec_gnmi.go. Unlike I'm good either way (you can remove this field as well and let the output remove the quotes to |
@nleiva I agree it does suck that |
I'll test this as is and if it works I am fine to merge and follow up in another issue. |
It's up to you. I haven't done any functionality testing yet other than being able to compile the code, if it looks to you I think it will remove an issue from the current code. The main objective of this pull request is to expose this "trick" in the code as we will need to address it sooner or later. |
I fully agree and I like the patch removal and gets us closer to updating the codebase. Testing today. |
Tested and it works. @sbyx given you started this repository, want to run the change by you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compiled via Docker, tested against live traffic, everything functional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File deleted which is part of tests.
Emitting strings for large numbers should be in accordance to RFC 7159 aka. JSON_IETF |
Right. I believe that's what Chris tried to do with this. See his comments "Paraphrased: while controversial, it is deemed safer to use string encoding for u/int64 to make sure that implementations using IEEE574 for numbers do not go wrong on numbers outside the 53 bits of integer precision they support. Hence their choice for 64 bit being a string in the mapping. We are not changing anything about the output with this pull request, just making sure we do not depend on changes to the vendor folder. This folder will eventually go away (no longer needed with Go modules). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fails in Docker build with:
Cloning into '/pipeline'...
Checking out files: 100% (9525/9525), done.
$GOPATH/go.mod exists but should not
Replication:
cd docker
docker build -t cisco-ie/pipeline-gnmi:6 .
Investigating.
I'll take a look as well. At some point we also want to take a look at Multi-stage Docker builds to keep the image small and make this process way simpler!; Build from a Go ready image, then copy to an Alpine image without the need of all the package installation we have today. Look at this example. I first thought the container would attempt to build this with Go 1.12.5 -> pkgs.alpinelinux.org:go, but the logs say 1.10.8 ( The error reported was a consequence of 108379. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rebased to current master, ran the tests, fixed the Dockerfile. Would prefer if someone else would verify as well. Rebased before #26 so make testall
.
Related to issues/5. We add
EmitUInt64Unquoted
to jsonpb.Marshaler and replicated all its unexported methods.This will let us simplify dependency management (current status is just a hack).