3 ms·
Sorry you had some bad experiences. Here are some things you could look into if giving gRPC another shot: 1) Its a fault of a team's infrastructure if the bina
by no_circuit 5y ago
Sorry you had some bad experiences. Here are some things you could look into if giving gRPC another shot:
1) Its a fault of a team's infrastructure if the binary requests aren't logged, and there is no is no easy way to link up with the message schemas to decode the messages. Make it configurable to log things, and learn the available command line tools to read messages and make gRPC calls. It is readable because text_format exists: https://googleapis.dev/python/protobuf/latest/google/protobuf/text_format.html https://googleapis.dev/python/protobuf/latest/google/protobu...
2) gRPC error codes are for specific application errors like your tweet failed to send since you said a bad word, or you sent too many tweets in a minute. The semantics of what you need for error handling in your app may not map directly to HTTP error codes which are quite limited. If you need very detailed error handling there is a standard way to attach your own opaque message types for errors: https://github.com/googleapis/googleapis/blob/107a322d4c61b87221f89f627c73029330e17a5e/google/rpc/status.proto#L46 https://github.com/googleapis/googleapis/blob/107a322d4c61b8.... Think saying what offset and length where the bad word occurred so you can highlight it in a UI. What's the standard way to attach any number of errors to a HTTP/REST(/JSON) request? There is none! Just burn developer time inventing a new way each time when you write REST by hand.
3) Sorry can't guess what you experienced regarding versioning, but a common mistake is to reuse and not deprecate field numbers. If one doesn't trust user input, then that goes along with making sure the message makes sense first before using it to affect a change -- never trust a message even if it parses with no error, etc.
4) Single source of truth, both code and documentation, for your API calls, data payloads, and perhaps even logging messages. Code generate the message types /clients for many programming languages. Get text representation for free if needed as well (text_format). Save developer time.
5) Google has an API design guide: https://cloud.google.com/apis/design https://cloud.google.com/apis/design. Oh, and if it doesn't mention it there, at multiple companies I've worked at there was a rule to always use an enum instead of a boolean type, and the default value should be 0 which should have an "unknown" identifier. More often and not you'll need to record something additional like whether or not the field was set in the first place.