Skip to content

Commit c65d441

Browse files
Merge branch 'master' into stable
2 parents 0ee07cf + 8d92f9b commit c65d441

File tree

24 files changed

+120
-56
lines changed

24 files changed

+120
-56
lines changed

ChangeLog.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,47 @@
1-
## Changes Between 2.3.0 and 2.3.1
1+
## Changes Between 2.5.0 and 2.5.1
2+
3+
### Infinite Recursion in Ganglia
4+
5+
Ganglia reporter had an infinite recursion.
6+
7+
GH issue: #71.
8+
9+
10+
## Changes Between 2.4.0 and 2.5.0
11+
12+
### Type Hints Use Fully-Qualified Names
13+
14+
Type hints across the libraries now use fully-qualified names, which means
15+
returned types don't have to be imported in the caller namespaces.
16+
17+
Contributed by Jason Whitlark.
18+
19+
### :total Key In Timers
20+
21+
`metrics.timers/rate` return value now includes `:total`.
22+
23+
Contributed by Andrew Rudenko.
24+
25+
26+
### Added remove-all-metrics function
27+
28+
`metrics-clojure` Now has a function to remove all existing metrics from a given registry.
29+
30+
Contributed by Jason Whitlark.
31+
32+
33+
### Metrics 3.1.1
34+
35+
`metrics-clojure` is now based on [Metrics 3.1.1](https://github.com/dropwizard/metrics/issues/694#issuecomment-77668929).
36+
37+
Contributed by Jason Whitlark.
38+
39+
40+
## Changes Between 2.3.0 and 2.4.0
41+
42+
### Metrics 3.1.0
43+
44+
`metrics-clojure` is now based on [Metrics 3.1.0](https://groups.google.com/forum/#!topic/metrics-user/zwzHnMBcAX4).
245

346
### Improve ring instrumentation.
447

LICENSE.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
MIT/X11 License
22
===============
33

4-
Copyright (c) 2011-2014 Steve Losh and contributors
4+
Copyright (c) 2011-2015 Steve Losh and contributors
55

66
Permission is hereby granted, free of charge, to any person obtaining a copy of
77
this software and associated documentation files (the "Software"), to deal in

README.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Installation
1010

1111
Add this to your `project.clj`'s dependencies:
1212

13-
[metrics-clojure "2.3.0"]
13+
[metrics-clojure "2.4.0"]
1414

1515
That's it.
1616

docs/source/aggregation.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Note: You must include ``metrics-clojure-graphite`` in your project.clj.
2222
metrics-clojure supports aggregating metrics to graphite::
2323

2424
(require '[metrics.reporters.graphite :as graphite])
25-
(import '[java.util.concurrent.TimeUnit])
25+
(import '[java.util.concurrent TimeUnit])
2626
(import '[com.codahale.metrics MetricFilter])
2727

2828
(def GR (graphite/reporter {:host "your.graphite.host"
@@ -56,7 +56,7 @@ and should work, it still needs testing.
5656
metrics-clojure supports aggregating metrics to ganglia::
5757

5858
(require '[metrics.reporters.ganglia :as ganglia])
59-
(import '[java.util.concurrent.TimeUnit])
59+
(import '[java.util.concurrent TimeUnit])
6060
(import '[com.codahale.metrics MetricFilter])
6161

6262
(def ganglia (... your ganglia GMetric config here ...))

docs/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
# built documents.
4949
#
5050
# The short X.Y version.
51-
version = '2.4.0-SNAPSHOT'
51+
version = '2.5.0-SNAPSHOT'
5252
# The full version, including alpha/beta/rc tags.
53-
release = '2.4.0-SNAPSHOT'
53+
release = '2.5.0-SNAPSHOT'
5454

5555
# The language for content autogenerated by Sphinx. Refer to documentation
5656
# for a list of supported languages.

docs/source/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ Installation
33

44
Add this to your ``project.clj``'s dependencies::
55

6-
[metrics-clojure "2.3.1"]
6+
[metrics-clojure "2.5.1"]
77

88
That's it.

docs/source/metrics/gauges.rst

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,7 @@ Examples of metrics you might want to track with a gauge:
1616
Creating
1717
--------
1818

19-
Create your gauge::
20-
21-
(require '[metrics.core :refer [new-registry]])
22-
(require '[metrics.gauges :refer [gauge]])
23-
24-
(def reg (new-registry))
25-
26-
(def files-open
27-
(gauge reg "files-open"
28-
(fn [] (return-number-of-files-open ...))))
29-
30-
That's it. Pretty simple.
31-
32-
``gauge`` is a macro. If you need a function instead you can use ``gauge-fn``,
19+
Create your gauge using ``gauge-fn``::
3320
but you have to pass it a function, not just a body::
3421

3522
(require '[metrics.gauges :refer [gauge-fn]])

docs/source/ring.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ If you want to use a different endpoint you can pass it as a parameter::
3939

4040
(def app (expose-metrics-as-json app "/admin/stats/"))
4141

42+
Using compojure::
43+
44+
(def app
45+
(-> (routes home-routes app-routes)
46+
(wrap-base-url)
47+
(expose-metrics-as-json)))
48+
4249
**WARNING**: this URL will not be protected by a username or password in any way
4350
(yet), so if you have sensitive metrics you might want to think twice about
4451
using it (or protect it yourself).
@@ -70,6 +77,13 @@ You can add some common metrics by using the ``instrument`` middleware::
7077
(require '[metrics.ring.instrument :refer [instrument]])
7178

7279
(def app (instrument app))
80+
81+
Using compojure::
82+
83+
(def app
84+
(-> (routes home-routes app-routes)
85+
(wrap-base-url)
86+
(instrument)))
7387

7488
This will add a number of metrics, listed below.
7589

metrics-clojure-core/project.clj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
(defproject metrics-clojure "2.3.2-SNAPSHOT"
1+
(defproject metrics-clojure "2.5.1-SNAPSHOT"
22
:description "A Clojure façade for Coda Hale's metrics library."
3+
:url "https://github.com/sjl/metrics-clojure"
4+
:license {:name "MIT"}
35
:dependencies [[org.clojure/clojure "1.6.0"]
4-
[com.codahale.metrics/metrics-core "3.0.2"]]
6+
[io.dropwizard.metrics/metrics-core "3.1.1"]]
57
:repositories {"repo.codahale.com" "http://repo.codahale.com"
68
;; to get Clojure snapshots
79
"sonatype" {:url "http://oss.sonatype.org/content/repositories/releases"

metrics-clojure-core/src/metrics/core.clj

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
default-registry
66
(MetricRegistry.))
77

8-
(defn ^MetricRegistry new-registry
8+
(defn ^com.codahale.metrics.MetricRegistry new-registry
99
[]
1010
(MetricRegistry.))
1111

@@ -35,6 +35,14 @@
3535
([^MetricRegistry reg title]
3636
(.remove reg (metric-name title))))
3737

38+
(defn remove-all-metrics
39+
"Remove all the metrics in the given registry, or the default
40+
registry if no registry given."
41+
([] (remove-all-metrics default-registry))
42+
([^MetricRegistry reg]
43+
(doseq [metric (.getNames reg)]
44+
(.remove reg metric))))
45+
3846
(defn replace-metric
3947
"Replace a metric with the given title."
4048
([title ^Metric metric]

0 commit comments

Comments
 (0)