gRPC / Protobuf interface versioning

Paul Verest picture Paul Verest · Nov 10, 2016 · Viewed 8.1k times · Source

Let's say we use gRCP/Protobuf to connect many application. Those application are developped and released at their own team, with their own speed. Over time there will be different version of the the same app (e.g. desktop apps install on user PCs) that use different version on defined interface.

While Protobuf is meant to allow backward compatibility, is there a way to know what version of interface is running at different points?

The simplest implementation is to have interface version equal to app version. But as many languages are used, it is not trivial to implement app versioning in all of them.

So how version interface and let server to know client version? I think server should be able to log

DATETIME connection from AppName v.version [using interface v.version]

Answer

Carl Mastrangelo picture Carl Mastrangelo · Jan 14, 2017

In the upcoming versions of gRPC, there will be a new feature called Server Reflection. This will allow a client to ask the server for the Descriptors that descriptor the proto file being used. Rather than the server knowing about the version the client is running, the client will know what the server is running. If the server descriptor matches the one the client already has, then it will know that they are speaking at the same version.

This will be released in version 1.1.

Note that Protobufs are designed so that you don't have to do this! If you set up your proto correctly, old and new versions of clients and server should work together.