Commit graph

290 commits

Author SHA1 Message Date
Chris Price
d5c91fce22 Merge pull request #59 from puppetlabs/theshanx-patch-2
Add internal_list key to MAINTAINERS
2016-09-27 12:54:36 -07:00
theshanx
404fd0cebd Add internal_list key to MAINTAINERS
This change adds a reference to the Google group the maintainers are associated with.
2016-09-27 11:26:12 -07:00
Jeremy Barlow
fd2886b5f7 Merge pull request #58 from rlinehan/TK-308-bump-apache-async
(TK-308) Bump Apache HttpAsyncClient library to 4.1.2
2016-09-27 08:18:29 -07:00
Ruth Linehan
ef8c2030da (TK-308) Bump Apache HttpAsyncClient library to 4.1.2
There was a bug in the previous version of the Apache HttpAsyncClient library
that caused the cline tto hang if the process had exhausted the number of open
file descriptors it was allowed. This bug was fixed in the 4.1.2 release,
which this commit bumps to.
2016-09-26 16:32:07 -07:00
Chris Price
90b701abe6 Merge pull request #56 from rlinehan/TK-354-add-metrics-docs
(TK-354) add metrics docs
2016-09-16 10:43:11 -07:00
Chris Price
81b15189a7 Fix typo an -> any 2016-09-16 10:42:44 -07:00
Scott Walker
1904c3893c Merge pull request #57 from cprice404/maint/master/200-add-maintainers
(200) Add MAINTAINERS
2016-09-16 10:54:09 +01:00
Ruth Linehan
594f55accb (TK-354) Reorder metrics docs
Place Clojure metrics API docs ahead of Java API docs, since probably more
people will use the Clojure API.
2016-09-15 17:27:21 -07:00
Ruth Linehan
c6b6b91da8 (TK-354) Add examples to metrics docs
And some other tweaks in response to review.
2016-09-15 17:24:07 -07:00
Chris Price
5bf122d8ac (200) Add MAINTAINERS 2016-09-15 16:18:18 -07:00
Ruth Linehan
81659166cf (TK-353) Clarify keywords vs strings for Clojure metric-ids
The Clojure metrics API supports metric-ids as vectors of keywords or strings.
Previously, the docs only mentioned that keywords could be used. Strings
should be used if special characters are needed.
2016-09-14 17:05:36 -07:00
Ruth Linehan
2703471854 (TK-354) Add metrics docs 2016-09-13 15:19:42 -07:00
Chris Price
e0368d61df Merge pull request #54 from janelu2/cookiesupport
(TK-295) add tests for cookies
2016-07-19 14:54:49 -07:00
janelu2
23b44ae93d (TK-295) add tests for cookies
(MAINT) remove comments

(MAINT) change body message to reflect 400 status

(MAINT) change test to use Java and Clj API

(MAINT) refactor RequestOptions in let block of java api test

(MAINT) add tests for async cookie support
2016-07-19 14:27:02 -07:00
Chris Price
33650fc7f2 Merge pull request #53 from senior/maint/master/update-stream-docs
(MAINT) Update docs to include :unbuffered-stream
2016-06-21 12:52:50 -07:00
Ryan Senior
943923ff4c (MAINT) Update docs to include :unbuffered-stream
I also added a caveat to the usage of the :stream response body so
users know the behavior isn't streaming, just returns an instance of
InputStream.
2016-06-21 14:45:16 -05:00
Jeremy Barlow
70b5d6d6ae Merge pull request #52 from rlinehan/TK-316-client-metrics-again
(TK-316) Improved client metrics support
2016-05-06 11:04:41 -07:00
Ruth Linehan
60e5a2450a (TK-316) Expand imports 2016-05-06 10:48:16 -07:00
Ruth Linehan
d3325c494e (TK-316) Add back accidentally deleted test 2016-05-05 09:36:56 -07:00
Ruth Linehan
8f3dc54a00 Merge pull request #4 from cprice404/TK-316-client-metrics-again.WORKING_ON_INSTANCEOF_REFACTOR
(TK-316) refactor java code to reduce casting and simplify logic
2016-05-05 09:36:09 -07:00
Chris Price
e5d97eba68 (TK-316) Replace client filter with smaller classes 2016-05-05 06:34:10 -07:00
Chris Price
65451a2e7c (TK-316) Add enum for metrics category 2016-05-05 05:58:24 -07:00
Chris Price
95602726e4 (TK-316) Extract specific filter class for Categories 2016-05-05 05:54:14 -07:00
Chris Price
01038b682d (TK-316) Minor cleanup of filter class 2016-05-05 05:20:35 -07:00
Chris Price
9aef0642c0 (TK-316) DRY up metrics data calculation 2016-05-05 05:03:51 -07:00
Chris Price
6ec92839c1 (TK-316) More explicit methods for timer/data lists 2016-05-05 04:48:07 -07:00
Chris Price
7c702330a2 (TK-316) Create subclasses for ClientMetricData 2016-05-04 17:09:31 -07:00
Chris Price
bf5ef21454 (TK-316) Create subclasses for ClientTimer 2016-05-04 16:52:39 -07:00
Ruth Linehan
e403b2abc8 (TK-316) Add public url conversion method
When constructing url timers for request metrics, we strip off any username,
password, query params, and path fragments on the request uri. This commit
provides a public method to do this conversion of a url, so that users can
take the url they used for their request and easily figure out the url we used
for the metric.
2016-05-04 16:25:52 -07:00
Chris Price
f43594eddb (TK-316) Move private Metrics methods to impl class 2016-05-04 15:52:00 -07:00
Ruth Linehan
34527507ce Merge pull request #3 from cprice404/TK-316-client-metrics-again
(TK-316) Move Java classes to separate metrics namespaces
2016-05-04 15:32:56 -07:00
Chris Price
e8a4ff4707 (TK-316) Move Java classes to separate metrics namespaces 2016-05-04 15:25:58 -07:00
Ruth Linehan
2e99e8a08c (TK-316) Throw error if no metric registry passed into get-client-metrics* fns
Previously, if any of the `get-client-metrics*` methods (in Clojure or Java)
had a nil metric registry passed into them, they would return nil. This commit
updates the behavior of all of these methods to instead return an error - a
schema error (clojure.lang.ExceptionInfo) for the clojure functions, and an
IllegalArgumentException for the java methods.
2016-05-04 15:10:24 -07:00
Ruth Linehan
da4d59fb7d (TK-316) Remove second arity of get-client-metrics* functions
Previously, all the get-client-metrics* functions had two arities - one with a
metric type and one without. This commit removes the arity with a metric type
from all these functions since currently we only have one metric type and
since we aren't entirely certain of what we want the API to be when we add
additional metric types. When we add more metric types, we will change the API
in a backward compatible way.
2016-05-04 10:38:41 -07:00
Ruth Linehan
43cdd07580 (TK-316) Add specific schemas for different categories of metrics data
Rather than having e.g a nil url and method in the metric data when metric-id
is filtered on, or a nil metric id if url and method are filtered on, use
specific schemas for metrics data returned for each metric category - metric
id, url, and url and method.
2016-05-04 10:07:48 -07:00
Ruth Linehan
8ee64549f7 (TK-316) Cleanup for PR feedback
* Don't pass args into `isMatch()` in `ClientMetricFilter`, since this method
isn't static and so has access to the member variables.
Relevant gif: https://aphyr.com/data/posts/317/state.gif.

* Remove unused `metricTypeString` method
2016-04-22 15:09:20 -07:00
Ruth Linehan
55d565acd7 (TK-316) Rename bytes-read to full-response
Rename the Metric Types from `bytes-read`/`init-repsonse` to
`full-response`/`initial-response` (note that the `initial-response` timer has
not yet been implemented, but when it is this will be its name).
2016-04-22 15:08:52 -07:00
Ruth Linehan
19b9208094 (TK-316) Use upstream implementation logic for getOrAddTimer
We are subclassing `Timer` to create our own `ClientTimer` instances.
Unfortunately, the method we would like to use to register these on the
MetricRegistry, `getOrAdd()`, is private. Instead, we have to have our own
`getOrAddTimer()` to handle getting the timer if it has already been
registered, or registering a new one. This commit updates our implementation
of `getOrAddTimer()` to match the logic of `getOrAdd()`.
2016-04-22 15:04:47 -07:00
Ruth Linehan
b744e99749 (TK-316) Improve metrics API
This commit does several things to improve the metrics API:

* Move get-client-metrics(-data) functions off of client:
Previously, the `get-client-metrics(-data)`/`.getClientMetrics(Data)`
functions were on the client. This didn't entirely make sense because if two
clients were using the same metric registry, these functions would actually
return metrics data for *all* clients, rather than just for the client the
function was called on. This commit removes these functions and changes the
tests to use the metrics namepsace/Metrics class versions instead, which take
a metric registry return all http-client related metrics on that metric
registry.

* Add a `with-url-and-method` namespace:
Move the timers that have both the url and the method from the `with-url`
namespace to a new `with-url-and-method` namepsace. This better matches the
data structure are returned in and the filtering mechanisms for getting them
back out (discussed below), and also removes a slight chance of having a
conflict with a url timer.

* Add a ClientTimer class:
Add a ClientTimer class that wraps the Timer class and also holds onto the
url, method, or metric id used to create the timer. Use this to add url,
method, metricId to ClientMetricData.

* Change the `getClientMetrics(Data)` methods to return a map of metric
category to an array of timers or timer data:
Previously, the methods for getting http client metrics/metric data out of a
metric registry returned a map of metric name to timer instance or metric
data. However, the metric name was most likely not useful to users, who
probably just want to iterate through the timers/data. This commit makes the
output of these functions more useful by returning arrays of timers/data
sorted into a map indexed by metric category (url, url and method, or metric
id).

* Add `getClientMetricsBy*` methods:
Add `getClientMetrics(Data)ByUrl`, `getClientMetrics(Data)ByUrlAndMethod`, and
`getClientMetrics(Data)ByMetricId` methods (and clojure versions) that allow
for filtering by a specific metric category and return an array of timers or
timer data that match the url, url and method, or metric id specified.

* Remove the filter-builder functions:
Previously, the `get-client-metrics(-data)` functions did filtering by taking
a filter map, and there were filter-builder functions to build these filter
maps. Now that there are separate filtering methods, these filter maps are no
longer used and the filter-builder functions are removed.
2016-04-19 13:13:10 -07:00
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
Jeremy Barlow
fb39b41260 Merge pull request #50 from rlinehan/client-init-refactor
(TK-179) Refactor clojure client initialization
2016-02-16 07:42:36 -08:00
Ruth Linehan
ecad9f730a (TK-179) Have JavaClient/createClient do coercion of client options
Previously, anything that called `JavaClient/createClient` performed the same
coercion on the client options before passing them in as the argument.  This
commit refactors `createClient` to do this coercion itself, thereby removing a
bunch of duplication.

Also, remove the `common/Client` schema and replace it with the
`HttpAsyncClient` interface, and remove an unnecessary call to `.start` in the
clojure `create-client`.
2016-02-12 14:59:06 -08:00
Ruth Linehan
a801ae5b02 (TK-179) Cleanup for PR feedback
* Remove comment about :sslengine as an option, because it no longer seems to
be supported.
* Remove duplicate `.setSslContext`
* Use -> macro to clean up client creation and coersion of options
* Remove outdated TODO on the `common/Client` schema
* Remove unused `SslOptions` schema
* Remove unused imports
2016-02-08 14:15:41 -05:00
Ruth Linehan
4176251521 (TK-179) Remove unused ssl config functions
These functions were previously used for initializing an ssl context for the
clojure http client. However, with the clojure client initialization now just
wrapping the java code, these are no longer needed.
2016-02-08 14:00:07 +00:00
Ruth Linehan
80ed08e75b (TK-179) Refactor clojure client init to use JavaClient/createClient
Previously, there were two completely separate code paths for java and clojure
http client initialization. This meant that there was a lot of duplicated
logic between them for handling a number of client options, such as redirect
strategy, ssl protocols and ciphers, and ssl setup.

This refactors clojure client initialization to use JavaClient/createClient,
thereby removing a lot of this duplication.
2016-02-08 13:59:22 +00:00
Ruth Linehan
24b3d52845 Merge pull request #47 from scottyw/tk179/consolidation
(TK-179) Modify the Clojure implementation to share more of the Java impl
2016-02-04 17:40:05 +00:00
Scott Walker
66c584fff4 Handle an empty content type in the response 2016-02-04 13:11:27 +00:00
Scott Walker
63962dbe45 Apply callback during failure/cancellation. 2016-02-04 12:08:32 +00:00
Scott Walker
41836a72ad Add async/sync test to check that a bad HTTP verb is rejected 2016-02-04 11:07:07 +00:00
Scott Walker
e71c5b8434 Throw error on bad HTTP verb in Clojure 2016-02-04 10:47:24 +00:00