Skip to content

Unify Application Name and UseName #1434

Closed
@bgrainger

Description

@bgrainger

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions