No description
Find a file
Ruth Linehan df4e36a1aa (TK-316) Add metrics support
This commit adds metrics support to the http client (clojure and java, sync
and async). A metric registry can optionally be passed into the client as a
client option on creation. If a metric registry is present, timers will be
added to time each request.

By default, a timer is added for the URL (stripped of username, password,
query string, and path fragments) and the URL plus the method used for the
request. In addition, a request can include a `metric-id` option, which takes
a tuple of metric ids. If this request option is specified, a timer will be
created for each element of the metric id tuple - thus if the tuple is [:foo
:bar :baz] there will be a foo timer, a foo.bar timer, and a foo.bar.baz
timer.

In addition, each timer has a "MetricType" - currently there is only one
metric type, bytes-read, which is stopped when the full response has been
read. In the future, we may add "response-init" timers that get stopped when
the first byte of the response has been read.

This commit also adds a `get-client-metrics`/`.getClientMetrics` function that
takes a client instance and returns the http client-specific metrics from the
metric registry and a `get-client-metrics-data`/`.getClientMetricsData`
function for clojure and java sync and async clients to get out metrics data
from the client. This function takes a client instance and returns a map of
metric name to a map of metric data (for clojure) or a ClientMetricData object
(for java), both of which include the mean, count, and aggregate for the timer

These `get-client-metrics*`/`.getClientMetrics*` functions also have versions
that take a url, url and method, or metric id to allow for filtering of the
timers/metrics data returned by these functions.

The clojure versions of these functions take a metric filter map. There are
also metric filter builder functions to build up the type of metric filter
desired from a url, a url and method, or a metric id. These will prevent users
from having to know the specifics of how to build a metric themselves; instead
they can use a convenience function.

An empty metric id can be passed in to the filter to return all metric-id
timers.
2016-04-19 13:13:10 -07:00
dev-resources (TK-143) Allow SSLv3 during unit tests 2015-02-12 17:05:06 -08:00
doc Update docs 2015-10-12 19:15:26 +01:00
ext/travisci (MAINT) Improve travisci file 2015-02-12 17:12:05 -08:00
jenkins Fix variable name in deploy script 2014-03-12 13:52:29 -07:00
src (TK-316) Add metrics support 2016-04-19 13:13:10 -07:00
test (TK-316) Add metrics support 2016-04-19 13:13:10 -07:00
.gitignore (maint) Update .gitignore 2016-01-25 14:31:18 +00:00
.travis.yml Remove jdk6 from travis test matrix 2014-04-28 11:17:07 -07:00
CHANGELOG.md (maint) update changelog for 0.4.7 release. 2016-02-02 15:23:23 -08:00
CONTRIBUTING.md Add CONTRIBUTING.md 2014-04-15 17:04:52 -07:00
LICENSE Add license and readme. 2014-03-11 17:38:13 -07:00
project.clj (TK-316) Add metrics support 2016-04-19 13:13:10 -07:00
README.md (PE-11025) Add support section to README.md 2015-07-17 11:06:25 -07:00

puppetlabs/http-client

Build Status

This is a wrapper around the Apache HttpAsyncClient library providing some extra functionality for configuring SSL in a way compatible with Puppet.

Installation

Add the following dependency to your project.clj file:

Clojars Project

Details

Async versions of the http methods are exposed in puppetlabs.http.client.async, and synchronous versions are in puppetlabs.http.client.sync. For information on using these namespaces, see the page on making requests with clojure clients.

Additionally, this library allows you to make requests using Java clients. For information on how to do this, see the page on making requests with java clients.

Support

We use the Trapperkeeper project on JIRA for tickets on clj-http-client, although Github issues are welcome too.