Liking cljdoc? Tell your friends :D

iapetos.collector.ring


initializeclj

(initialize registry
            &
            [{:keys [latency-histogram-buckets labels]
              :or {latency-histogram-buckets [0.001 0.005 0.01 0.02 0.05 0.1 0.2
                                              0.3 0.5 0.75 1 5]}}])

Initialize all collectors for Ring handler instrumentation. This includes:

  • http_request_latency_seconds
  • http_requests_total
  • http_exceptions_total

Additional :labels can be given which need to be supplied using a :label-fn in wrap-instrumentation or wrap-metrics.

Initialize all collectors for Ring handler instrumentation. This includes:

- `http_request_latency_seconds`
- `http_requests_total`
- `http_exceptions_total`

Additional `:labels` can be given which need to be supplied using a
`:label-fn` in [[wrap-instrumentation]] or [[wrap-metrics]].  
sourceraw docstring

metrics-responseclj

(metrics-response registry)

Create a Ring response map describing the given collector registry's contents using the text format (version 0.0.4).

Create a Ring response map describing the given collector registry's contents
using the text format (version 0.0.4).
sourceraw docstring

wrap-instrumentationclj

(wrap-instrumentation handler
                      registry
                      &
                      [{:keys [path-fn label-fn]
                        :or {path-fn :uri label-fn (constantly {})}
                        :as options}])

Wrap the given Ring handler to write metrics to the given registry:

  • http_requests_total
  • http_request_latency_seconds
  • http_exceptions_total

Note that you have to call initialize on your registry first, to register the necessary collectors.

Be aware that you should implement path-fn (which generates the value for the :path label) if you have any kind of ID in your URIs – since otherwise there will be one timeseries created for each observed ID.

For additional labels in the metrics use label-fn, which takes the request as a first argument and the response as the second argument.

Since collectors, and thus their labels, have to be registered before they are ever used, you need to provide the list of :labels when calling initialize.

Wrap the given Ring handler to write metrics to the given registry:

- `http_requests_total`
- `http_request_latency_seconds`
- `http_exceptions_total`

Note that you have to call [[initialize]] on your registry first, to register
the necessary collectors.

Be aware that you should implement `path-fn` (which generates the value for
the `:path` label) if you have any kind of ID in your URIs – since otherwise
there will be one timeseries created for each observed ID.

For additional labels in the metrics use `label-fn`, which takes the request
as a first argument and the response as the second argument.

Since collectors, and thus their labels, have to be registered before they
are ever used, you need to provide the list of `:labels` when calling
[[initialize]].
sourceraw docstring

wrap-metricsclj

(wrap-metrics handler
              registry
              &
              [{:keys [path path-fn on-request label-fn]
                :or {path "/metrics" path-fn :uri label-fn (constantly {})}
                :as options}])

A combination of wrap-instrumentation and wrap-metrics-expose.

Note that you have to call initialize on your registry first, to register the necessary collectors.

Be aware that you should implement path-fn (which generates the value for the :path label) if you have any kind of ID in your URIs – since otherwise there will be one timeseries created for each observed ID.

For additional labels in the metrics use label-fn, which takes the request as a first argument and the response as the second argument.

Since collectors, and thus their labels, have to be registered before they are ever used, you need to provide the list of :labels when calling initialize.

A combination of [[wrap-instrumentation]] and [[wrap-metrics-expose]].

Note that you have to call [[initialize]] on your registry first, to register
the necessary collectors.

Be aware that you should implement `path-fn` (which generates the value for
the `:path` label) if you have any kind of ID in your URIs – since otherwise
there will be one timeseries created for each observed ID.

For additional labels in the metrics use `label-fn`, which takes the request
as a first argument and the response as the second argument.

Since collectors, and thus their labels, have to be registered before they
are ever used, you need to provide the list of `:labels` when calling
[[initialize]].
sourceraw docstring

wrap-metrics-exposeclj

(wrap-metrics-expose handler
                     registry
                     &
                     [{:keys [path on-request]
                       :or {path "/metrics" on-request identity}}])

Expose Prometheus metrics at the given constant URI using the text format.

If :on-request is given, it will be called with the collector registry whenever a request comes in (the result will be ignored). This lets you use the Prometheus scraper as a trigger for metrics collection.

Expose Prometheus metrics at the given constant URI using the text format.

If `:on-request` is given, it will be called with the collector registry
whenever a request comes in (the result will be ignored). This lets you use
the Prometheus scraper as a trigger for metrics collection.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close