diff options
author | Michal Matloka <michal.matloka@softwaremill.com> | 2018-03-02 11:22:31 +0100 |
---|---|---|
committer | Michal Matloka <michal.matloka@softwaremill.com> | 2018-03-02 11:22:31 +0100 |
commit | b8218c95c4836e8dc377c2ec01ec59972b1e5274 (patch) | |
tree | 16e262f99a1cf0ece22ed4dffec0112df663e294 /docs/backends/prometheus.rst | |
parent | 61eb81faf583eaafb0aee4620cd2df9ad5833abd (diff) | |
download | sttp-b8218c95c4836e8dc377c2ec01ec59972b1e5274.tar.gz sttp-b8218c95c4836e8dc377c2ec01ec59972b1e5274.tar.bz2 sttp-b8218c95c4836e8dc377c2ec01ec59972b1e5274.zip |
Prometheus backend
Diffstat (limited to 'docs/backends/prometheus.rst')
-rw-r--r-- | docs/backends/prometheus.rst | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/docs/backends/prometheus.rst b/docs/backends/prometheus.rst new file mode 100644 index 0000000..a86b6e6 --- /dev/null +++ b/docs/backends/prometheus.rst @@ -0,0 +1,18 @@ +.. _prometheus_backend: + +Prometheus backend +============= + +To use, add the following dependency to your project:: + + "com.softwaremill.sttp" %% "prometheus-backend" % "1.1.6" + +This backend depends on `Prometheus JVM Client <https://github.com/prometheus/client_java>`_. Keep in mind this backend registers histograms and gathers request times, but you have to expose those metrics to `Prometheus <https://prometheus.io/>`_ e.g. using `prometheus-akka-http <https://github.com/lonelyplanet/prometheus-akka-http>`_. + +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:: + + implicit val sttpBackend = PrometheusBackend(AkkaHttpBackend(), Some(request => request.uri.toString))
\ No newline at end of file |