diff options
author | Michal Matloka <michal.matloka@softwaremill.com> | 2018-03-02 15:53:43 +0100 |
---|---|---|
committer | Michal Matloka <michal.matloka@softwaremill.com> | 2018-03-02 15:53:43 +0100 |
commit | 48ee034116fa541fd92cba6db7ee8a0e447b9869 (patch) | |
tree | cd97d427ce5e109be7c093710b670dd880a111fe /docs | |
parent | b8218c95c4836e8dc377c2ec01ec59972b1e5274 (diff) | |
download | sttp-48ee034116fa541fd92cba6db7ee8a0e447b9869.tar.gz sttp-48ee034116fa541fd92cba6db7ee8a0e447b9869.tar.bz2 sttp-48ee034116fa541fd92cba6db7ee8a0e447b9869.zip |
Code review improvements & gauges for in-progress requests
Diffstat (limited to 'docs')
-rw-r--r-- | docs/backends/prometheus.rst | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/docs/backends/prometheus.rst b/docs/backends/prometheus.rst index a86b6e6..8b89a23 100644 --- a/docs/backends/prometheus.rst +++ b/docs/backends/prometheus.rst @@ -13,6 +13,18 @@ The Prometheus backend wraps any other backend, for example:: implicit val sttpBackend = PrometheusBackend(AkkaHttpBackend()) -It uses by default ``sttp_request_latency`` histogram name, defined in ``PrometheusBackend.DefaultHistogramName``. It is possible to define custom histograms name by passing function mapping request to histogram name:: +It gathers request execution times in ``Histogram``. It uses by default ``sttp_request_latency`` name, defined in ``PrometheusBackend.DefaultHistogramName``. It is possible to define custom histograms name by passing function mapping request to histogram name:: - implicit val sttpBackend = PrometheusBackend(AkkaHttpBackend(), Some(request => request.uri.toString))
\ No newline at end of file + implicit val sttpBackend = PrometheusBackend(AkkaHttpBackend(), request => Some(request.uri.host)) + +You can disable request histograms by passing ``None`` returning function:: + + implicit val sttpBackend = PrometheusBackend(AkkaHttpBackend(), _ => None) + +This backend also offers ``Gauge`` with currently in-progress requests number. It uses by default ``sttp_requests_in_progress`` name, defined in ``PrometheusBackend.DefaultRequestsInProgressGaugeName``. It is possible to define custom gauge name by passing function mapping request to gauge name:: + + implicit val sttpBackend = PrometheusBackend(AkkaHttpBackend(), requestToHistogramNameMapper = request => Some(request.uri.host)) + +You can disable request in-progress gauges by passing ``None`` returning function:: + + implicit val sttpBackend = PrometheusBackend(AkkaHttpBackend(), requestToInProgressGaugeNameMapper = _ => None)
\ No newline at end of file |