Skip to content

Commit

Permalink
finagle-mysql: add missing newRichClient permutation
Browse files Browse the repository at this point in the history
The `newRichClient` method in finagle-mysql does not
allow for both a `dest` and `label` to be passed as
a String, but is defined by the `newClient` method
which it proxies to. Let's add it.

JIRA Issues: CSL-11135

Differential Revision: https://phabricator.twitter.biz/D706140
  • Loading branch information
enbnt authored and jenkins committed Jul 15, 2021
1 parent 3bba41c commit c211bfb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ Note that ``PHAB_ID=#`` and ``RB_ID=#`` correspond to associated messages in com
Unreleased
----------

New Features
~~~~~~~~~~~~

* finagle-mysql: introduce `newRichClient(dest: String, label: String)` method, which removes the
need for extra boilerplate to convert the destination String to a `c.t.finagle.Name` when
specifying both `dest` and `label` in String form. ``PHAB_ID=D706140``

Runtime Behavior Changes
~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
8 changes: 8 additions & 0 deletions finagle-mysql/src/main/scala/com/twitter/finagle/Mysql.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ trait MysqlRichClient { self: com.twitter.finagle.Client[Request, Result] =>
def newRichClient(dest: Name, label: String): mysql.Client with mysql.Transactions =
mysql.Client(newClient(dest, label), richClientStatsReceiver, supportUnsigned)

/**
* Creates a new `RichClient` connected to the logical
* destination described by `dest` with the assigned
* `label`. The `label` is used to scope client stats.
*/
def newRichClient(dest: String, label: String): mysql.Client with mysql.Transactions =
mysql.Client(newClient(dest, label), richClientStatsReceiver, supportUnsigned)

/**
* Creates a new `RichClient` connected to the logical
* destination described by `dest`.
Expand Down

0 comments on commit c211bfb

Please sign in to comment.