Skip to content

Commit

Permalink
finagle-core: Disable request logging by default
Browse files Browse the repository at this point in the history
Problem / Solution

The cost of request logging, even when not being used,
outweighs the cost of having it on by default.

Result

Service owners can manually enable it using the `RequestLogger`
Stack param.

JIRA Issues: CSL-7729

Differential Revision: https://phabricator.twitter.biz/D308476
  • Loading branch information
kevinoliver authored and jenkins committed May 1, 2019
1 parent 872be5f commit ee9cb4e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ Runtime Behavior Changes
"loadband" scoped metrics: "widen", "narrow", "offered_load_ema". These were not
necessary as d-aperture does not change the aperture size at runtime. ``PHAB_ID=D303833``

* finagle-core: Request logging now defaults to disabled. Enable it by configuring the
`RequestLogger` Stack parameter on your `Client` or `Server`. ``PHAB_ID=D308476``

Breaking API Changes
~~~~~~~~~~~~~~~~~~~~

Expand Down
19 changes: 18 additions & 1 deletion doc/src/sphinx/FAQ.rst
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,24 @@ Finagle's :ref:`clients <client_modules>` and :ref:`servers <server_modules>`
have many modules that are tasked with a wide assortment of jobs. When there
is unexpected latency, it can be useful to have visibility into where time
is spent. Finagle's `RequestLogger` can help with this. It can be enabled by
setting the ``com.twitter.finagle.request.Logger`` level to ``TRACE``.
setting the ``com.twitter.finagle.request.Logger`` level to ``TRACE`` and
enabling the stack param:

.. code-block:: scala
// scala
import com.twitter.finagle.filter.RequestLogger
Protocol.client.configured(RequestLogger.Enabled)
Protocol.server.configured(RequestLogger.Enabled)
.. code-block:: java
// java
import com.twitter.finagle.filter.RequestLogger;
Protocol.client.configured(RequestLogger.Enabled().mk());
Protocol.server.configured(RequestLogger.Enabled().mk());
The logs include synchronous and asynchronous time for each stack module's
`Filter`. Synchronous here means the time spent from the beginning of the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ object RequestLogger {
case object Disabled extends Param
case object Enabled extends Param

implicit val param: Stack.Param[Param] = Stack.Param(Param.Enabled)
implicit val param: Stack.Param[Param] = Stack.Param(Param.Disabled)
}

/**
* Enables the [[RequestLogger]] (enabled by default).
* Enables the [[RequestLogger]].
*/
val Enabled: Param = Param.Enabled

/**
* Disables the [[RequestLogger]].
* Disables the [[RequestLogger]] (disabled by default).
*/
val Disabled: Param = Param.Disabled

Expand Down

0 comments on commit ee9cb4e

Please sign in to comment.