-
Notifications
You must be signed in to change notification settings - Fork 350
Description
There are two ways to specify a connection pool "name":
Application Namein the connection string. This was added for Add "Application Name" connection string setting #547 to set theprogram_namethat is displayed in some diagnostic tools.MySqlDataSourceBuilder.UseName. This was added in f53882e to disambiguate multiple data sources that have the same connection string. It's used to set the connection pool name, which is reported in metrics, logging, and activity tags.
(A third way is to use a "keyed service" in DI with a string key; this will have the side effect of calling .UseName.)
There's no good reason for these to be separate. Application Name should be deprecated, and .UseName should be recommended as the preferred approach. If both are specified, UseName will take precedence, otherwise the one that is set will be used. If none are set, the current behavior (for pool.name and program_name) will remain unchanged.
The primary change is that specifying Application Name in the connection string will have the side-effect of setting pool.name (in metrics) to that value for existing clients who are using Application Name but haven't upgraded to MySqlDataSource yet.