You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a request to resolve this TODO, and to use a better default User-Agent if none is provided to the CronetChannelBuilder.
Problem
If CronetChannelBuilder is used without calling userAgent(), gRPC/Cronet will set a User-Agent with the following form, which lacks any version info about the calling app package, device build, language, or Cronet version, like:
But setting the User-Agent manually like this has a few issues:
Calling new CronetEngine.Builder(context) is potentially expensive, even more expensive that simply building the CronetEngine instance (if the CronetEngine was instantiated using manual selection). This cost can be rectified by also using manual selection for the CronetEngine.Builder, but this is somewhat verbose simply to get the User-Agent.
It's error prone. The CronetEngine.Builder and CronetEngine do not necessarily match.
It's easily-forgotten.
Proposals
1. Without Cronet changes
If CronetChannelBuilder#userAgent() is not called, use the default CronetEngine User-Agent rather than gRPC's. That results in:
We feel that this provides more useful user-agent info than the gRPC version, although I suspect that dropping the gRPC version is also undesirable.
2. With Cronet changes
Unfortunately the previous proposal lacks the grpc version portion. If possible, it would be better to concatenate gRPC's and Cronet's user agents to arrive at the desired User-Agent string containing both Cronet's and gRPC's user-agent shown above. However, I don't believe it is possible with the current Cronet API, replaces rather than prepending.
The text was updated successfully, but these errors were encountered:
Summary
This is a request to resolve this TODO, and to use a better default User-Agent if none is provided to the
CronetChannelBuilder
.Problem
If
CronetChannelBuilder
is used without callinguserAgent()
, gRPC/Cronet will set a User-Agent with the following form, which lacks any version info about the calling app package, device build, language, or Cronet version, like:Because of this, many teams use the
CronetEngine.Builder
to set an explicit User-Agent, like:This results in something more useful like:
But setting the User-Agent manually like this has a few issues:
new CronetEngine.Builder(context)
is potentially expensive, even more expensive that simply building theCronetEngine
instance (if theCronetEngine
was instantiated using manual selection). This cost can be rectified by also using manual selection for theCronetEngine.Builder
, but this is somewhat verbose simply to get the User-Agent.CronetEngine.Builder
andCronetEngine
do not necessarily match.Proposals
1. Without Cronet changes
If
CronetChannelBuilder#userAgent()
is not called, use the default CronetEngine User-Agent rather than gRPC's. That results in:We feel that this provides more useful user-agent info than the gRPC version, although I suspect that dropping the gRPC version is also undesirable.
2. With Cronet changes
Unfortunately the previous proposal lacks the grpc version portion. If possible, it would be better to concatenate gRPC's and Cronet's user agents to arrive at the desired User-Agent string containing both Cronet's and gRPC's user-agent shown above. However, I don't believe it is possible with the current Cronet API, replaces rather than prepending.
The text was updated successfully, but these errors were encountered: