Skip to content
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

Unify Application Name and UseName #1434

Closed
bgrainger opened this issue Jan 10, 2024 · 2 comments
Closed

Unify Application Name and UseName #1434

bgrainger opened this issue Jan 10, 2024 · 2 comments

Comments

@bgrainger
Copy link
Member

bgrainger commented Jan 10, 2024

There are two ways to specify a connection pool "name":

  • Application Name in the connection string. This was added for Add "Application Name" connection string setting #547 to set the program_name that 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.

@bgrainger
Copy link
Member Author

In the documentation, also mention that the "key" for a "keyed service" will be used as the name by default (but can be overridden):

@bgrainger
Copy link
Member Author

Fixed in 2.3.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant