Liking cljdoc? Tell your friends :D

iapetos.collector.ring


allowed-request-methodsclj

The more or less standard request methods which are allowed by default. Anything else gets mapped to :other, to ensure bounded label creation.

The more or less standard request methods which are allowed by default.
Anything else gets mapped to `:other`, to ensure bounded label creation.
sourceraw docstring

default-request-method-fnclj

(default-request-method-fn method)
source

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

ring-fnclj

(ring-fn f options)
source

wrap-instrumentationclj

(wrap-instrumentation handler
                      registry
                      &
                      [{:keys [path-fn label-fn request-method-fn]
                        :or {path-fn :uri
                             label-fn (constantly {})
                             request-method-fn default-request-method-fn}
                        :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.

Similarly, methods are limited to a fixed set (see allowed-request-methods), anything else gets lumped into "OTHER" to avoid creating an unbounded number of labels from user input. If you want to support different methods, implement request-method-fn.

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.

Similarly, methods are limited to a fixed set (see allowed-request-methods),
anything else gets lumped into `"OTHER"` to avoid creating an unbounded
number of labels from user input.  If you want to support different methods,
implement `request-method-fn`.

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
                     request-method-fn default-request-method-fn
                     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.

Similarly, methods are limited to a fixed set (see allowed-request-methods), anything else gets lumped into "OTHER" to avoid creating an unbounded number of labels from user input. If you want to support different methods, implement request-method-fn.

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.

Similarly, methods are limited to a fixed set (see allowed-request-methods),
anything else gets lumped into `"OTHER"` to avoid creating an unbounded 
number of labels from user input.  If you want to support different methods,
implement `request-method-fn`.

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}
                       :as options}])

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 builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close